How to train Encoder network in GAN?

Hi, I am trying to implement BiCOGAN which has a structure like below.

The author says that the Encoder is trained jointly with generator and discriminator. Can anyone give me some advice on how I can implement this in pytorch? How should the update be implemented? and Should I create a separate optimizer just for Encoder? Any advice would be helpful. Thanks :slight_smile: