Merged
docs: mark torch.ShortStorage as supported on Ascend 950DT #46018
docs: mark torch.ShortStorage as supported on Ascend 950DT #46018
Merged
zhangjiahao-2026Add on Sep 8
zhangjiahao-2026

【合入来源】

关联任务issue: https://gitcode.com/Ascend/pytorch/issues/3861

【修改方案】

在 master 资料中更新公开非计算类 API torch.ShortStorage 的 Ascend 950DT 支持情况。

修改文件:

  • docs/zh/api/native_api/pytorch_2-7-1/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-9-0/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-10-0/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-11-0/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-12-0/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-13-0/torch-Storage.md
  • docs/zh/api/native_api/pytorch_2-14-0/torch-Storage.md

具体修改内容:

  1. 在 PyTorch 2.7.1、2.9.0、2.10.0、2.11.0、2.12.0、2.13.0 和 2.14.0 资料中,将 torch.ShortStorage 在 Ascend 950DT 系列产品上的支持状态由“不支持”修改为“支持”。
  2. Atlas A2 训练系列产品、Atlas A3 训练系列产品保持「支持」不变;
  3. 该 API 为非计算类接口,与具体数据类型无关,不填写数据类型限制;
  4. 不新增 A5 / 950PR 产品字段,资料产品维度仍为 A2 / A3 / 950DT;

本 PR 仅修改目标 API 的 950DT 支持标记,不批量修改同一文件中其他历史 API 的资料内容。

【资料变更】

资料检查结果:master 下的原生 API 资料已收录 torch.ShortStorage,Atlas A2、Atlas A3 标记为支持,Ascend 950DT 原标记为不支持。

本次已补充 A5(Ascend950PR)实机验证并通过,因此将以下版本目录 torch-Storage.md 中 torch.ShortStorage 的 Ascend 950DT 更新为支持:

  • PyTorch 2.7.1
  • PyTorch 2.9.0
  • PyTorch 2.10.0
  • PyTorch 2.11.0
  • PyTorch 2.12.0
  • PyTorch 2.13.0
  • PyTorch 2.14.0

该 API 为公开非计算类接口,与张量数据类型无关,不填写数据类型限制。

【接口变更】

不涉及

【功能验证】

torch.ShortStorage 是 PyTorch Legacy TypedStorage 类型之一,用于保存 16 位有符号整数数据,元素类型对应 torch.int16。

PyTorch 官方社区在以下用例中已有相关验证:

test/test_torch.py::test_storage_setitem
test/test_torch.py::test_tensor_storage_type
test/test_torch.py::test_element_size
test/test_torch.py::test_from_buffer
test/test_torch.py::test_storage_error
test/test_torch.py::test_storage_casts

torch.ShortStorage 对应的 NPU Storage 类型为 torch_npu.npu.ShortStorage。现有 test/test_torch.py 已完成 NPU Storage 类型映射适配,不需要修改 Torch-NPU 功能实现,也不需要新增测试文件或 test_upstream patch。

API 功能、社区用例情况、NPU 适配分析和各版本验证结果见说明 Issue:

https://gitcode.com/Ascend/pytorch/issues/3861

A5 硬件验证信息如下。

验证设备:

QQ20260831-105536.png

验证环境:

python: 3.10.12
torch: 2.12.0+cpu
torch_npu: 2.12.0
npu_available: True
device: Ascend950PR_9579

验证命令:

python3 /tmp/test_shortstorage_3861_a5.py

验证场景:

  1. 无参数创建及 element_size
  2. 按元素数量、数据序列创建
  3. CPU / NPU 元素及切片赋值
  4. from_buffer
  5. Storage 类型转换
  6. NPU int16 Tensor 映射为 torch_npu.npu.ShortStorage
  7. torch.ShortStorage(wrap_storage=npu_storage) 抛出 must be cpu
  8. torch_npu.npu.ShortStorage(wrap_storage=cpu_storage) 抛出 must be npu

运行截图:

QQ20260908-221519.png

验证结论:

torch.ShortStorage 在上述 A5(Ascend950PR)环境中上述场景均验证通过。TypedStorage deprecation warning 属于 PyTorch 上游预期告警,不影响结论。

【CheckList】

PR提交人对以下CheckList自检项进行全量自检,自检通过或不涉及,均修改 [ ] 为 [x]

likedislike
Pull Request has been successfully merged by ascend-robot.
(Thank you for zhangjiahao-2026's contribution.)
zhangjiahao-2026zhangjiahao-2026
Sep 8 Created pull request, commit e38c359f
zhangjiahao-2026zhangjiahao-2026
Sep 8 Associated issue: 【API一致性任务】torch.ShortStorage 社区已有完整用例,现有 NPU 适配已覆盖,【API一致性任务】torch.ShortStorage.dtype 社区已有用例且无需额外 NPU 适配
atomgit-bot
atomgit-bot
Sep 8 Comments:

变更摘要

该 PR 为纯资料(docs)更新,将公开非计算类 API torch.ShortStorage 在 Ascend 950DT 上的支持状态由「不支持」改为「支持」。由于该 API 已在 A5(Ascend950PR)实机验证通过,本次将 torch-Storage.md 文档中 torch.ShortStorage 的 Ascend 950DT 标记同步更新,涉及 PyTorch 2.7.1、2.11.0、2.12.0、2.13.0 四个版本目录,每处仅修改该 API 的 950DT 支持标记一行,不涉及接口或功能代码变更。

主要改动

  • 更新 torch.ShortStorage 的 950DT 支持标记: 在 docs/zh/api/native_api/pytorch_2-7-1/torch-Storage.md、pytorch_2-11-0/torch-Storage.md、pytorch_2-12-0/torch-Storage.md、pytorch_2-13-0/torch-Storage.md 四个文件中,将 torch.ShortStorage 的 Ascend 950DT 由「不支持」改为「支持」,每个文件各一行改动
  • 保持其他产品维度标记不变: Atlas A2、Atlas A3 训练系列产品对 torch.ShortStorage 的支持状态维持「支持」不变,不新增 A5 / 950PR 产品字段
  • 不填写数据类型限制: 该 API 为非计算类接口,与张量数据类型无关,故不添加数据类型限制说明
  • 不涉及接口变更: 本 PR 不修改 torch.ShortStorage.dtype 的 950DT 标记(对应 issue #3869),仅针对 torch.ShortStorage 本体条目
likedislike
Incorrect?
atomgit-bot
atomgit-bot
Sep 8 Comments:

🤖 本次改动均为数据 / 生成 / 二进制文件(如测试用例、锁文件、媒体资源),没有可审查的代码逻辑,已跳过 AI 代码审查。

likedislike
Incorrect?
ascend-robotascend-robotCollaborators
Sep 8 Added label: ascend-cla/yes
99 messages are collapsed here。 See more
AtlasAccountAtlasAccountCollaborators
Oct 10 Removed label: ci-pipeline-running
AtlasAccountAtlasAccountCollaborators
Oct 10 Added label: ci-pipeline-passed
AtlasAccount
AtlasAccountCollaborators
Oct 10 Comments:
流水线 PR-pipeline_pytorch#71960 [ commitID:5ef80477 ] 已完成
>>>代码风格自动修复执行成功(无修复内容)
阶段 任务名 状态 详情
编译构建 Build_X86 ⚪ IGNORED >>>
Build_ARM ⚪ IGNORED >>>
Build_X86_torchair ⚪ IGNORED >>>
Build_ARM_torchair ⚪ IGNORED >>>
patch_test ⚪ IGNORED >>>
Build_X86_213 ⚪ IGNORED >>>
Build_ARM_213 ⚪ IGNORED >>>
恶意代码检查 Antipoison ✅ COMPLETED >>>
编码安全与规范检查 check_error ✅ COMPLETED >>>
lintrunner ✅ COMPLETED >>>
开源片段检查 SCA ✅ COMPLETED >>>
开发者测试 UT_ARM_A2_Part_01 ⚪ IGNORED >>>
UT_ARM_A2_Part_02 ⚪ IGNORED >>>
UT_ARM_A2_Part_03 ⚪ IGNORED >>>
UT_inductor_Part_01 ⚪ IGNORED >>>
UT_inductor_Part_02 ⚪ IGNORED >>>
UT_inductor_Part_03 ⚪ IGNORED >>>
UT_inductor_Part_04 ⚪ IGNORED >>>
UT_DIST_ARM_Part_01 ⚪ IGNORED >>>
UT_DIST_ARM_Part_02 ⚪ IGNORED >>>
UT_DIST_ARM_Part_03 ⚪ IGNORED >>>
UT_DIST_ARM_Part_04 ⚪ IGNORED >>>
UT_ARM_A2_Select_Part_01 ⚪ IGNORED >>>
UT_ARM_A2_Select_Part_02 ⚪ IGNORED >>>
UT_inductor_Part1_213 ⚪ IGNORED >>>
流水线 PR-pipeline_pytorch ✅ COMPLETED >>>
此流水线已支持下列评论快捷指令,仅PR创建者和白名单成员[wujinyuan1, huangjingwei, liangsongwei, yashi999, culechan, Dring, wuyouqi1, L1919_snow, qq_52711437, WhiteNight12, nomiz, xiu_21, ffmh, wanglijun55, hss-shuai, husichao, smallsilly, lanshaozuishuai, jimmyisme1, lzy0920232, alpha-junh, Sunshine_Youngster, wei_zhuoyi, zhangyihuiben, zyw-hw, zzzkeke, rmch, yangch0324, LucciC, AACAES, renyujin, wjlflyer, senzhen-town, pengjingyou, qsc97, limuan, yule100, xiaoqi-zhou, kuhn7, chenxingying, hanye02, zichun_ye, anyrenwei, kkjocker, wangzili121, Lu_G, yvjc, puddingfjz, HandsoemLemon, bigprestigee1, huawuyi, zhenyu10, dairenjie, du-jin-hang, zou-jieyu, adelaideliu, TrHan, wanlinan, Windwindzzz, pengqihw, kisnwang, yuheng_wang, honghao_wang, jizewei, zhangguoguang, sunyu-xuan, chenrayray, hbhu_bin, liujunzhu, c_34, LiNuoh, maoyuanpeng1, zzhongmin, zhaoyu65, bellatan, jiabaolin, zhuofanshen, wencaiwen, lu_zhuge, caoshuyang, molly12, lyx324521, LQ1206, gitcode-chenjiao, cai-weiwei1989, CHDong, ogqin, yuanlipingGit, xuqinglin1, lqz2, zouwei1, chaoluoa, paradox325, jackzhang1116, yaoyao, akh, yujiacheng, dengjie0116, Hubert11111, Shine_Ws, wslhj555, longqiand, OYtao666, JiaqingQiang, luyyyy, Kingbelial, zhanghaiyu0101, wenxp1018, yanliu-luoluo, ksun_sekiro, liyong328, wgzheng, tangky, vivi_is_coding, aoiaoisola, weixin_44494597, wangmengmengwang65667, hid57809721, qq_35468730, comeonup, C547032, gcw_m5OQChA4, yao_yao_ling_xian, cnnbwcy, szqfes_12, cora_19, cann_lilin, can, shawnylee233, fanglanyue0916, hhz0, LiNuohang, taohuoquan, Jesse, WSs_321, SCh_zx, lvjiangdong, TonyYA, shi-yufeng99, qiaoyaodan, stonexxx, jimmycao9929, zzll, qindong0, luqichao, xinyuzhuo, liujm2001, dezheng889, zhucehw, HinPeng, rain-666, lsy_0111, a_knight, glf2016, SoraAzzz]评论有效
  • compile、compile_inductor、compile_torchair : 运行流水线
  • retry : 重试流水线所有失败子任务
  • retry <任务名> : 仅重试指定失败子任务
  • stop : 停止流水线
likedislike
ascend-robotascend-robotCollaborators
Oct 10 Merged pull request
AtlasAccount
AtlasAccountCollaborators
Oct 10 Comments:
流水线 pytorch_gitcode_PR_multiVersion-onetrack#306 [ commitID:5ef80477 ] 已完成
likedislike