Bugfix Support npu:x format for Tensor.npu
This commit is contained in:
@@ -64,6 +64,10 @@ def npu_confusion_transpose(self, perm, shape, transpose_first):
|
||||
|
||||
@torch_device_guard
|
||||
def _npu(self, *args, **kwargs):
|
||||
if args and isinstance(args[0], str) and 'npu' in args[0]:
|
||||
args = tuple([list(args)[0].replace('npu', torch_npu.npu.native_device)])
|
||||
if kwargs and 'npu' in kwargs.get("device", ""):
|
||||
kwargs['device'] = kwargs['device'].replace("npu", torch_npu.npu.native_device)
|
||||
return torch_npu._C.npu(self, *args, **kwargs)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user