model.train() :啓用 BatchNormalization 和 Dropout
model.eval() :不啓用 BatchNormalization 和 Dropout
固化權重,防止在測試的時候改變
sets the module in evaluation mode.
This has any effect only on certain modules. See documentations of particular modules for details of their behaviors in training/evaluation mode, if they are affected, e.g. Dropout
, BatchNorm
, etc.
This is equivalent with self.train(False)