Implemeted Trainer.update
Add test cases to test models.