MCPcopy Create free account
hub / github.com/alinlab/SelfPatch / train

Method train

segmentation/backbones/unet.py:417–425  ·  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

415 return dec_outs
416
417 def train(self, mode=True):
418 """Convert the model into training mode while keep normalization layer
419 freezed."""
420 super(UNet, self).train(mode)
421 if mode and self.norm_eval:
422 for m in self.modules():
423 # trick: eval have effect on BatchNorm only
424 if isinstance(m, _BatchNorm):
425 m.eval()
426
427 def _check_input_divisible(self, x):
428 h, w = x.shape[-2:]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected