How to check from within a model if it is currently in train or eval mode?
Asked
Active
Viewed 7,060 times
1 Answers
27
From the Pytorch forum, with a small tweak:
use
if self.training:
# it's in train mode
else:
# it's in eval mode
Always better to have a stack overflow answer than to look at forums.

Gulzar
- 23,452
- 27
- 113
- 201