Updates to model gradient code
Updates to train_cae