MCPcopy Create free account
hub / github.com/pytorch/tutorials / run_model

Function run_model

recipes_source/debug_mode_tutorial.py:140–147  ·  view source on GitHub ↗
(model, data, *, compile_with=None)

Source from the content-addressed store, hash-verified

138# If any hash is different, then that's where the numerical divergence is coming from.
139
140def run_model(model, data, *, compile_with=None):
141 if compile_with is not None:
142 model = torch.compile(model, backend=compile_with)
143 with DebugMode(record_output=True) as dm, DebugMode.log_tensor_hashes(
144 hash_inputs=True,
145 ):
146 dm_out = model(*data)
147 return dm, dm_out
148
149class Toy(torch.nn.Module):
150 def forward(self, x):

Callers 1

Calls 1

modelFunction · 0.50

Tested by

no test coverage detected