MCPcopy Index your code
hub / github.com/pytorch/tutorials / train

Function train

intermediate_source/torch_compile_full_example.py:176–181  ·  view source on GitHub ↗
(mod, data)

Source from the content-addressed store, hash-verified

174
175
176def train(mod, data):
177 opt.zero_grad(True)
178 pred = mod(data[0])
179 loss = torch.nn.CrossEntropyLoss()(pred, data[1])
180 loss.backward()
181 opt.step()
182
183
184eager_times = []

Callers 1

Calls 2

stepMethod · 0.80
backwardMethod · 0.45

Tested by

no test coverage detected