mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Fix tensor.__deepcopy__ for lazy device (#73197)
Summary: A small bug that misses `lazy` in tensor.__deepcopy__, which results in segmentation when deepcopy a lazy model. Pull Request resolved: https://github.com/pytorch/pytorch/pull/73197 Reviewed By: jbschlosser Differential Revision: D34394482 Pulled By: wconstab fbshipit-source-id: c84fdb9b3a827677971fd3477a92679d7dbce3c0
This commit is contained in:
parent
d81a133b0d
commit
c003d150ce
|
|
@ -92,7 +92,7 @@ class Tensor(torch._C._TensorBase):
|
||||||
# does accurate alias tracking; however, the code below
|
# does accurate alias tracking; however, the code below
|
||||||
# doesn't work because of
|
# doesn't work because of
|
||||||
# https://github.com/pytorch/pytorch/issues/47442
|
# https://github.com/pytorch/pytorch/issues/47442
|
||||||
if self.is_sparse or self.device.type in ['xla', 'mlc', 'ort', 'meta', 'hpu']:
|
if self.is_sparse or self.device.type in ['lazy', 'xla', 'mlc', 'ort', 'meta', 'hpu']:
|
||||||
new_tensor = self.clone()
|
new_tensor = self.clone()
|
||||||
else:
|
else:
|
||||||
new_storage = self.storage().__deepcopy__(memo)
|
new_storage = self.storage().__deepcopy__(memo)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user