| 23 | |
| 24 | |
| 25 | class 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 | |
| 40 | class DummyTrainer(EpochBasedTrainer): |