MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / forward

Method forward

tests/unit/multi_output_model.py:18–24  ·  view source on GitHub ↗
(self, inputs, targets)

Source from the content-addressed store, hash-verified

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
27def multi_output_dataloader(model, total_samples, hidden_dim, device, inputs, targets):

Callers

nothing calls this directly

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected