MCPcopy Create free account
hub / github.com/modelscope/modelscope / DummyModel

Class DummyModel

tests/trainers/utils/test_inference.py:25–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class DummyModel(nn.Module, Model):
26
27 def __init__(self):
28 super().__init__()
29 self.linear = nn.Linear(5, 4)
30 self.bn = nn.BatchNorm1d(4)
31
32 def forward(self, feat, labels):
33 x = self.linear(feat)
34
35 x = self.bn(x)
36 loss = torch.sum(x)
37 return dict(logits=x, loss=loss)
38
39
40class DummyTrainer(EpochBasedTrainer):

Callers 1

test_funcFunction · 0.70

Calls

no outgoing calls

Tested by 1

test_funcFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…