What is the meaning of the training attribute?model.train() and model.eval()?

The method will call eval recursively on all modules just in case their behavior differs between the training and evaluation case. This approach is useful if you are writing a custom layer which also switches the behavior.

Dropout will be disabled during eval, so that nothing will be dropped, while BatchNorm will use the running estimates to normalize the data instead of the batch statistics.

1 Like