MCPcopy Create free account
hub / github.com/pytorch/examples / _run_batch

Method _run_batch

distributed/ddp-tutorial-series/multinode.py:47–52  ·  view source on GitHub ↗
(self, source, targets)

Source from the content-addressed store, hash-verified

45 print(f"Resuming training from snapshot at Epoch {self.epochs_run}")
46
47 def _run_batch(self, source, targets):
48 self.optimizer.zero_grad()
49 output = self.model(source)
50 loss = F.cross_entropy(output, targets)
51 loss.backward()
52 self.optimizer.step()
53
54 def _run_epoch(self, epoch):
55 b_sz = len(next(iter(self.train_data))[0])

Callers 1

_run_epochMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected