How the encoder, target classifier and adv in the code reverse the gradient?
xyz321123 opened this issue · 1 comments
xyz321123 commented
saist1993 commented
Hey! In line 74 we are adding the main loss and the aux loss (adversarial loss). Thus when the backward is called at line 85, the gradients are propagated to both adversarial and classifier branch.
As for how does the gradient get reversed. In the model file , there is a gradient reversal function which reverses the gradient.