Tools
Tools: torch.abs can not be executed in NPU device
2026-01-22
0 views
admin
Abstract ## Solution The torch.abs command will throw an error when the device is NPU and the parameter is set to compiler.The error message is as follows: We can use torch.sqrt instead of torch.abs, as blow: Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse CODE_BLOCK:
RuntimeError: abs:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:216 NPU function error: call aclnnAbs failed, error code is 161002
[ERROR] 2026-01-08-16:48:46 (PID:18801, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
[PID: 18801] 2026-01-08-16:48:46.230.433 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_COMPLEX64, should be in dtype support list [DT_DOUBLE,DT_FLOAT,DT_FLOAT16,DT_INT64,DT_INT32,DT_INT16,DT_INT8,DT_UINT8,DT_BOOL,DT_BFLOAT16,]. Enter fullscreen mode Exit fullscreen mode CODE_BLOCK:
RuntimeError: abs:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:216 NPU function error: call aclnnAbs failed, error code is 161002
[ERROR] 2026-01-08-16:48:46 (PID:18801, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
[PID: 18801] 2026-01-08-16:48:46.230.433 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_COMPLEX64, should be in dtype support list [DT_DOUBLE,DT_FLOAT,DT_FLOAT16,DT_INT64,DT_INT32,DT_INT16,DT_INT8,DT_UINT8,DT_BOOL,DT_BFLOAT16,]. CODE_BLOCK:
RuntimeError: abs:build/CMakeFiles/torch_npu.dir/compiler_depend.ts:216 NPU function error: call aclnnAbs failed, error code is 161002
[ERROR] 2026-01-08-16:48:46 (PID:18801, Device:0, RankID:-1) ERR00100 PTA call acl api failed.
[PID: 18801] 2026-01-08-16:48:46.230.433 AclNN_Parameter_Error(EZ1001): Tensor self not implemented for DT_COMPLEX64, should be in dtype support list [DT_DOUBLE,DT_FLOAT,DT_FLOAT16,DT_INT64,DT_INT32,DT_INT16,DT_INT8,DT_UINT8,DT_BOOL,DT_BFLOAT16,]. COMMAND_BLOCK:
# abs_val = torch.abs(z)
abs_val = torch.sqrt(z.real**2 + z.imag**2) Enter fullscreen mode Exit fullscreen mode COMMAND_BLOCK:
# abs_val = torch.abs(z)
abs_val = torch.sqrt(z.real**2 + z.imag**2) COMMAND_BLOCK:
# abs_val = torch.abs(z)
abs_val = torch.sqrt(z.real**2 + z.imag**2)
how-totutorialguidedev.toai