(self)
| 228 | self.assertEqual(torch.load(f), t) |
| 229 | |
| 230 | def test_serialization_gzip(self): |
| 231 | # Test serialization with gzip file |
| 232 | b = self._test_serialization_data() |
| 233 | f1 = tempfile.NamedTemporaryFile(delete=False) |
| 234 | f2 = tempfile.NamedTemporaryFile(delete=False) |
| 235 | torch.save(b, f1) |
| 236 | with open(f1.name, 'rb') as f_in, gzip.open(f2.name, 'wb') as f_out: |
| 237 | shutil.copyfileobj(f_in, f_out) |
| 238 | |
| 239 | with gzip.open(f2.name, 'rb') as f: |
| 240 | c = torch.load(f) |
| 241 | self._test_serialization_assert(b, c) |
| 242 | |
| 243 | @unittest.skipIf( |
| 244 | not TEST_DILL or HAS_DILL_AT_LEAST_0_3_1, |
nothing calls this directly
no test coverage detected