  Ptychography is a lensless imaging method that allows for wavefront sensing
and phase-sensitive microscopy from a set of diffraction patterns. Recently, it
has been shown that the optimization task in ptychography can be achieved via
automatic differentiation (AD). Here, we propose an open-access AD-based
framework implemented with TensorFlow, a popular machine learning library.
Using simulations, we show that our AD-based framework performs comparably to a
state-of-the-art implementation of the momentum-accelerated ptychographic
iterative engine (mPIE) in terms of reconstruction speed and quality. AD-based
approaches provide great flexibility, as we demonstrate by setting the
reconstruction distance as a trainable parameter. Lastly, we experimentally
demonstrate that our framework faithfully reconstructs a biological specimen.
