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

Method test_version_error

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

Source from the content-addressed store, hash-verified

637 self.assertEqual(extra_files["extra.txt"], "moo")
638
639 def test_version_error(self):
640 def f(x):
641 return x + x
642
643 ep = export(f, (torch.randn(1, 3),))
644
645 with tempfile.NamedTemporaryFile() as f:
646 save(ep, f)
647 f.seek(0)
648
649 # Modify the version
650 with zipfile.ZipFile(f, 'a') as zipf:
651 zipf.writestr('version', "-1")
652
653 with self.assertRaisesRegex(RuntimeError, r"Serialized version -1 does not match our current"):
654 f.seek(0)
655 load(f)
656
657 def test_save_constants(self):
658 class Foo(torch.nn.Module):

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected