How to switch from optimizer during training

are you getting any error or something when you are using it?