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

Method test_save_path

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

Source from the content-addressed store, hash-verified

606 self.assertTrue(torch.allclose(ep(*inp), loaded_ep(*inp)))
607
608 def test_save_path(self):
609 def f(x, y):
610 return x + y
611
612 inp = (torch.tensor([6]), torch.tensor([7]))
613 ep = export(f, inp)
614
615 with TemporaryFileName() as fname:
616 path = pathlib.Path(fname)
617 save(ep, path)
618 loaded_ep = load(path)
619
620 self.assertTrue(torch.allclose(ep(*inp), loaded_ep(*inp)))
621
622 def test_save_extra(self):
623 inp = (torch.tensor([0.1, 0.1]),)

Callers

nothing calls this directly

Calls 5

exportFunction · 0.90
TemporaryFileNameFunction · 0.90
saveFunction · 0.90
loadFunction · 0.90
tensorMethod · 0.45

Tested by

no test coverage detected