diff --git a/torch_npu/meta/_meta_registrations.py b/torch_npu/meta/_meta_registrations.py index 4ef81b68ebcd7b7981fb84ce90a1a3c558f04d9f..c37befc22550b8378d908af8d72f8f5927f89a76 100644 --- a/torch_npu/meta/_meta_registrations.py +++ b/torch_npu/meta/_meta_registrations.py @@ -636,8 +636,10 @@ 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.NOT_SUPPORT)) if x.size(dim_num - 1) % 8: - raise RuntimeError("If dst_dtype is quint4x2, last dim must be divisible by 8" + + raise RuntimeError("If dst_dtype is quint4x2, x last dim must be divisible by 8" + ops_error(ErrCode.NOT_SUPPORT)) output_shape = [] for dim in range(dim_num - 1):