Official comment shows that "This has any effect only on modules such as Dropout or BatchNorm." But I don't understand its implementation.
Dropout and BatchNorm (and maybe some custom modules) behave differently during training and evaluation. You must let the model know when to switch to eval mode by calling .eval()
on the model.
This sets self.training
to False
for every module in the model. If you are implementing your own module that must behave differently during training and evaluation, you can check the value of self.training
while doing so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With