Learning Physics Constrained Dynamics Using Autoencoders