(self)
| 84 | |
| 85 | class SerializationMixin: |
| 86 | def _test_serialization_data(self): |
| 87 | a = [torch.randn(5, 5).float() for i in range(2)] |
| 88 | b = [a[i % 2] for i in range(4)] # 0-3 |
| 89 | b += [a[0].storage()] # 4 |
| 90 | b += [a[0].reshape(-1)[1:4].storage()] # 5 |
| 91 | b += [torch.arange(1, 11).int()] # 6 |
| 92 | t1 = torch.FloatTensor().set_(a[0].reshape(-1)[1:4].clone().storage(), 0, (3,), (1,)) |
| 93 | t2 = torch.FloatTensor().set_(a[0].reshape(-1)[1:4].clone().storage(), 0, (3,), (1,)) |
| 94 | b += [(t1.storage(), t1.storage(), t2.storage())] # 7 |
| 95 | b += [a[0].reshape(-1)[0:2].storage()] # 8 |
| 96 | return b |
| 97 | |
| 98 | def _test_serialization_assert(self, b, c): |
| 99 | self.assertEqual(b, c, atol=0, rtol=0) |
no test coverage detected