MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / train

Method train

detrsmpl/models/backbones/resnet.py:619–628  ·  view source on GitHub ↗

Convert the model into training mode while keep normalization layer freezed.

(self, mode=True)

Source from the content-addressed store, hash-verified

617 return tuple(outs)
618
619 def train(self, mode=True):
620 """Convert the model into training mode while keep normalization layer
621 freezed."""
622 super(ResNet, self).train(mode)
623 self._freeze_stages()
624 if mode and self.norm_eval:
625 for m in self.modules():
626 # trick: eval have effect on BatchNorm only
627 if isinstance(m, _BatchNorm):
628 m.eval()
629
630
631class ResNetV1d(ResNet):

Callers 1

train_one_epochFunction · 0.45

Calls 1

_freeze_stagesMethod · 0.95

Tested by

no test coverage detected