MCPcopy
hub / github.com/pytorch/vision / get_export_import_copy

Function get_export_import_copy

test/test_models.py:162–168  ·  view source on GitHub ↗

Save and load a TorchScript model

(m)

Source from the content-addressed store, hash-verified

160 """Check that a nn.Module's results in TorchScript match eager and that it can be exported"""
161
162 def get_export_import_copy(m):
163 """Save and load a TorchScript model"""
164 with TemporaryDirectory() as dir:
165 path = os.path.join(dir, "script.pt")
166 m.save(path)
167 imported = torch.jit.load(path)
168 return imported
169
170 sm = torch.jit.script(nn_module)
171 sm.eval()

Callers 1

_check_jit_scriptableFunction · 0.85

Calls 1

loadMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…