(self, inputs, targets)
| 16 | self.cross_entropy_loss = torch.nn.CrossEntropyLoss() |
| 17 | |
| 18 | def forward(self, inputs, targets): |
| 19 | losses = [] |
| 20 | for x, y in zip(inputs, targets): |
| 21 | hidden_dim = self.linear(x) |
| 22 | loss = self.cross_entropy_loss(hidden_dim, y) |
| 23 | losses.append(loss) |
| 24 | return tuple(losses) |
| 25 | |
| 26 | |
| 27 | def multi_output_dataloader(model, total_samples, hidden_dim, device, inputs, targets): |