(self, obj)
| 241 | raise TypeError(f'can only store tensors early, not {type(tensor)}') |
| 242 | |
| 243 | def save(self, obj): |
| 244 | if self.has_saved: |
| 245 | raise RuntimeError('have already saved') |
| 246 | # Write the pickle data for `obj` |
| 247 | data_buf = BytesIO() |
| 248 | pickler = IncrementalPyTorchPickler(self, data_buf, protocol=5) |
| 249 | pickler.dump(obj) |
| 250 | data_value = data_buf.getvalue() |
| 251 | self.zipfile.write_record('data.pkl', data_value, len(data_value)) |
| 252 | self.has_saved = True |
| 253 | |
| 254 | def _write_storage_and_return_key(self, storage): |
| 255 | if self.has_saved: |
no test coverage detected