Zaslat záznam emailem: Using automatic differentiation as a general framework for ptychographic reconstruction