From 2d803ef8b376ba9ad94070c96b63668c2e27abe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B0=E9=87=8E?= Date: Tue, 8 Oct 2024 19:28:17 +0800 Subject: [PATCH] fix dfx --- torch_npu/meta/_meta_registrations.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/torch_npu/meta/_meta_registrations.py b/torch_npu/meta/_meta_registrations.py index 8f8caac40a..1488db4f3d 100644 --- a/torch_npu/meta/_meta_registrations.py +++ b/torch_npu/meta/_meta_registrations.py @@ -635,9 +635,11 @@ def npu_group_quant_meta(x, scale, group_index, *, offset=None, dst_dtype=None): return torch.empty_like(x, dtype=torch.int8) elif dst_dtype == torch.quint4x2: dim_num = x.dim() + if dim_num == 0: + raise RuntimeError("Input x can't be scalar" + ops_error(ErrCode.PARAM)) if x.size(dim_num - 1) % 8: - raise RuntimeError("If dst_dtype is quint4x2, last dim must be divisible by 8" + - ops_error(ErrCode.NOT_SUPPORT)) + raise RuntimeError("If dst_dtype is quint4x2, x last dim must be divisible by 8" + + ops_error(ErrCode.PARAM)) output_shape = [] for dim in range(dim_num - 1): output_shape.append(x.size(dim)) -- Gitee