File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -269,6 +269,13 @@ def __new__(
269269 # new method instruct wrapper tensor from local_tensor and add
270270 # placement spec, it does not do actual distribution
271271 assert spec .tensor_meta is not None , "TensorMeta should not be None!"
272+ extra_dispatch_keys = torch ._C .DispatchKeySet .from_raw_repr (0 )
273+ if torch ._C ._dispatch_keys (local_tensor ).has (torch ._C .DispatchKey .Conjugate ):
274+ extra_dispatch_keys = extra_dispatch_keys .add (
275+ torch ._C .DispatchKey .Conjugate
276+ )
277+ if torch ._C ._dispatch_keys (local_tensor ).has (torch ._C .DispatchKey .Negative ):
278+ extra_dispatch_keys = extra_dispatch_keys .add (torch ._C .DispatchKey .Negative )
272279 r = torch .Tensor ._make_wrapper_subclass (
273280 cls ,
274281 spec .tensor_meta .shape ,
@@ -277,6 +284,7 @@ def __new__(
277284 device = local_tensor .device ,
278285 layout = local_tensor .layout ,
279286 requires_grad = requires_grad ,
287+ _extra_dispatch_keys = extra_dispatch_keys ,
280288 )
281289
282290 r ._spec = spec
You can’t perform that action at this time.
0 commit comments