MCPcopy Create free account
hub / github.com/pytorch/pytorch / test_save_file

Method test_save_file

test/export/test_serialize.py:593–606  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

591 self.assertTrue(torch.allclose(ep(*inp), loaded_ep(*inp)))
592
593 def test_save_file(self):
594
595 def f(x):
596 return x * x
597
598 inp = (torch.randn(2, 2),)
599 ep = export(f, inp)
600
601 with tempfile.NamedTemporaryFile() as f:
602 save(ep, f)
603 f.seek(0)
604 loaded_ep = load(f)
605
606 self.assertTrue(torch.allclose(ep(*inp), loaded_ep(*inp)))
607
608 def test_save_path(self):
609 def f(x, y):

Callers

nothing calls this directly

Calls 5

exportFunction · 0.90
saveFunction · 0.90
loadFunction · 0.90
seekMethod · 0.80
randnMethod · 0.45

Tested by

no test coverage detected