(self, tensor, saver, protocol_version=5)
| 294 | |
| 295 | class SavingProxyForTensor: |
| 296 | def __init__(self, tensor, saver, protocol_version=5): |
| 297 | self.protocol_version = protocol_version |
| 298 | self.reduce_ret_fn, (storage, *other_reduce_args) = tensor.__reduce_ex__(protocol_version) |
| 299 | assert isinstance(storage, torch.storage.TypedStorage), "Please check for updates" |
| 300 | storage_proxy = SavingProxyForStorage(storage, saver, protocol_version=protocol_version) |
| 301 | self.reduce_args = (storage_proxy, *other_reduce_args) |
| 302 | |
| 303 | def __reduce_ex__(self, protocol_version): |
| 304 | if protocol_version != self.protocol_version: |
nothing calls this directly
no test coverage detected