MCPcopy Create free account
hub / github.com/apple/ml-pointersect / train

Method train

cdslib/core/models/base_model.py:149–157  ·  view source on GitHub ↗

Set all the nn.modules to train mode.

(self)

Source from the content-addressed store, hash-verified

147 setattr(self, name, b.to(device=device))
148
149 def train(self):
150 """Set all the nn.modules to train mode."""
151 vs = inspect.getmembers(self, lambda v: isinstance(v, BaseModel))
152 for v_name, v in vs:
153 v.train()
154
155 vs = inspect.getmembers(self, lambda v: isinstance(v, torch.nn.Module))
156 for v_name, v in vs:
157 v.train()
158
159 def eval(self):
160 """Set all the nn.modules to evaluation mode."""

Callers 1

_set_train_modeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected