(self, obj)
| 378 | raise TypeError(f"can only store tensors early, not {type(tensor)}") |
| 379 | |
| 380 | def save(self, obj): |
| 381 | if self.has_saved: |
| 382 | raise RuntimeError("have already saved") |
| 383 | # Write the pickle data for `obj` |
| 384 | data_buf = BytesIO() |
| 385 | pickler = IncrementalPyTorchPickler(self, data_buf, protocol=5) |
| 386 | pickler.dump(obj) |
| 387 | data_value = data_buf.getvalue() |
| 388 | self.zipfile.write_record("data.pkl", data_value, len(data_value)) |
| 389 | self.has_saved = True |
| 390 | |
| 391 | def _write_storage_and_return_key(self, storage): |
| 392 | if self.has_saved: |
nothing calls this directly
no test coverage detected