mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 05:34:18 +08:00
Revert "Add torch.serialization.skip_data context manager (#134504)"
This reverts commit 94db935749b8de99d8c3ab23fb880c67c8f3e67a. Reverted https://github.com/pytorch/pytorch/pull/134504 on behalf of https://github.com/kit1980 due to See D62082697 ([comment](https://github.com/pytorch/pytorch/pull/134504#issuecomment-2327542276))
This commit is contained in:
@ -3,6 +3,7 @@ import copyreg
|
||||
import functools
|
||||
import logging
|
||||
import sys
|
||||
import threading
|
||||
import traceback
|
||||
import warnings
|
||||
from collections import defaultdict
|
||||
@ -108,13 +109,16 @@ def _get_async_or_non_blocking(function_name, non_blocking, kwargs):
|
||||
return kwargs["async"]
|
||||
|
||||
|
||||
_thread_local_state = threading.local()
|
||||
|
||||
|
||||
def _get_restore_location(device):
|
||||
"""Return the map_location location.
|
||||
|
||||
Used for rebuild functions where the tensor device is distinct from the storage
|
||||
"""
|
||||
|
||||
map_location = torch.serialization._serialization_tls.map_location
|
||||
map_location = getattr(_thread_local_state, "map_location", None)
|
||||
if map_location is None:
|
||||
return device
|
||||
else:
|
||||
|
Reference in New Issue
Block a user