In the forward function, sometimes one may want to perform an action only at the test phase, say. Is there any built-in variable that allows to distinguish whether forward function was called during test or train phase?
You could use the internal self.training
attribute to check the current state.
1 Like
This boolean variable is exactly it! Thank you!
1 Like