已关闭
[Bug-Report|缺陷反馈]: Ascend 950平台npu_format_cast不支持含零维的空Tensor进行ND/NZ转换 #3015
sunduiyang创建于 26 天前关闭于 25 天前
26 天前 添加了label:bug-report
陈思
25 天前 评论:
25 天前 评论:
/assign @sunduiyang


25 天前 将 sunduiyang 设为负责人
25 天前 关闭了 issue
25 天前 添加了label:resolved
/assign @sunduiyang


一、问题描述 (必填)
Ascend 950平台上,
npu_format_cast无法处理shape中包含0的空Tensor,例如:(9, 0)(0, 9)(2, 0, 3)(2, 3, 0)在ND与FRACTAL_NZ之间进行格式转换时,算子会因空Tensor校验或继续执行TransData tiling而失败,无法完成仅涉及Tensor元数据和存储格式的转换。
问题涉及以下合法转换方向:
根因包括:
ValidNzShape不允许空NZ Tensor的storage shape包含0维。Failed to execute tiling。本问题仅涉及Ascend 950 RegBase平台和现有接口支持范围内的输入,不扩展FRACTAL_NZ已有的rank、dtype和源格式约束。
二、环境信息 (可选)
三、重现步骤 (可选)
import torch import torch_npu x = torch.empty((9, 0), dtype=torch.float16, device="npu") x_nz = torch_npu.npu_format_cast(x, 29) x_nd = torch_npu.npu_format_cast(x_nz, 2) torch.npu.synchronize() print(x_nz.shape, torch_npu.get_npu_format(x_nz)) print(x_nd.shape, torch_npu.get_npu_format(x_nd))修复前,ND到NZ或NZ到ND转换无法正常完成。
四、预期结果 (可选)
对于现有接口支持范围内、shape中包含0维的空Tensor:
npu_quant_matmul等下游功能不受影响。💡 备注(选填)
shape=(0,)属于rank 1,仍受FRACTAL_NZ要求rank为2至6的既有约束,不在本问题修复范围内。