Update train_cae to work with model gradient class