![](/img/trans.png)
[英]Which PyTorch modules are affected by model.eval() and model.train()?
[英]Model.train() with pre-trained weights makes results all 0 while model.eval() is fine
感谢您对此事的关注。
我想继续用它的预训练权重训练 model。 When I evaluate this pre-trained model with model.eval()
, everything is fine and the model will generate some reasonable results, but when I want to further train this model and set the mode with model.train()
, the problem will发生。 在前向循环期间,在model.train()
语句( batchsize = 1
)之后,所有生成的结果都将为零。
关于为什么会发生这种情况的任何想法?
非常感谢。
批量归一化通过根据批次的估计均值和方差对所有激活进行归一化来工作。
当batchsize=1
时,您期望这些值是多少?
增加您的batchsize
,看看是否出现问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.