add judge in npu ops (#3266)

* add judge in npu ops

* fix lint

* fix lint 1

* fix if_else
pull/3174/merge
Wang Yixuan 2025-04-08 15:13:06 +08:00 committed by GitHub
parent ebad94a329
commit f19d3e771c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -258,7 +258,8 @@ def fused_bias_leakyrelu(input: torch.Tensor,
torch.Tensor: Feature map after non-linear activation.
"""
if (not input.is_cuda) and (not input.is_musa):
if (not input.is_cuda) and (not input.is_musa) and \
input.device.type != 'npu':
return bias_leakyrelu_ref(input, bias, negative_slope, scale)
return FusedBiasLeakyReLUFunction.apply(input, bias.to(input.dtype),