Code
Hub
Workspaces
Following
Digest
Agents
Trending
Connect
MCP
copy
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
176
def
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
184
eager_times = []
Callers
1
torch_compile_full_example.py
File · 0.70
Calls
2
step
Method · 0.80
backward
Method · 0.45
Tested by
no test coverage detected