DistillPrep
Python
GenAI
GenAI Frameworks
NLP
Deep Learning
Machine Learning
ML Libraries
Statistics
SQL
MLOps
Cloud
System Design
Blog
Learn
Practice
Test
Live Engine
Select Topic
Numpy Fundamentals
(18)
Numpy Broadcasting
(14)
Pandas Fundamentals
(14)
Pandas Operations And Traps
(12)
Pandas For ML
(11)
Scipy For ML
(10)
Scikit Learn Patterns
(11)
Pytorch Fundamentals
(10)
Pytorch Training Loop
(10)
Tensorflow And Keras
(10)
easy
Pytorch Training Loop
A developer writes a training loop that omits
model.train()
. What can go wrong?
A
Nothing —
model.train()
is optional and only changes a display flag
B
Layers like
Dropout
and
BatchNorm
behave differently in train vs eval mode — without
model.train()
, they may use eval mode behavior (Dropout passes all activations; BatchNorm uses running stats instead of batch stats), degrading training
C
model.train()
must be called before every forward pass — calling it once at the start of training is not sufficient
D
model.train()
is only needed for models with LSTM layers
Previous
Back
Next