Compare commits

..
246 Commits
Author SHA1 Message Date
weili10 2c0d282932 update README.en.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-09-05 02:56:35 +00:00
weili10 ac3a639583 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-09-05 02:49:22 +00:00
weili10 f7f2da79ec add usleep time to reduce the cpu usage
增加usleep时间,避免间隔太短导致循环频率过高占用cpu资源

Signed-off-by: weili10 <liwei386@huawei.com>
2022-09-01 15:52:21 +00:00
weili10 c60bbfba75 !1096 网络模型移植与训练指南修改
Merge pull request !1096 from 彭子荣/2.0.4.tr5
2022-08-05 08:49:12 +00:00
pengzirong 9477572064 更新跳转链接 2022-07-27 15:43:13 +08:00
weili10 473748343b !1039 网络模型移植与训练指南修改
Merge pull request !1039 from 彭子荣/2.0.4.tr5
2022-07-11 08:34:34 +00:00
pengzirong 228bec4413 网络模型移植与训练指南新增硬件支持说明 2022-07-11 14:53:57 +08:00
weili10 3377df86c6 !906 安装指南资料修改
Merge pull request !906 from 彭子荣/2.0.4.tr5
2022-06-15 07:23:56 +00:00
pengzirong fff7b1265c 修改下载昇腾适配的apex源码命令 2022-06-14 17:23:30 +08:00
weili10 27c077b266 update README.en.md. 2022-04-01 13:41:06 +00:00
weili10 fa53e4a2f2 update docs/zh/PyTorch安装指南/PyTorch安装指南.md. 2022-04-01 13:35:32 +00:00
weili10 2ae7e6f6a8 update docs/en/PyTorch Installation Guide/PyTorch Installation Guide.md. 2022-04-01 13:34:05 +00:00
weili10 dc9be59e5e update README.zh.md. 2022-04-01 13:19:23 +00:00
i-robot 35f57d00dd !483 Pytorch 安装指南 资料更新
Merge pull request !483 from 彭子荣/2.0.4.tr5
2022-03-22 11:31:55 +00:00
pengzirong 214f6f98e9 新增版本配套说明列表
update

update
2022-03-22 10:06:32 +08:00
i-robot 7c29f6fb57 !405 2.0.4.tr5资料合入3.7
Merge pull request !405 from 彭子荣/2.0.4.tr5
2022-03-08 02:15:33 +00:00
pengzirong d1d3cd7ffd update url of pytorch安装指南
删除文件 docs/en/RELEASENOTE/RELEASENOTE.md

Updated this file

update docs/en/RELEASENOTE/FrameworkPTAdapter 2.0.4 Release Notes.md.

修复拼写错误,增加路径说明

修复英文资料的路径和拼写错误

update OWNERS.

修改Dynamic选项描述

a=>A (with Autocast)
2022-03-07 16:47:36 +08:00
i-robot 7456ef2606 !371 2.0.4.tr5资料合入
Merge pull request !371 from 彭子荣/2.0.4.tr5
2022-03-05 03:23:24 +00:00
pengzirong 4a3f61f367 update AMP TOOLS user guide
update AMP tools user guide

update amp tools user  guide
2022-03-04 17:18:40 +08:00
pengzirong 9375223d4e update env var contents of PTCOPY_ENABLE
delete env var contents of PTCOPY_ENABLE
2022-03-03 11:56:18 +08:00
weili10 e5ece794f3 update OWNERS. 2022-03-02 09:22:12 +00:00
pengzirong 1eb74061f4 update 同master内容 更新AMP tools描述、图片等以及Pytroch安装指南URL链接等 2022-03-02 16:01:10 +08:00
i-robot 2b4e64ac77 !172 bugfix:修复英文资料的路径和拼写错误
Merge pull request !172 from shibo/2.0.4
2022-01-29 09:29:35 +00:00
shibo 4b771736c1 修复英文资料的路径和拼写错误 2022-01-29 16:49:57 +08:00
i-robot dc8ba1c8ac !167 bugfix: 修复资料中拼写错误
Merge pull request !167 from shibo/2.0.4
2022-01-29 08:37:35 +00:00
shibo abe5f8f9bb 修复拼写错误,增加路径说明 2022-01-29 15:24:36 +08:00
i-robot 8c08296e01 !113 资料合入2.0.4.tr5
Merge pull request !113 from 彭子荣/2.0.4.tr5
2022-01-25 12:32:39 +00:00
pengzirong b4366203ff Merge branch '2.0.4.tr5' of gitee.com:peng-zirong/pytorch into 2.0.4.tr5 2022-01-25 11:53:45 +08:00
pengzirong 8c4b448688 delete 2022-01-25 11:53:28 +08:00
i-robot cc6c0ae868 !107 Updated FrameworkPTAdapter 2.0.4 Release Notes
Merge pull request !107 from yanhuiling/2.0.4.tr5
2022-01-22 02:46:05 +00:00
yanhuiling 6dc0c90fe5 update docs/en/RELEASENOTE/FrameworkPTAdapter 2.0.4 Release Notes.md. 2022-01-21 02:37:40 +00:00
yanhuiling 85feca7020 Updated this file 2022-01-21 02:28:25 +00:00
yanhuiling f70fa2b749 删除文件 docs/en/RELEASENOTE/RELEASENOTE.md 2022-01-21 02:28:13 +00:00
i-robot 3d86101802 !104 2.0.4.tr5资料合入1.18
Merge pull request !104 from 彭子荣/2.0.4.tr5
2022-01-20 11:10:54 +00:00
彭子荣 58467c11f4 update docs/zh/RELEASENOTE/RELEASENOTE.md. 2022-01-19 02:13:14 +00:00
pengzirong 786492939f update 2022-01-18 17:33:47 +08:00
i-robot 43fa745e6a !102 【轻量级 PR】:update docs/en/PyTorch Online Inference Guide/PyTorch Online Inference Guide.md.
Merge pull request !102 from 阿里斯开扇/N/A
2022-01-17 07:17:32 +00:00
i-robot 94822276f9 !100 Updated English documents in Pytorch docs
Merge pull request !100 from yanhuiling/2.0.4.tr5
2022-01-17 07:15:32 +00:00
i-robot 9769e7e8f1 !99 【轻量级 PR】:Updated this file
Merge pull request !99 from yanhuiling/N/A
2022-01-17 07:13:34 +00:00
i-robot 88b3d30fdb !101 【轻量级 PR】:update docs/en/PyTorch Installation Guide/PyTorch Installation Guide.md.
Merge pull request !101 from 阿里斯开扇/N/A
2022-01-17 07:11:36 +00:00
weili10 0522dfd0a3 update README.en.md. 2022-01-17 02:57:43 +00:00
weili10 7dc462c156 update README.zh.md. 2022-01-17 02:56:33 +00:00
阿里斯开扇 e9bab3c85a update docs/en/PyTorch Online Inference Guide/PyTorch Online Inference Guide.md.
少量优化
2022-01-14 08:52:51 +00:00
阿里斯开扇 1437a9b04a update docs/en/PyTorch Installation Guide/PyTorch Installation Guide.md.
少量优化
2022-01-14 08:19:58 +00:00
AtlasAccount 7f4a31ec43 同步1.5.0 7614ae40805813a2f0a39095650321aa8713d993
!3047 模型需求  var  算子适配
    Merge pull request !3047 from 沈鹏程/var
--
    !3046 rotatediou 适配 在原基础上增加两个attr属性
    Merge pull request !3046 from 沈鹏程/iou
同步1.8.1 d2872362b8f237f7585c049867da12df006371fd
2022-01-14 14:13:08 +08:00
AtlasAccount 5c0980ac29 同步1.5.0 8c06ebce6757ac527de4dcf4b7172a8cdeb86ab4
!3042 codecheck 问题修改
    Merge pull request !3042 from shibo/code_check
同步1.8.1 74798a86310dbeea6f2465943d62b08ff7242a13
2022-01-14 11:37:26 +08:00
yanhuiling 6942288239 Updated this file 2022-01-13 10:56:44 +00:00
yanhuiling 72c74dbc9c 删除文件 docs/en/PyTorch Operator Support/PyTorch Operator Support.md 2022-01-13 10:56:23 +00:00
yanhuiling 1fdff7016b Updated this file 2022-01-13 10:56:05 +00:00
yanhuiling efa1ba2d70 删除文件 docs/en/PyTorch Network Model Porting and Training Guide/PyTorch Network Model Porting and Training Guide.md 2022-01-13 10:55:50 +00:00
yanhuiling ffbec8a589 Updated this file 2022-01-13 10:55:06 +00:00
yanhuiling df9b0d6a87 删除文件 docs/en/ONNX Operator List/ONNX Operator List.md 2022-01-13 10:54:31 +00:00
yanhuiling a557e2a19d Added three files. 2022-01-13 10:54:05 +00:00
yanhuiling 052e47c1b4 Updated this file
根据master修订
2022-01-13 09:45:31 +00:00
AtlasAccount dde486cd52 同步1.5.0 82d1b7eb2a08bce7977fcf53cdf6f4f570b7e6a9
!3034 修复codedex问题
    Merge pull request !3034 from shibo/fix_codedex
同步1.8.1 6f560c7ba1aa7d5d208f4dec8be850a9fc07372b
2022-01-13 17:04:28 +08:00
i-robot a6616a290f !98 资料合入
Merge pull request !98 from 彭子荣/2.0.4.tr5
2022-01-13 08:34:36 +00:00
pengzirong 5c595d8685 translation && delete 2022-01-13 09:56:43 +08:00
AtlasAccount efcf99e484 同步1.5.0 4c3c68a23aecc4c203047f812206f8afe06923b7
!3022 E2E prof: 增加RTS数据
    Merge pull request !3022 from shibo/2.0.4.tr5
同步1.8.1 3c29f9d7c7f324bb3c3723843cfbd83236cac64b
2022-01-12 16:48:16 +08:00
AtlasAccount 125ddd0a6b 同步1.5.0 d8b7a3fc8e2d06b2c2a3c205623accd19d2890c1
同步1.8.1 3c29f9d7c7f324bb3c3723843cfbd83236cac64b
    !2969 【1.8.1算子适配】 asin 算子适配
    Merge pull request !2969 from 沈鹏程/1.8_asin
--
    !3011 BinaryCrossEntropyWithLogitsKernelNpu 算子适配
    Merge pull request !3011 from 沈鹏程/1.8_BinaryCrossEntropyWithLogitsKernelNpu
--
    !3012 upsample_nearest2d_backward.grad_input修改
    Merge pull request !3012 from hxf12345677/upsample_nearest2d_backward
2022-01-12 15:54:08 +08:00
AtlasAccount 59f8b3bf0c 同步1.5.0 d8b7a3fc8e2d06b2c2a3c205623accd19d2890c1
!3014 codedex问题解决
    Merge pull request !3014 from shibo/2.0.4.tr5
同步1.8.1 f7eabde23ca8f477a2fc3632b99d17f20b498808
    !2678 add: grid_sampler for 1.8.1
    Merge pull request !2678 from 郭夏/grid_sampler
--
    !2718 【1.8.1适配“MaxUnpool2d”】
    Merge pull request !2718 from 李攀/do_1.8.1
--
    !2988 添加UT:dataloader模块
    Merge pull request !2988 from shibo/add_data_181
--
    !3006 BinaryCrossEntropy算子适配
    Merge pull request !3006 from 沈鹏程/1.8_Bce
--
    !2970 argsort算子适配
    Merge pull request !2970 from 沈鹏程/1.8_argsort
--
    !2985 Argmax算子适配
    Merge pull request !2985 from 沈鹏程/1.8_argmax
--
    !2994 atan算子适配
    Merge pull request !2994 from 沈鹏程/1.8_atan
--
    !2990 atan2算子适配
    Merge pull request !2990 from 沈鹏程/1.8_atan2
--
    !3005 clamp算子适配
    Merge pull request !3005 from 沈鹏程/1.8_clamp
--
    !2977 单元测试引用文件结构
    Merge pull request !2977 from 龚俊强/pytorch1.8.1
2022-01-11 18:37:12 +08:00
AtlasAccount 5d67132cc7 同步1.5.0 9f61e79760acdac5b3cb2cc6731ad55bd247d23a
!3003 回退stream合一代码
    Merge pull request !3003 from wangyu/2.0.4.tr5
同步1.8.1 8937dfc7728adc20d3e5a8f8e6907a37361dd7d0
2022-01-07 12:08:59 +08:00
i-robot 684ce480c9 !94 资料合入tr5
Merge pull request !94 from 彭子荣/2.0.4.tr5
2022-01-07 04:00:40 +00:00
pengzirong 91e80eda14 fix error 2022-01-07 11:32:47 +08:00
pengzirong dc29d26649 delete 2022-01-07 09:45:04 +08:00
pengzirong 2728919061 new file 2022-01-07 09:19:56 +08:00
pengzirong 1f2c7f2a56 delete 2022-01-07 09:19:39 +08:00
AtlasAccount 1502202c48 同步1.5.0 b40f945354c47e52c264551417f2788cae3f1f82
!2998 【功能修复】解决因为memset导致的内存泄漏问题
    Merge pull request !2998 from 蒋荣强/leak
同步1.8.1 8937dfc7728adc20d3e5a8f8e6907a37361dd7d0
2022-01-06 20:09:16 +08:00
i-robot d460e9c9fe !89 资料合入tr5
Merge pull request !89 from 彭子荣/2.0.4.tr5
2022-01-06 11:58:36 +00:00
pengzirong 14b0ede838 delete 2022-01-06 18:00:46 +08:00
pengzirong 2c3648ea1c new files 2022-01-06 17:59:15 +08:00
pengzirong e73fb12b3d delete all 2022-01-06 17:58:33 +08:00
AtlasAccount d5d67725ef 同步1.5.0 6e09c3b02792b8cd53c6ea899bc50ec6ac89745e
!2983 【bugfix】torch1.5不支持python3.9.不再提供编包支持
    Merge pull request !2983 from 李超/2.0.4.tr5
--
    !2972 【泛化】适配层兜底,泛化BatchNormGatherStatsWithCounts算子精度
    Merge pull request !2972 from wuxiankun/2.4.tr5bngswic
--
    !2965 bugfix 处理 由于输出shape为空,导致模型报错问题
    Merge pull request !2965 from 沈鹏程/bug_fix2
同步1.8.1 8937dfc7728adc20d3e5a8f8e6907a37361dd7d0
    !2968 argmin算子适配
    Merge pull request !2968 from 沈鹏程/1.8_Argmin
--
    !2976 【支持3.9】pytorch1.8.1支持python3.9环境编包
    Merge pull request !2976 from 李超/pytorch1.8.1
2022-01-05 19:01:51 +08:00
AtlasAccount efec73cde6 同步1.5.0 f6b363e68975183a24062e6c659637abb946b890
同步1.8.1 b59213c0dad6f3384b4556683c023011f8fe1417
2021-12-30 22:12:27 +08:00
AtlasAccount ca7a8c04af 同步1.5.0 4e51ca02f5edc199f842b231d148e27db808fb12
!2957 bugfix 处理 由于输出为空shape,导致模型报错问题
    Merge pull request !2957 from 沈鹏程/bug_fix1
--
    !2954 【Bugfix】SyncBNTrainingUpdate 支持5hd操作
    Merge pull request !2954 from wuxiankun/204tr204tr5synbcwit
同步1.8.1 b59213c0dad6f3384b4556683c023011f8fe1417
2021-12-30 19:12:48 +08:00
AtlasAccount a68aab10ab 同步1.5.0 7645e605afd15fdd72d2b6ea0526474a29d5b0f1
!2950 修复bug,图模式set option之前先check option长度
    Merge pull request !2950 from wangyu/2.0.4.tr5
--
    !2932 modify:logical_and适配支持更多dtype类型输入
    Merge pull request !2932 from 郭夏/logical_and
--
    !2929 SyncBatchNorm: 修改命名、修复codecheck
    Merge pull request !2929 from 袁舰/master
--
    !2880 modify: upsample_trilinear3d正反向支持FP16输入
    Merge pull request !2880 from 郭夏/upsample_trilinear3d
同步1.8.1 b59213c0dad6f3384b4556683c023011f8fe1417
    !2910 All算子适配
    Merge pull request !2910 from 沈鹏程/1.8_all
2021-12-30 17:31:49 +08:00
AtlasAccount ec8cc698f9 同步1.5.0 03c06784b9377d170df34173012e6f1e5d752161
!2939 合并dev分支
    Merge pull request !2939 from weili10/dev
--
    !2938 整理环境变量UT_FAST_MODE
    Merge pull request !2938 from 龚俊强/master
同步1.8.1 ca365306224b30011046732c31a9766a3fcd608a
    !2884 1.8.1 __And__算子适配
    Merge pull request !2884 from 孙幸/1.8_And
2021-12-27 23:00:51 +08:00
AtlasAccount 886e7defe3 同步1.5.0 53d356a5e5ddd64ea7f02df1d6ae4d6e6415962a
!2937 【modify】celu底层算子IR修改,pytorch同步修改
    Merge pull request !2937 from 王晓/celu
--
    !2935 修改test\test_npu目录下import语句
    Merge pull request !2935 from 龚俊强/master
--
    !2936 【图模式】图模式走GE的推理模式
    Merge pull request !2936 from 宇世康/master
同步1.8.1 b034ed3575df353a16ddfce2345c751982a02b3f
    !2909 Any算子适配
    Merge pull request !2909 from 沈鹏程/1.8_adaption
--
    !2922 1.8.1 addbmm+bmm算子适配
    Merge pull request !2922 from 孙幸/1.8_addbmm
2021-12-25 23:02:04 +08:00
AtlasAccount 8d079ca335 同步1.5.0 e7dbd0e1c5cc7020b673d836e8f7b0bfb0273b14
!2919 修复codexdex问题
    Merge pull request !2919 from 周司南/master
同步1.8.1 de23fbe927c2cf47ea37da06a001735b3cc65904
2021-12-23 23:01:00 +08:00
AtlasAccount dd58af6101 同步1.5.0 44c3eb40a822b553a7c7e4c86856f6dfaab1d247
!2916 SyncBatchNorm: NPU支持SyncBatchNorm特性
    Merge pull request !2916 from 袁舰/master
--
    !2925 embeding_bag正向host cpu处理&增加测试用例
    Merge pull request !2925 from 牛作东/emb_new
--
    !2923 【BugFix】SyncBn相关算子在混合精度的异常dtype问题修改
    Merge pull request !2923 from wuxiankun/syncbnfix
--
    !2914 bugfix:修复安全问题,对于nullptr检查
    Merge pull request !2914 from shibo/fix_null
--
    !2913 bugfix: cann prof在start时需要同步,保证device上算子全部执行完成
    Merge pull request !2913 from shibo/cann_fix
同步1.8.1 de23fbe927c2cf47ea37da06a001735b3cc65904
2021-12-22 23:01:08 +08:00
AtlasAccount b3a172415b 同步1.5.0 7e61d03b1349f162b348f5a16676252377fb56e1
!2891 【适配】自定义接口npu_rotated_box_encode和npu_rotated_box_decode适配
    Merge pull request !2891 from 陈庆/rotated_box
--
    !2905 bugfix  adapt RotatedIou
    Merge pull request !2905 from 沈鹏程/adaptIR
同步1.8.1 de23fbe927c2cf47ea37da06a001735b3cc65904
2021-12-21 23:00:48 +08:00
AtlasAccount 35c09c5858 同步1.5.0 95f1549a1eadb6c7c7e55033aaaa75810b5ce3aa
!2896 UT全量测试加入test_graph_mode test_dynamic_ops等目录下的用例
    Merge pull request !2896 from 龚俊强/master
同步1.8.1 de23fbe927c2cf47ea37da06a001735b3cc65904
    !2890 1.8.1 __Rshift__算子适配
    Merge pull request !2890 from 孙幸/1.8_Rshift
2021-12-21 12:00:51 +08:00
AtlasAccount da90916ab0 同步1.5.0 52e8bc75379dc3079e31ccbeb65ccebc3a80f191
!2897 embedding_bag_backward_npu hostcpu适配实现
    Merge pull request !2897 from 牛作东/master
--
    !2901 合并dev分支
    Merge pull request !2901 from weili10/dev
--
    !2904 python3.9环境jit index parsing告警解除
    Merge pull request !2904 from 李超/master
--
    !2902 修复E2E prof多次调用的问题
    Merge pull request !2902 from shibo/e2e_bugfix
同步1.8.1 f9f494b14ca91bbf236f99f78aef3927c7c3cdab
2021-12-20 23:24:47 +08:00
i-robot 12364d5728 !85 迭代3 需求
Merge pull request !85 from liuquan/master
2021-12-20 07:44:53 +00:00
liuquan eec0f1d6e1 quick start 2021-12-20 11:15:43 +08:00
AtlasAccount 8efe0da55e 同步1.5.0 9b0a379565e3d54a388600c587bc706356778d22
!2895 【FixUp】`Div`算子替换为`RealDiv`,满足int32下的负数的小数位处理
    Merge pull request !2895 from wuxiankun/RealDiv
同步1.8.1 f9f494b14ca91bbf236f99f78aef3927c7c3cdab
    !2881 1.8.1算子适配:index_select
    Merge pull request !2881 from 王晓/1.8_index_select_1
2021-12-18 23:01:13 +08:00
AtlasAccount 86b2def4fc 同步1.5.0 da86ec1bc3c86cfc584d4b5e94330a69367d1242
!2774 for potorch org test case
    Merge pull request !2774 from 邱彬/master
同步1.8.1 db9b820f4aba41894f26e187a67450e4b2064a4c
2021-12-17 23:00:55 +08:00
AtlasAccount 86c8e6deb9 同步1.5.0 3caf6d087849ae99931af5393a5c0c747e1330a6
!2794 【Issue】】Silu支持inplace
    Merge pull request !2794 from wuxiankun/issue1.0
--
    !2775 补充ut测试用例
    Merge pull request !2775 from 王夏夏/master
同步1.8.1 db9b820f4aba41894f26e187a67450e4b2064a4c
2021-12-16 23:02:06 +08:00
AtlasAccount e966169b78 同步1.5.0 704b98e1c093599b549fc69004270956af73b6b9
!2749 【Requirement】SyncBatchnorm内部接口算子batch_norm_gather_stats_with_counts适配
    Merge pull request !2749 from wuxiankun/bngswc
--
    !2874 prof增加UT用例
    Merge pull request !2874 from shibo/e2e_ut
--
    !2876 bugfix:修复profiler可能多次初始化错误
    Merge pull request !2876 from shibo/master
同步1.8.1 db9b820f4aba41894f26e187a67450e4b2064a4c
2021-12-16 12:02:47 +08:00
AtlasAccount 504fa67da2 同步1.5.0 d3724a9f1132ddb957773d154b801584903caa18
!2865 [Requirement] 模型需求 rotated_iou算子adapt
    Merge pull request !2865 from 沈鹏程/adaptIR
--
    !2882 Task: clean codecheck warnings
    Merge pull request !2882 from 赵光灿/master
同步1.8.1 db9b820f4aba41894f26e187a67450e4b2064a4c
2021-12-15 23:03:23 +08:00
AtlasAccount 37ee6fafaa 同步1.5.0 f1e3ae1004dd8b609c2c1ab4062a4769d31202c2
!2855 【Optim&reFactor】addcdivfp16转fp32提高精度优化
    Merge pull request !2855 from wuxiankun/addcdiv16
--
    !2856 【FixBug】BatchNormBackwardReduce针对未定义时tensor的问题修复
    Merge pull request !2856 from wuxiankun/bnwcbug
--
    !2878 【fixbug】加入空实现修复cpu编译
    Merge pull request !2878 from wuxiankun/bertadam
--
    !2852 bug: 修改batchnorm推理失败错误问题
    Merge pull request !2852 from 郭夏/bntrainingupdate
同步1.8.1 db9b820f4aba41894f26e187a67450e4b2064a4c
    !2863 【fixbug】修复1.8.1 ne重复分发的问题
    Merge pull request !2863 from 王晓/pytorch1.8.1
--
    !2879 clean codecheck warnings
    Merge pull request !2879 from 龚俊强/pytorch1.8.1
2021-12-14 23:02:11 +08:00
AtlasAccount cb11345fbe 同步1.5.0 fd0700df1eca64d01571072bb51d56143e3efde3
!2877 单元测试算子出错时加入resnet18测试
    Merge pull request !2877 from 龚俊强/master
--
    !2873 【适配】自定义接口npu_nms_rotated适配
    Merge pull request !2873 from 陈庆/nms
--
    !2871 Task: clean codecheck warnings
    Merge pull request !2871 from 赵光灿/master
同步1.8.1 558f739f09d9f9422ec0f8e283c9f80ab62b42e5
    !2872 删除pytorch181 test/test_npu/目录下重复的testcase
    Merge pull request !2872 from 龚俊强/pytorch1.8.1
--
    !2870 Feature: add NPU AMP testcases
    Merge pull request !2870 from 赵光灿/pytorch1.8.1
2021-12-14 12:00:47 +08:00
AtlasAccount 166c725588 同步1.5.0 5a25bc8c316500e25ec05872fab20c11263300bf
!2840 【适配】解决upsample_nearest1d不支持fp16场景
    Merge pull request !2840 from 陈庆/upsample
--
    !2848 E2E prof刷新:使用rangeStart方式代替push和pop
    Merge pull request !2848 from shibo/fix_e2e
--
    !2861 cann prof: bugfix
    Merge pull request !2861 from shibo/master
同步1.8.1 b43c20ebdc1a9654362128a1e0c026592997cbb3
2021-12-11 23:02:29 +08:00
AtlasAccount 4f4eaecb7f 同步1.5.0 ffe6546441045daf30e2160d9dedc3f804b9f256
!2868 回退 Pull Request !2828 : 【BugFix】adaptive_max_pool2d更换底层算子
    Merge pull request !2868 from shibo/revert-merge-2828-master
--
    !2867 回退 Pull Request !2833 : 【FixBug】max_pool2d泛化增强
    Merge pull request !2867 from shibo/revert-merge-2833-master
同步1.8.1 b43c20ebdc1a9654362128a1e0c026592997cbb3
2021-12-11 12:01:24 +08:00
liuquan 4603744324 updata 2021-12-10 17:05:42 +08:00
liuquan 501c17aade remove PyTorch API 2021-12-10 16:57:30 +08:00
liuquan b998cd272d updata API 2021-12-10 16:12:35 +08:00
i-robot bed57e03c3 !84 添加开源社区贡献文档CONTRIBUTING.zh.md
Merge pull request !84 from shibo/add_docs
2021-12-10 02:32:04 +00:00
AtlasAccount 1cba4e9e8c 同步1.5.0 9af15479e7efd03da611ca897f106bd8d86980bb
!2846 【图模式】修改编译选项option配置+使用data构图避免重复编译
    Merge pull request !2846 from 王强/master
--
    !2833 【FixBug】max_pool2d泛化增强
    Merge pull request !2833 from 王晓/max_pool2d
--
    !2854 [bugfix] 更改HCCL编译依赖so版本
    Merge pull request !2854 from 李超/master
--
    !2828 【BugFix】adaptive_max_pool2d更换底层算子
    Merge pull request !2828 from 王晓/adaptive_max_pool2d
--
    !2829 添加开源社区贡献文档CONTRIBUTING.zh.md
    Merge pull request !2829 from 周司南/master
同步1.8.1 b43c20ebdc1a9654362128a1e0c026592997cbb3
2021-12-09 23:00:58 +08:00
liuquan ad7017491b pytorch 2021-12-09 14:32:24 +08:00
AtlasAccount 548d08f5e9 同步1.5.0 3e3d5c3c32363c2dedbcaaeabe8f4724c3e179b3
!2842 concat算子使用静态算子
    Merge pull request !2842 from shibo/fix_queue
--
    !2801 delete unnecessary check, refactor env.sh
    Merge pull request !2801 from weili10/master
同步1.8.1 b43c20ebdc1a9654362128a1e0c026592997cbb3
    !2830 Feature: AMP in pytorch 1.8.1 adapt to NPU
    Merge pull request !2830 from 赵光灿/pytorch1.8.1
2021-12-09 12:00:43 +08:00
shibo 0d362b2572 Merge branch 'master' of gitee.com:ascend/pytorch into add_docs 2021-12-09 03:59:02 +00:00
shibo19 194352fe9e fix 2021-12-09 11:52:05 +08:00
liuquan c718961328 updata 2021-12-09 11:12:45 +08:00
AtlasAccount 67407fd00e 同步1.5.0 a067a49a8bf60af93c787eb092e646d6b3333ed2
!2823 modify: 修改BNTrainingUpdate算子mean和var在FP32时也进行强转FP32导致性能损失问题
    Merge pull request !2823 from 郭夏/bntrainingupdate
--
    !2841 AOE接口更新:dump接口opt参数仅支持nullptr
    Merge pull request !2841 from shibo/aoe_bugfix
同步1.8.1 c915e5ba3fe0831340ef817ec3fcad27fa5151c9
2021-12-08 23:01:13 +08:00
liuquan fad4a75b37 updata 2021-12-08 22:07:31 +08:00
liuquan 035121e1fb updata 2021-12-08 21:30:55 +08:00
shibo19 82d7341955 update 2021-12-08 16:43:36 +08:00
AtlasAccount 8cd641382e 同步1.5.0 4d9ff332ada3bc91bf37c4aaa97725040472d6fa
!2836 AOE接口更新
    Merge pull request !2836 from shibo/aoe_update
--
    !2751 【适配】LSTM双层双向场景适配
    Merge pull request !2751 from 陈庆/lstm_bi
同步1.8.1 c915e5ba3fe0831340ef817ec3fcad27fa5151c9
2021-12-08 12:00:43 +08:00
liuquan c6648343a7 updata 2021-12-08 10:11:23 +08:00
AtlasAccount 89a7a12a03 同步1.5.0 581620286789c28cb32617bd256ca57ecc925a90
!2805 【Optim】ApplyAdamV2算子侧有增强,适配层同步修改接口
    Merge pull request !2805 from wuxiankun/adalm
--
    !2826 Task: clean codecheck warnings
    Merge pull request !2826 from 赵光灿/master
--
    !2813 [非连续优化]-clone公共层耗时优化+转连续UT
    Merge pull request !2813 from 李超/cont_git1202-1
--
    !2811 modify: upsample_nearest3d支持FP16和6HD输入报错问题
    Merge pull request !2811 from 郭夏/upsample_nearest3d
同步1.8.1 c915e5ba3fe0831340ef817ec3fcad27fa5151c9
2021-12-07 23:00:56 +08:00
liuquan 4eba985a2f updata 2021-12-07 18:59:02 +08:00
liuquan ea8d8ad8c9 add code 2021-12-07 15:54:47 +08:00
liuquan 590e749dfe add pytorch train 2021-12-07 15:10:42 +08:00
AtlasAccount 6a949ada88 同步1.5.0 2b84dd37673a9c2588a4e8b9f296cdf70778511b
!2808 【BugFix】反向算子DynamicRNNGrad不支持指定direction,正向适配规避
    Merge pull request !2808 from 陈庆/lstm_direction
同步1.8.1 c915e5ba3fe0831340ef817ec3fcad27fa5151c9
2021-12-07 12:01:03 +08:00
AtlasAccount 40169ac353 同步1.5.0 bb6beaa95e6df9e0dc5499bc4cd360826ad846b2
!2791 【泛化】 gru支持batch_first参数
    Merge pull request !2791 from wuxiankun/optim2.0
--
    !2789 【1.5PT整改】整改PTUpsampleBilinear2dGrad
    Merge pull request !2789 from 李攀/bugfix
同步1.8.1 c915e5ba3fe0831340ef817ec3fcad27fa5151c9
    !2827 Task: clean codecheck warnings
    Merge pull request !2827 from 赵光灿/pytorch1.8.1
2021-12-06 23:00:55 +08:00
liuquan c13ed77bd6 updata API 2021-12-06 22:06:42 +08:00
shibo19 ea3dda5363 update 2021-12-06 17:37:02 +08:00
AtlasAccount d52329f755 同步1.5.0 41725bbf17d3b132f2f1ed13424c9e13f2770021
!2812 修复conv3d梯度分布式计算错误问题
    Merge pull request !2812 from lijing/master
--
    !2796 【Optim】SyncBatchNormBackwardReduce代码优化
    Merge pull request !2796 from wuxiankun/optim1.0
同步1.8.1 b668ec453ef4392fdb0585fd2d72756a0122f15c
    !2825 删除test/test_npu/目录下重复的testcase
    Merge pull request !2825 from 龚俊强/pytorch1.8.1
2021-12-06 12:00:42 +08:00
liuquan 9a2ffe7dc5 add pytorch 1.8.1 API 2021-12-06 11:25:29 +08:00
AtlasAccount 6102b560d4 同步1.5.0 02bce90c89c8ff9abd9973b6d2d7e097de46c858
!2822 taskqueue场景下release para不使用queue
    Merge pull request !2822 from shibo/fix_queue
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-05 23:01:03 +08:00
AtlasAccount a704d91840 同步1.5.0 f49cdb77ff1e8d8cca32a89097573208ee2cb1b8
!2819 [BugFix] 判断内存重叠是转换顺序,防止storage()为空
    Merge pull request !2819 from 宇世康/master
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-04 23:00:46 +08:00
liuquan 4dadfcf404 support python3.9 2021-12-04 15:51:23 +08:00
i-robot 643cc072eb !83 刷新readme
Merge pull request !83 from shibo/add_docs
2021-12-04 02:38:07 +00:00
AtlasAccount dc69d5441d 同步1.5.0 32cd40c1dd233f893dae2d351fac072cb4a0ffd9
!2806 【性能优化】scalar输入改成ACL_MEMTYPE_HOST_COMPILE_INDEPENDENT输入
    Merge pull request !2806 from 蒋荣强/scalar
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-03 23:00:55 +08:00
AtlasAccount 12e6d9f07a 同步1.5.0 aec197c05caa58c118810b9cc57069752966b9c0
!2804 modify: Bernoulli AICPU算子启用第2个流修改(参照dropout)
    Merge pull request !2804 from 郭夏/bernoulli
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-03 12:00:43 +08:00
AtlasAccount f6b284d021 同步1.5.0 b087ec154910da641e1e40b97ce3dde8f742d0c3
!2782 modify: batchnorm 支持FP16参数输入
    Merge pull request !2782 from 郭夏/bntrainingupdate
--
    !2807 删除test/test_npu/目录下重复的testcase
    Merge pull request !2807 from 龚俊强/master
--
    !2803 Task: clean codecheck warnings
    Merge pull request !2803 from 赵光灿/master
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-02 23:00:53 +08:00
shibo19 b87b437702 update readne 2021-12-02 09:39:32 +08:00
AtlasAccount 38675dbea0 同步1.5.0 4b53265e607eb120b4b1c7924014c5d45561632c
!2763 【性能优化】入队列优化
    Merge pull request !2763 from 蒋荣强/enqueue
--
    !2772 增加E2E profiling功能
    Merge pull request !2772 from shibo/e2e_better
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-01 23:00:51 +08:00
AtlasAccount e9a794a491 同步1.5.0 b08d8f7bbfa236bc413a16d0d2f8c8c086c3d654
!2798 【需求】【1.8反合1.5】1.8版本增加NPU独有算子反合1.5版本
    Merge pull request !2798 from 姚斌/master
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-12-01 12:00:44 +08:00
AtlasAccount 141d1b4c51 同步1.5.0 18dad28e5f25f2334f456aaf6d5f32680bccff25
!2784 提交图模式 test_contiguous ut 测试代码
    Merge pull request !2784 from 薛磊/test_nllloss
--
    !2776 Task: clean codecheck warnings
    Merge pull request !2776 from 赵光灿/master
--
    !2797 graph mode ut code style 3
    Merge pull request !2797 from 薛磊/pr_ut_1130
--
    !2767 modify: std规避ReduceStdWithMean算子输入0维或者1维1个元素时报错的问题
    Merge pull request !2767 from 郭夏/std_modify
--
    !2795 graph mode ut code style 2
    Merge pull request !2795 from 薛磊/pr_ut_code_check_v2
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-11-30 23:00:47 +08:00
AtlasAccount 9961ec03ae 同步1.5.0 58174932de2d5809cc64768eb3c43ea2bf981618
!2760 【优化】Div适配优化
    Merge pull request !2760 from 吴贤坤/fixbug5.0
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
2021-11-30 12:00:58 +08:00
i-robot e8e641b331 !82 刷新docs文档:提示切换分支
Merge pull request !82 from shibo/add_docs
2021-11-30 01:50:08 +00:00
AtlasAccount eb29fd3e36 同步1.5.0 5185b6cbd85176ff1854db1ed80ef1c87147a3b0
!2786 【图模式】Run图接口添加RecordHostFunc,记录耗时
    Merge pull request !2786 from 宇世康/master
--
    !2792 PR门禁脚本改为运行test/test_npu/XXX/目录下脚本
    Merge pull request !2792 from 龚俊强/master
--
    !2788 graph mode ut code style
    Merge pull request !2788 from 薛磊/test_code_check
--
    !2755 【Bugfix】grid_sampler2d修改test_batchnormbackwardreduce脚本参数名修改重构
    Merge pull request !2755 from 吴贤坤/fixbug4.0
同步1.8.1 438c8daf58550d882e8b4763910cc93b927d89f7
    !2790 Task: clean codecheck warnings
    Merge pull request !2790 from 赵光灿/pytorch1.8.1
--
    !2773 1.8.1算子适配:ge,le
    Merge pull request !2773 from 王晓/1.8_ge_le_gt_lt
2021-11-29 23:00:45 +08:00
i-robot 0c5c61e3bc !81 Added README.en.md.
Merge pull request !81 from yanhuiling/master
2021-11-29 11:22:14 +00:00
shibo19 3708204f40 update docs 2021-11-29 10:55:12 +08:00
AtlasAccount fbdf33ddd0 同步1.5.0 2e9004844c45a4ef97f1642ec3ed395451115879
!2781 【Patch】gru bias bug 修复补丁
    Merge pull request !2781 from 吴贤坤/grupatch
--
    !2778 [Feature] 支持python3.9
    Merge pull request !2778 from 李超/py39
同步1.8.1 c2fd32bc49a6ce4170114c122a503d1c92589716
2021-11-27 12:00:47 +08:00
AtlasAccount 676978f973 同步1.5.0 ce7a96cd1f0d4ea0cc24bb1b134e534aca6c3ca9
!2783 nllloss2d 修改调用接口,删除老接口
    Merge pull request !2783 from 薛磊/dev_nllloss
--
    !2780 删除图模式contiguous, pow相关用例
    Merge pull request !2780 from 薛磊/del_contiguous
--
    !2771 解决图模式下 nllloss 适配层内存拷贝问题
    Merge pull request !2771 from 薛磊/pr_calcu_nllloss
--
    !2732 图模式ut
    Merge pull request !2732 from 薛磊/ut_graph
--
    !2779 【图模式】修复is graph mode接口的double free问题
    Merge pull request !2779 from 宇世康/master
--
    !2769 【图模式】 去除图模式的abi为1的依赖,需要等cann包更新后合入
    Merge pull request !2769 from 宇世康/ysk
同步1.8.1 c2fd32bc49a6ce4170114c122a503d1c92589716
2021-11-26 23:02:48 +08:00
AtlasAccount 6ff723d026 同步1.5.0 528664affa111c3976ff6a72ab9befa42ff96fef
!2713 【optimize】3d 类模型格式转换优化
    Merge pull request !2713 from 李超/3d_transdata
--
    !2727 add test case for the cross-device copy check
    Merge pull request !2727 from weili10/master
--
    !2761 Task: clean codecheck warnings
    Merge pull request !2761 from 赵光灿/master
同步1.8.1 c2fd32bc49a6ce4170114c122a503d1c92589716
    !2770 【BugFix】【需求】NPU独有算子适配apply_adam_out_npu、bert_apply_adam_out_npu
    Merge pull request !2770 from 姚斌/pytorch1.8.1
--
    !2762 Task: clean codecheck warnings
    Merge pull request !2762 from 赵光灿/pytorch1.8.1
2021-11-25 23:00:47 +08:00
AtlasAccount 184db237b1 同步1.5.0 841a9a8d082265efd5649d0d9c7cf050ea9379aa
!2748 [Requirement] 模型需求 rotated_overlaps算子adapt
    Merge pull request !2748 from 吴贤坤/rto
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-25 12:00:51 +08:00
AtlasAccount df03cbe8d6 同步1.5.0 0941c08390a26f4ab4627f73371adf4bdd49b7c1
!2766 【优化】Dropout适配优化
    Merge pull request !2766 from 陈庆/drop
--
    !2753 修改PR门禁以及全量UT测试的判错标准
    Merge pull request !2753 from 龚俊强/master
--
    !2758 [contrib/npu/optimized_lib/] avoid warning
    Merge pull request !2758 from 王姜奔/master
--
    !2768 【图模式】set graph mode varibale mem max size to 1M
    Merge pull request !2768 from 王强/master
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-24 23:00:47 +08:00
yanhuiling 02b5954125 added README.en.md.
added  README.en.md.
2021-11-24 14:05:14 +00:00
AtlasAccount c3723c6db0 同步1.5.0 5655fb8d0be5580b7870c5e8ec65f3ac2e9197a8
!2754 modify: 调用dot时修改为直接调用NPU函数,保证模糊编译能够正常运行
    Merge pull request !2754 from 郭夏/matmul
--
    !2757 【图模式】图模式与单算子模式都在empty与empty with format中将storage添加入context中
    Merge pull request !2757 from 宇世康/master
--
    !2756 【图模式】bugfix of switch between graph mode and single-op mode
    Merge pull request !2756 from 王强/master
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-24 12:04:05 +08:00
AtlasAccount 2125edf662 同步1.5.0 57fb197351ff3087282bd37a01da3d2f59f67491
!2734 dump图以支持aoe功能
    Merge pull request !2734 from shibo/aoe
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-23 23:00:48 +08:00
liuquan 273ab333eb GPU dump NPU load 2021-11-23 19:46:23 +08:00
AtlasAccount e698adf379 同步1.5.0 482cf5c72cbb3b52ebf4a626566aeaa6da014824
!2750 【FixBug】修复mse_loss在非nd场景下的报错
    Merge pull request !2750 from 王晓/mseloss
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-23 12:00:42 +08:00
AtlasAccount 172a8154f8 同步1.5.0 49dfa00e664e205b94843572ac10064546583660
!2744 [acl profiling]兼容msprof,对msprof已经运行的错误不做处理
    Merge pull request !2744 from lijing/master
--
    !2729 【适配】npu_min接口适配
    Merge pull request !2729 from 陈庆/minv1
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-22 23:01:02 +08:00
AtlasAccount e6c9ed0c77 同步1.5.0 774fb0bd7f1e7c30f18517e3ef5f41a7dc4761d6
!2730 【性能优化】优化出队列间隙耗时
    Merge pull request !2730 from 蒋荣强/optimize1
--
    !2743 跨so调用增加TORCH_NPU_API维护GraphExecutor单例
    Merge pull request !2743 from 宇世康/master
--
    !2741 【图模式】原地算子中,内存overlap判断情形增加IS_NULL
    Merge pull request !2741 from 宇世康/master
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
2021-11-19 23:01:33 +08:00
liuquan 30951b3eda update 2021-11-19 16:25:27 +08:00
weili10 d938e07a73 update README.zh.md. 2021-11-19 08:17:21 +00:00
weili10 8a5c0b30a1 update README.zh.md. 2021-11-19 08:14:41 +00:00
weili10 262d785419 update README.zh.md. 2021-11-19 08:14:05 +00:00
AtlasAccount cebdde8f48 同步1.5.0 fbee31be058af34c021da0f152d128ecf5e86c5d
同步1.8.1 b220e1bfda03c88c7a5d72322e2fe2b68794149e
    !2740 【bugfix】【需求】【1.8NPU独有算子适配整改】npu_bert_apply_adam
    Merge pull request !2740 from 姚斌/pytorch1.8.1
2021-11-19 00:41:55 +08:00
AtlasAccount e9257ed887 同步1.5.0 fbee31be058af34c021da0f152d128ecf5e86c5d
!2728 【功能修复】解决event入队列后的死锁问题
    Merge pull request !2728 from 蒋荣强/bug1
--
    !2677 graph mode cat和stack代码适配修改
    Merge pull request !2677 from 薛磊/dev_cat_stack
同步1.8.1 63b24dfd62f070475f36d43df01a74181ce90aa5
2021-11-18 19:54:32 +08:00
i-robot e420c35be6 !80 需求合入
Merge pull request !80 from liuquan/master
2021-11-18 09:27:43 +00:00
weili10 c5581b6189 update OWNERS. 2021-11-18 09:26:13 +00:00
AtlasAccount f44d2a8710 同步1.5.0 241bab3b3b873e4219bacf244e178e88abe85994
!2737 增加一些图模式需要的函数打桩+修复cuda版本的编译问题
    Merge pull request !2737 from 宇世康/master
--
    !2736 【图模式pr】view and contiguous changes of graph mode
    Merge pull request !2736 from 王强/master
--
    !2731 【Bugfix】LSTM反向梯度丢失
    Merge pull request !2731 from 陈庆/master
同步1.8.1 63b24dfd62f070475f36d43df01a74181ce90aa5
2021-11-18 12:00:45 +08:00
AtlasAccount 4eb5bbd3fe 同步1.5.0 a79fa0808e178fe36ee49ae22d874fa5cfa15bff
!2724 【图模式PR_2】pr_2的主要修改是融合GraphCommandImpl到OpCommandBase中,接管Opcmd的接口,在不改变单算子适配的情况下使能图构造
    Merge pull request !2724 from 宇世康/graph_mode
--
    !2725 fix broadcast opt verification conditions, avoid incorrect recognition of expand + view
    Merge pull request !2725 from 王强/master
同步1.8.1 63b24dfd62f070475f36d43df01a74181ce90aa5
2021-11-17 16:09:04 +08:00
AtlasAccount 0c58e128e7 同步1.5.0 cd7987730df2e98d4d725ddbee973db7645c656a
!2726 【功能修复】开启queue后删除oom保护机制
    Merge pull request !2726 from 蒋荣强/bug
--
    !2719 【FixBug】AICPU算子upsample_nearest3d正反向支持fp16
    Merge pull request !2719 from 王晓/up_n3d_b
同步1.8.1 63b24dfd62f070475f36d43df01a74181ce90aa5
    !2702 【需求】【1.8NPU独有算子适配】npu_bert_apply_adam、npu_apply_adam
    Merge pull request !2702 from 姚斌/pytorch1.8.1
--
    !2722 add cross-device copy check
    Merge pull request !2722 from weili10/pytorch1.8.1
2021-11-16 23:22:38 +08:00
AtlasAccount 0e1d68761b 同步1.5.0 73424f02c30a6800cf967c23920a27e5f4fbc212
!2721 add cross-device copy check
    Merge pull request !2721 from weili10/master
同步1.8.1 07edd5926b30109419e105521bc675f55ae0e3f6
2021-11-16 12:00:53 +08:00
AtlasAccount e161be6f75 同步1.5.0 474fcee57578ecb93985b22b3b50aff461250fd2
!2716 【图模式】 PR_1 :增量修改,增加图构造,图执行,图缓存的能力以及增加pytorch层的四个接口
    Merge pull request !2716 from 宇世康/graph_mode
同步1.8.1 07edd5926b30109419e105521bc675f55ae0e3f6
2021-11-16 10:11:52 +08:00
AtlasAccount 40e0982fe4 同步1.5.0 e0da7d2e6931d71edb7bbcba6d68d3d12f1bd20f
!2709 [contrib/npu/optimized_lib/] add SiLU
    Merge pull request !2709 from 王姜奔/silu
--
    !2714 【功能修复】解决record event入队列后,event资源延迟释放导致的evnet资源耗尽问题
    Merge pull request !2714 from 蒋荣强/bug
--
    !2670 【Bugfix】 修改&补充test.constant_pad_nd测试用例
    Merge pull request !2670 from 吴贤坤/fixbug2.0
--
    !2711 【FixBug】修复mv在输入为转置tensor时报错的问题
    Merge pull request !2711 from 王晓/mv
--
    !2712 调用aclopCompileAndExecute时判断gil锁是否被持有,持有的话释放。目的时防止TE编译算子时无法获取gil锁。
    Merge pull request !2712 from 宇世康/ysk
同步1.8.1 07edd5926b30109419e105521bc675f55ae0e3f6
2021-11-15 14:40:25 +08:00
liuquan 3a36da0345 modify IR2TBE 2021-11-13 17:44:27 +08:00
AtlasAccount 6a32513e71 同步1.5.0 226265063cfb50661352605720c96d09498e7564
!2697 【适配优化】constant_pad_nd性能优化
    Merge pull request !2697 from 陈庆/master
--
    !2695 【Bugfix】nll_loss输出格式修改
    Merge pull request !2695 from 吴贤坤/fixbug3.0
同步1.8.1 07edd5926b30109419e105521bc675f55ae0e3f6
2021-11-12 09:30:13 +08:00
AtlasAccount 3b92e80698 同步1.5.0 2f47f3a0304a181ecc4f75c6a36f329e6435b0b6
!2672 【Requirement】Gru多层双向功能适配补充
    Merge pull request !2672 from 吴贤坤/gru
--
    !2704 add: bincount for 1.5.1
    Merge pull request !2704 from 郭夏/bincount
--
    !2674 【FixBug】softmax_backward移除多余格式转换
    Merge pull request !2674 from 王晓/softmax_backward_nz
同步1.8.1 07edd5926b30109419e105521bc675f55ae0e3f6
    !2599 add:  erf op for ver 1.8.1
    Merge pull request !2599 from 郭夏/erf
2021-11-11 12:00:45 +08:00
AtlasAccount 127ddaeb87 同步1.5.0 ee9cf0fbc27e260173c16ce55a829f477e51f84f
同步1.8.1 120ae5365ebb24137b534ce063c7d7dc7a408c61
    !2657 【1.8.1】适配“upsamplebilinear2d”
Merge: 1fb062334 049b1e4f2
    !2662 【1.8.1】适配“Scatter_”
    Merge pull request !2662 from 李攀/do_1.8.1
--
    !2647 delete redundant check_match and invalid trans-contiguous code
    Merge pull request !2647 from weili10/pytorch1.8.1
2021-11-10 23:00:45 +08:00
AtlasAccount eb42aa1431 同步1.5.0 ee9cf0fbc27e260173c16ce55a829f477e51f84f
!2705 【性能优化】新增SCALAR_TO_HOST_MEM环境变量用于控制scalar输入的是否转为host memory
    Merge pull request !2705 from 蒋荣强/bug
同步1.8.1 a355a602d33f0fe3b65a627d9d0cf784309c1466
    !2700 bugfix: 修复profiler打印信息错误问题
    Merge pull request !2700 from shibo/profiler_bug
2021-11-10 20:46:37 +08:00
liuquan 3a1a239c76 modify format 2021-11-10 17:34:32 +08:00
liuquan 62c4f91fff modify format 2021-11-10 17:17:15 +08:00
liuquan ba0cdcc6f5 profiler 新增功能 2021-11-10 16:46:54 +08:00
AtlasAccount 9d8ba72c9b 同步1.5.0 7d56e9e47baa563428026b1315ea3e7155e29082
同步1.8.1 db8554c8db96ce9bac588aa6c0a9b6321482d76d
    !2696 【1.8算子适配】cdist、cdist_backward、pdist
    Merge pull request !2696 from 姚斌/pytorch1.8.1_1
2021-11-09 23:00:56 +08:00
AtlasAccount 77069c2c3e 同步1.5.0 7d56e9e47baa563428026b1315ea3e7155e29082
!2663 【图模式】Graph execute/construct/cache/utils功能以及正式python接口
    Merge pull request !2663 from 宇世康/master
同步1.8.1 c3ca90462e9c6d7cdefec410ce71b6d01ac76142
2021-11-09 12:00:50 +08:00
AtlasAccount 5510f37292 同步1.5.0 61e1a032928f4b80953bf4b130debba5f971a53d
!2699 修复RECORD_HOST_FUNCTION宏的bug,acl task queue线程也可以使用RECORD_HOST_FUNCTION
    Merge pull request !2699 from wangyu/master
--
    !2698  提供RECORD_HOST_FUNCTION宏,用于只记录host侧耗时
    Merge pull request !2698 from wangyu/master
--
    !2684 [dump utils] ThnnConvDepthwise2DBackward 在特定情况下仍然走cudnn
    Merge pull request !2684 from lijing/master
同步1.8.1 c3ca90462e9c6d7cdefec410ce71b6d01ac76142
    !2661 【1.8算子适配】softmax、true_divide
    Merge pull request !2661 from 姚斌/pytorch1.8.1
2021-11-08 23:00:44 +08:00
AtlasAccount 49aac16852 同步1.5.0 5dbbdd469a94c9e120360555c61fc66011478e26
同步1.8.1 87c1ee679055f052ab9a2bcdfc7bbfd065dd0ade
    !2642 【pytorch 1.8 算子适配】提交算子addmv、addr
    Merge pull request !2642 from TD_lihan/py18_addmv
--
    !2640 【pytorch 1.8 算子适配】提交算子adaptive_avg_pool1d
    Merge pull request !2640 from TD_lihan/py18_AdaptiveAvgPool1d
--
    !2604 【1.8算子迁移】卷积类修改等
    Merge pull request !2604 from 吴贤坤/conv_1.8
--
    !2654 增加profiler UT
    Merge pull request !2654 from shibo/profiler_ut
--
    !2668 【1.8算子适配】celu、selu
    Merge pull request !2668 from 姚斌/pytorch1.8.1_1
2021-11-08 12:00:45 +08:00
AtlasAccount 25b61ee2ee 同步1.5.0 5dbbdd469a94c9e120360555c61fc66011478e26
同步1.8.1 ddeb6df954cd6db748138cdd7d27e6d61de80b14
    !2683 1.8版本增加HCCL环境变量
    Merge pull request !2683 from shibo/add_env
--
    !2681 ddp在fp32场景下训练失败修复
    Merge pull request !2681 from shibo/dd_bugfix
--
    !2682 修复npu tensor类型转换丢失梯度属性问题
    Merge pull request !2682 from shibo/cast_bugfix
2021-11-06 16:37:10 +08:00
AtlasAccount 2ece9b72f6 同步1.5.0 5dbbdd469a94c9e120360555c61fc66011478e26
!2649 使用Identity代替Transdata
    Merge pull request !2649 from 詹隽/Identity_dev
--
    !2667 【性能优化】add record event to queue
    Merge pull request !2667 from 蒋荣强/RecordEvent
--
    !2660 1.5版本profiler功能优化
    Merge pull request !2660 from shibo/profiler_15
--
    !2658 【Bugfix】修改oom问题当调Conv3d时
    Merge pull request !2658 from 吴贤坤/fixbug
同步1.8.1 9702fe1349fd09e99d12a9d6799da5783da84663
    !2601 PyTorch1.8算子适配:uniform_
    Merge pull request !2601 from 牛作东/uniform_
2021-11-04 23:00:44 +08:00
AtlasAccount 2572775832 同步1.5.0 98d45fbd807b8bff03f51a05aedc3ac5efca29e3
!2666 Task: clean codecheck warnings
    Merge pull request !2666 from 赵光灿/master
同步1.8.1 80e9f656f8a2e05d80cd616847d7b7cb2586efc0
    !2645 Task: clean codecheck warnings
    Merge pull request !2645 from 赵光灿/pytorch1.8.1
2021-11-04 12:01:01 +08:00
AtlasAccount 500b51dd61 同步1.5.0 0a6f40ccd42088c4e0266ca62f22c3a1e1812ac7
同步1.8.1 b505d498eb6541469d8c8fdc07ed96c1a80f63c8
2021-11-03 12:01:11 +08:00
AtlasAccount bda7456cd9 同步1.5.0 0a6f40ccd42088c4e0266ca62f22c3a1e1812ac7
!2634 【1.5适配】“BatchNormBackwardElemt”
    Merge pull request !2634 from 李攀/bugfix
--
    !2629 东北大学TensorEqual算子适配测试文件交付
    Merge pull request !2629 from k188/TensorEqual
--
    !2650 Task: clean codecheck warnings
    Merge pull request !2650 from 赵光灿/master
同步1.8.1 b505d498eb6541469d8c8fdc07ed96c1a80f63c8
    !2655 【1.8算子适配】randperm、stack
    Merge pull request !2655 from 姚斌/pytorch1.8.1_1
--
    !2652 【1.8算子适配】std、std_mean、trunc
    Merge pull request !2652 from 姚斌/pytorch1.8.1
--
    !2646 【1.8.1】适配“maxunpool3d”
    Merge pull request !2646 from 李攀/do_1.8.1_2
--
    !2638 【pytorch 1.8 算子适配】提交算子abs
    Merge pull request !2638 from TD_lihan/py18_abs
--
    !2648 【1.8适配】“优化test_floatstatus.py”
    Merge pull request !2648 from 李攀/do_1.8.1
2021-11-03 09:39:32 +08:00
AtlasAccount 040029c1a1 同步1.5.0 58a86f5a7d8cfbb02dba057f04537b9e004f4593
同步1.8.1 cfa8827d1fb5c28878e856d6c5d1ec5f261ab206
2021-11-02 12:01:04 +08:00
AtlasAccount ec371989b4 同步1.5.0 58a86f5a7d8cfbb02dba057f04537b9e004f4593
!2641 Task: clean codecheck warnings
    Merge pull request !2641 from 赵光灿/master
--
    !2621 【算子适配】grid_sampler_2d算子正反向
    Merge pull request !2621 from 姚斌/master
--
    !2632 【Bugfix】算子不支持batch_first为True,适配层需将输出的Batch轴作为第0轴
    Merge pull request !2632 from 陈庆/master
同步1.8.1 cfa8827d1fb5c28878e856d6c5d1ec5f261ab206
    !2639 【pytorch 1.8 算子适配】提交算子acos
    Merge pull request !2639 from TD_lihan/py18_acos
--
    !2626 【1.8升级】L1Loss
2021-11-01 23:00:57 +08:00
liuquan ca59aaf3c6 修改格式 2021-11-01 18:42:41 +08:00
liuquan 78f946c17d 新增:IR映射TBE 2021-11-01 18:37:42 +08:00
AtlasAccount ef4e7240b6 同步1.5.0 790429b1a174b47714d38e7dd2b18a36bef01f83
同步1.8.1 1901c67035192c760ebdd32f422ea86fa40bf922
2021-10-31 23:00:50 +08:00
AtlasAccount 6ac16dfab0 同步1.5.0 790429b1a174b47714d38e7dd2b18a36bef01f83
同步1.8.1 1901c67035192c760ebdd32f422ea86fa40bf922
2021-10-31 12:00:49 +08:00
AtlasAccount 283e923317 同步1.5.0 790429b1a174b47714d38e7dd2b18a36bef01f83
!2637 异步拷贝入队列
    Merge pull request !2637 from 蒋荣强/async
--
    !2635 Task: clean codecheck warnings
    Merge pull request !2635 from 赵光灿/master
同步1.8.1 1901c67035192c760ebdd32f422ea86fa40bf922
    !2624 【适配】To/Rsub算子适配
    Merge pull request !2624 from 陈庆/pytorch1.8.1
--
    !2603 1.8算子迁移】ps_roi_pooling,npu_roi_align, npu_iou等
    Merge pull request !2603 from 吴贤坤/npu_fd_bd_1.8_bnms
--
    !2636 1.8版本优化profiler
    Merge pull request !2636 from shibo/profiler_simple
2021-10-30 23:02:03 +08:00
AtlasAccount e6e7203cce 同步1.5.0 caf3ceb04e4a115ce8d1498952c110fb4b9bc317
!2625 修改OpCommandBase中input和output接口参数
    Merge pull request !2625 from 薛磊/dev_opcommand_parameter
同步1.8.1 2bfd20f98a90ed25faa3a019ec42379e6e153b3e
2021-10-30 12:00:39 +08:00
AtlasAccount 6bb0e87a77 同步1.5.0 639610b805d6bc4abfe4ee632e6291aa48835d3c
!2630 Task: clean codecheck warnings
    Merge pull request !2630 from 赵光灿/master
同步1.8.1 2bfd20f98a90ed25faa3a019ec42379e6e153b3e
2021-10-29 23:00:56 +08:00
AtlasAccount 2497544a76 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
同步1.8.1 2bfd20f98a90ed25faa3a019ec42379e6e153b3e
    !2631 Task: clean codecheck warnings
    Merge pull request !2631 from 赵光灿/pytorch1.8.1
2021-10-29 12:00:48 +08:00
AtlasAccount ae597b5e21 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
同步1.8.1 c1fa09ac6f19542adfd7a1dded1561b1a0fb3fd9
    !2616 1.8.1算子tril、ne、eq适配迁移
    Merge pull request !2616 from 王晓/tril
--
    !2613 1.8.1算子triu适配迁移
    Merge pull request !2613 from 王晓/1.8.1_triu
2021-10-28 23:00:49 +08:00
AtlasAccount c0723277c4 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
同步1.8.1 ebba68383c462ce8351d6fc4c1f19b3039568925
2021-10-28 12:00:53 +08:00
AtlasAccount 64daba9637 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
同步1.8.1 ebba68383c462ce8351d6fc4c1f19b3039568925
2021-10-27 23:15:47 +08:00
AtlasAccount d9e50e3a9f 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
同步1.8.1 ebba68383c462ce8351d6fc4c1f19b3039568925
2021-10-27 12:00:50 +08:00
AtlasAccount 4dec0c82a1 同步1.5.0 b1f4e771b0b6f736386bba9838e28edb0556e743
!2622 solve input type mismatch problem of mul
    Merge pull request !2622 from 蒋荣强/scalar
同步1.8.1 ebba68383c462ce8351d6fc4c1f19b3039568925
    !2600 add:  exp op for 1.8.1
    Merge pull request !2600 from 郭夏/exp
--
    !2565 1.8.1适配“maxpool3d, smoothL1Loss, SoftMarginLoss”
    Merge pull request !2565 from 李攀/do_1.8.1_2
2021-10-26 23:00:52 +08:00
AtlasAccount e6b84a7986 同步1.5.0 bf7628c383f445fbdb4c95fb3aa002bff260a9f3
!2620 op proto for graph mode
    Merge pull request !2620 from 薛磊/dev_op_proto
--
    !2619 [dump utils]修复op map返回为空的问题
    Merge pull request !2619 from lijing/master
同步1.8.1 62372aba9b1c73f87ef30f87027886e93d960382
    !2617  【function】add python3.8 compiling to pytorch1.8
    Merge pull request !2617 from 李超/pytorch1.8.1
--
    !2612 【1.8算子迁移】tanh,sigmoidgrad等
    Merge pull request !2612 from 吴贤坤/backward_1.8
--
    !2610 【1.8适配】nllloss2dbackward
    Merge pull request !2610 from 李攀/do_1.8.1_5
--
    !2618 1.8版本profiling支持屏蔽适配层内算子
    Merge pull request !2618 from shibo/profiler_simple
--
    !2611 【1.8算子适配】min、mv、ones
    Merge pull request !2611 from 姚斌/pytorch1.8.1
2021-10-26 12:00:48 +08:00
i-robot f2e2a4168d !78 update the catalog of en docs
Merge pull request !78 from yinzijun/master
2021-10-26 01:32:56 +00:00
AtlasAccount 92f9e54783 同步1.5.0 081357bddfac9aafadf4c37cfbccffbe21e392fe
!2595 [dump utils]新增view类黑名单算子
    Merge pull request !2595 from lijing/master
--
    !2615 [contrib/npu/optimized_lib/] add giou
    Merge pull request !2615 from 王姜奔/giou
--
    !2614 dynamicShape: forbiden roialign and roialigngrad
    Merge pull request !2614 from 周司南/master
同步1.8.1 87920ba2ff21bb968a8e371f11dc4ba47b94a768
2021-10-25 23:00:45 +08:00
AtlasAccount 5d23983945 同步1.5.0 88bb20489508d6783c1d2816eb911dae21757f7a
同步1.8.1 87920ba2ff21bb968a8e371f11dc4ba47b94a768
2021-10-24 23:00:55 +08:00
AtlasAccount 0850d4e22a 同步1.5.0 88bb20489508d6783c1d2816eb911dae21757f7a
同步1.8.1 87920ba2ff21bb968a8e371f11dc4ba47b94a768
2021-10-24 12:01:05 +08:00
AtlasAccount c788e1a85c 同步1.5.0 88bb20489508d6783c1d2816eb911dae21757f7a
!2594 使用 OpCommand 接口适配relu和gelu backward算子
    Merge pull request !2594 from 薛磊/dev_relu_gelu
同步1.8.1 87920ba2ff21bb968a8e371f11dc4ba47b94a768
2021-10-23 23:00:46 +08:00
AtlasAccount f414fe6e4c 同步1.5.0 7508158b533e4974558a4e72653917aa45d694c3
同步1.8.1 87920ba2ff21bb968a8e371f11dc4ba47b94a768
    !2607 【1.8算子适配】round、rsqrt、sqrt
    Merge pull request !2607 from 姚斌/pytorch1.8.1
2021-10-22 23:00:57 +08:00
ZijunYin af726a697e update en docs. 2021-10-22 17:30:59 +08:00
AtlasAccount afa8699efc 同步1.5.0 7508158b533e4974558a4e72653917aa45d694c3
同步1.8.1 c3e7e61c49a22e7564a914ec70ea3e37d99adef0
2021-10-22 00:58:31 +08:00
AtlasAccount 89f71305c3 同步1.5.0 7508158b533e4974558a4e72653917aa45d694c3
!2598 add Enqueue profiling
    Merge pull request !2598 from 蒋荣强/queue
同步1.8.1 c3e7e61c49a22e7564a914ec70ea3e37d99adef0
2021-10-21 12:00:46 +08:00
AtlasAccount 2bd42a661f 同步1.5.0 46cd8d05f7f053fd22ccf4d1d35ff0ae881b071f
同步1.8.1 c3e7e61c49a22e7564a914ec70ea3e37d99adef0
2021-10-20 23:05:13 +08:00
AtlasAccount 88cbcb90dd 同步1.5.0 46cd8d05f7f053fd22ccf4d1d35ff0ae881b071f
!2590 Add Version + 1
    Merge pull request !2590 from 周司南/master
--
    !2570 ifdef 和 if defined 不能混用
    Merge pull request !2570 from shibo/bug_fix
--
    Merge pull request !2593 from weili10/revert-merge-2554-master
--
    Merge pull request !2592 from weili10/revert-merge-2584-master
--
    !2587 [dump utils]fix compile error
    Merge pull request !2587 from lijing/master
同步1.8.1 c3e7e61c49a22e7564a914ec70ea3e37d99adef0
    !2582 【1.8算子迁移】thnn_conv2d_forward重构
    Merge pull request !2582 from 吴贤坤/thnn_conv_1.8
--
    !2581 【1.8算子迁移】Upsample部分
    Merge pull request !2581 from 吴贤坤/up3d_1.8
--
    !2579 1.8.1算子适配 cross
    Merge pull request !2579 from 王晓/1.8_cross
2021-10-20 16:04:06 +08:00
AtlasAccount 706b56bf41 同步1.5.0 0178176bcf5feb64a463ee5eea17e15e30acd60f
!2586 【dump utils】修复当tensor某些维度为0时load报错问题
    Merge pull request !2586 from lijing/master
同步1.8.1 1e37554a67274f6244ece6522a8ba7a5888c426e
    !2495 【pytorch1.8适配】Where、Resize、Norm、Pow适配
    Merge pull request !2495 from 陈庆/pytorch1.8.1
--
    !2577 【1.8算子迁移】col2im等
    Merge pull request !2577 from 吴贤坤/colim_1.8
--
    !2574 pytorch1.8 pprofiling功能
    Merge pull request !2574 from shibo/profiler_update
2021-10-19 12:02:15 +08:00
AtlasAccount 5f1e9f8cc8 同步1.5.0 9305e2ee100c65f034ef8d0128d3c4b2faa40c29
同步1.8.1 71641840df36c327d5400f22bbdc02d825bee026
2021-10-18 12:00:49 +08:00
AtlasAccount 4317ec1bca 同步1.5.0 9305e2ee100c65f034ef8d0128d3c4b2faa40c29
同步1.8.1 71641840df36c327d5400f22bbdc02d825bee026
2021-10-17 12:00:56 +08:00
i-robot ace7ba9a8b !76 update image in Installation Guide
Merge pull request !76 from yinzijun/master
2021-10-15 10:30:49 +00:00
weili10 8dc400cd8a update README.zh.md. 2021-10-15 10:06:20 +00:00
ZijunYin f2c1df9134 update image in docs/en/PyTorch Installation Guide 2021-10-15 17:52:30 +08:00
i-robot 728b16d171 !74 update English docs
Merge pull request !74 from yinzijun/master
2021-10-15 09:36:48 +00:00
ZijunYin 6285b3b60f Merge branch 'master' of https://gitee.com/yinzijun/pytorch 2021-10-15 17:22:45 +08:00
ZijunYin 1017d89d57 update English docs. 2021-10-15 17:22:34 +08:00
AtlasAccount 424de74a3a 同步1.5.0 7682920856d82fcc09bd1806585cf042a5a99b3b
!2584 solve accuracy problem due to adding async copy to queue
    Merge pull request !2584 from 蒋荣强/master
同步1.8.1 82054017ffd27967cfd4224f6142fdaf23000b5b
    !2566 1.8.1适配“mseloss, avgpool2d, avgpool3d”
2021-10-15 12:01:11 +08:00
AtlasAccount 7e05a39e42 同步1.5.0 da42cdf6867c2e854c21278dbf0ca135e036beb4
!2573 modify scalar input to host memory input
    Merge pull request !2573 from 蒋荣强/scalar
同步1.8.1 290416bb037a6ca8168f266e5f0ad547f2b5afc5
    !2575 1.8.1“float_status”
    Merge pull request !2575 from 李攀/do_1.8.1
2021-10-14 12:00:53 +08:00
i-robot 24bfeaa78c !72 更新readme
Merge pull request !72 from shibo/update_readme
2021-10-13 09:30:49 +00:00
AtlasAccount 47e8fac4ae 同步1.5.0 86ce2266c01b28e46d42f1c34c81f73a70e238cf
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-13 12:01:01 +08:00
AtlasAccount c916024ec7 同步1.5.0 86ce2266c01b28e46d42f1c34c81f73a70e238cf
!2563 适配silu正反向算子
    Merge pull request !2563 from 王夏夏/master
--
    !2569 solve codex problem
    Merge pull request !2569 from 蒋荣强/master
--
    !2567 fix codexbug
    Merge pull request !2567 from 周司南/master
--
    !2568 修复codedex告警
    Merge pull request !2568 from 詹隽/mm_nd_dev
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-12 12:00:58 +08:00
AtlasAccount 710ce99fa7 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-11 12:00:48 +08:00
shibo19 14f78e1593 update 2021-10-11 11:32:48 +08:00
shibo19 ad48d8f66b update 2021-10-11 11:30:40 +08:00
shibo19 5dee0e68b4 update 2021-10-11 11:29:04 +08:00
AtlasAccount 20034c4f3b 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-10 12:01:13 +08:00
i-robot ecd705896a !70 update RELEASENOTE with 2.0.2
Merge pull request !70 from yinzijun/master
2021-10-09 10:11:51 +00:00
ZijunYin a1297c462f update RELEASENOTE.md 2021-10-09 17:53:59 +08:00
yinzijun 04e467e6c2 !69 update README
Merge pull request !69 from liuquan/master
2021-10-09 08:43:04 +00:00
刘全 33a911c624 update docs/zh/RELEASENOTE/RELEASENOTE.md. 2021-10-09 07:20:02 +00:00
yinzijun 14bd359387 !65 add releasenote
Merge pull request !65 from yinzijun/master
2021-10-09 07:03:12 +00:00
AtlasAccount 52701635fa 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-09 12:01:54 +08:00
ZijunYin f8028e788f add RELEASENOTE.md 2021-10-09 09:54:11 +08:00
weili10 2e5af37b40 update README.zh.md. 2021-10-09 01:12:54 +00:00
AtlasAccount 472a02ee7b 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-08 12:01:05 +08:00
AtlasAccount 03077bc002 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-07 12:00:48 +08:00
AtlasAccount 8027eddae2 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-06 12:01:02 +08:00
AtlasAccount 4e12aed2c4 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-05 12:01:05 +08:00
AtlasAccount d60a312292 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-04 12:01:10 +08:00
AtlasAccount ed5baac37f 同步1.5.0 2d8899df9adbfe0234c5d913dff8a8fddee61ada
!2554 add AsyncMemcpy to queue
    Merge pull request !2554 from 蒋荣强/fuzzy
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-10-03 12:00:54 +08:00
yinzijun d3fca1bddd !63 update docs 2.0.3.B090
Merge pull request !63 from yinzijun/master
2021-09-30 07:15:55 +00:00
ZijunYin 4082c74535 update docs/zh/PyTorch API支持清单/PyTorch API支持清单.md & docs/zh/PyTorch网络模型移植&训练指南/PyTorch网络模型移植&训练指南.md 2021-09-30 15:02:46 +08:00
ZijunYin 7b0b8cc5b9 update docs 2.0.3.B090 2021-09-30 14:41:32 +08:00
AtlasAccount bd49e63f36 同步1.5.0 a4dfab7869d894d1f2a3629463f1aed4b63bec1b
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-30 12:31:03 +08:00
AtlasAccount c47ca17bee 同步1.5.0 a4dfab7869d894d1f2a3629463f1aed4b63bec1b
!2560 【BugFix】修复输入shape不一致,算子侧未broadcast,导致不支持
    Merge pull request !2560 from 姚斌/master
--
    !2557 modify: 去除UT中1维NZ格式的用例
    Merge pull request !2557 from 郭夏/ut_modify
--
    !2555 修复IOU输出数据类型转换
    Merge pull request !2555 from 李攀/bugfix
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-29 12:01:07 +08:00
AtlasAccount 6e78d9b798 同步1.5.0 f9ff07a2aef09f4901025c8375dfcb4157fe38e0
!2551 add fuzzy flag to queue
    Merge pull request !2551 from 蒋荣强/fuzzy
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-28 12:00:45 +08:00
AtlasAccount 325e0c9686 同步1.5.0 6ee40447c11dc17c5f58d7fcad9ae9f1a078057e
!2552 修复load模式时conv2d反向dump结果ir_name被覆盖的问题
    Merge pull request !2552 from gaokai21/master
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-27 20:58:36 +08:00
AtlasAccount 8b46a4fa68 同步1.5.0 68aca6bc147877979b06059240f3f246f0625a07
!2477 [contrib/npu/optimized_lib/] 修复iou和bbox_coder在输入经过归一化时精度下降的问题
    Merge pull request !2477 from 王姜奔/20210903
--
    !2456 [contrib/npu/optimized_lib/] fix import bug in __init__
    Merge pull request !2456 from 王姜奔/master
--
    !2543 修复maxunpool2dbackward执行报错
    Merge pull request !2543 from 李攀/bugfix
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-27 12:00:48 +08:00
863 changed files with 43459 additions and 78282 deletions
+6 -6
View File
@@ -18,6 +18,7 @@
- 在[Gitee](https://gitee.com/ascend/pytorch)上Fork存储库。
- 阅读[README.md](#https://gitee.com/ascend/pytorch/blob/master/README.zh.md)以获取项目信息和构建说明。
- 行为准则 [coc](https://gitee.com/ascend/community/blob/master/code-of-conduct_zh_cn.md)。
<h2 id="开发指导.md">开发指导</h2>
@@ -98,7 +99,7 @@
2. 设置环境变量。
进入“pytorh/src“路径,并执行env.sh脚本。
进入"pytorch/src"路径,并执行env.sh脚本。
```
bash env.sh
@@ -119,11 +120,11 @@
- 编码指南
请在PyTorch社区使用规统一的编码分格,_Python__中_建议的编码风格是[PEP 8编码样式](https://pep8.org/),_C++_编码所建议的风格是 [Google C++编码指南](http://google.github.io/styleguide/cppguide.html) 。可以使用[CppLint](https://github.com/cpplint/cpplint),[CppCheck](http://cppcheck.sourceforge.net/),[CMakeLint](https://github.com/cmake-lint/cmake-lint),[CodeSpell](https://github.com/codespell-project/codespell), [Lizard](http://www.lizard.ws/),[ShellCheck](https://github.com/koalaman/shellcheck)和[pylint](https://pylint.org/)检查代码的格式,建议在您的IDE中安装这些插件。
请在PyTorch社区使用规统一的编码分格,python建议的编码风格是[PEP 8编码样式](https://pep8.org/),C++编码所建议的风格是 [Google C++编码指南](http://google.github.io/styleguide/cppguide.html) 。可以使用[CppLint](https://github.com/cpplint/cpplint),[CppCheck](http://cppcheck.sourceforge.net/),[CMakeLint](https://github.com/cmake-lint/cmake-lint),[CodeSpell](https://github.com/codespell-project/codespell), [Lizard](http://www.lizard.ws/),[ShellCheck](https://github.com/koalaman/shellcheck)和[pylint](https://pylint.org/)检查代码的格式,建议在您的IDE中安装这些插件。
- 单元测试指南
请在PyTorch社区使用统一的单元测试风格, _Python_中建议的单元测试风格是[pytest](http://www.pytest.org/en/latest/),_C++_单元测试所建议的风格是 [Googletest Primer](#https://github.com/google/googletest/blob/master/docs/primer.md) 。测试用例的设计意图应该通过它的注释名称来反映。
请在PyTorch社区使用统一的单元测试风格, Python中建议的单元测试风格是[pytest](http://www.pytest.org/en/latest/),C++单元测试所建议的风格是 [Googletest Primer](#https://github.com/google/googletest/blob/master/docs/primer.md) 。测试用例的设计意图应该通过它的注释名称来反映。
- 重构指南
@@ -165,7 +166,7 @@
3. 本地开发代码。
为了避免多个分支之间的不一致,建议签出到一个新的分支:
为了避免多个分支之间的不一致,建议创建新的分支进行开发:
```
git checkout -b {new_branch_name} origin/master
@@ -185,7 +186,7 @@
git push origin {new_branch_name}
```
5. 向 PyTorh存储库拉取请求。
5. 向 PyTorch存储库拉取请求。
在最后一步中,您需要在新分支和“PyTorch master“分支之间拉取比较请求。完成拉取请求后,“Jenkins CI“将自动设置为构建测试。您的pull request应该尽快合并到上游 master 分支,以降低合并的风险。
@@ -224,4 +225,3 @@
- 确保你的提交历史被排序。
- 始终将您的分支与主分支保持一致。
- 对于错误修复 PR,请确保链接所有相关问题。
+3 -2
View File
@@ -1,6 +1,7 @@
approvers:
- blian
- nalinaly
- weili10
reviewers:
- zhou_sinan
- shibo19
@@ -14,6 +15,6 @@ reviewers:
- yskhhh
- lvpeiyuan
- xchu42
- weili10
- goodjobwubai
- fairwarning
- fairwarning
- yinzijun
+278
View File
@@ -0,0 +1,278 @@
# AscendPyTorch
# Project Introduction
This project develops the PyTorch Adapter plugin to adapt Ascend to the PyTorch framework so that developers who use the PyTorch framework can obtain powerful compute capabilities of Ascend AI Processors.
# Compilation/Execution Constraints
GCC version: 7.3.0 (required only in compilation scenarios)
CMake version: 3.12.0 or later (required only in compilation scenarios)
Python versions: 3.7.5 and 3.8.*x* (The compilation methods are different. For details, see the script compilation section.)
# System Dependencies
## CentOS & EulerOS
yum install -y cmake zlib-devel libffi-devel openssl-devel libjpeg-turbo-devel gcc-c++ sqlite-devel dos2unix openblas
## Ubuntu
apt-get install -y gcc g++ make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev m4 cmake dos2unix libopenblas-dev
# Ascend Auxiliary Software
| AscendPyTorch Version| CANN Version| Supported PyTorch Version|
| :---------------- | :--------- | :------------------------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0 |
| 2.0.3 | CANN 5.0.3 | 1.5.0 and 1.8.1 (Only the ResNet-50 model is supported.)|
| 2.0.4 | CANN 5.0.4 | 1.5.0 and 1.8.1 (Only the ResNet-50 model is supported.)|
# Method of Use - Full Code Generation and Compilation
## Obtain the native PyTorch source code and third-party code.
Currently, PyTorch 1.5.0 and 1.8.1 are supported. Obtain the native PyTorch source code from the root directory **pytorch/** in the current repository as required.
```sh
git clone https://gitee.com/ascend/pytorch.git
# By default, the masterf branch is used. If other branches are required, run the git checkout command to switch to that branch.
cd pytorch
git checkout -b 2.0.4.tr5 remotes/origin/2.0.4.tr5
```
Obtain the native PyTorch source code from the root directory **/pytorch** of the current repository.
```sh
// Version 1.5.0
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
// Version 1.8.1
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
```
Go to the **pytorch/pytorch/** directory and obtain the passive dependency code of PyTorch. (It takes a long time to obtain the code.)
```sh
cd pytorch
git submodule sync
git submodule update --init --recursive
```
If no error is reported after the preceding operations are complete, the PyTorch and third-party code on which PyTorch depends is generated.
## Generate the PyTorch code adapted to Ascend AI Processors.
Go to the **pytorch/scripts** directory and run the script based on the selected version. (Note: The downloaded native PyTorch source code must match the following version. Otherwise, an error may occur.)
```sh
cd ../scripts
// The default version is 1.5.0.
bash gen.sh
// For version 1.8.1, use the -v option to specify the version number.
bash gen.sh -v 1.8.1
```
The full code adapted to NPUs is generated in the **pytorch/pytorch/** directory.
## Install the Python dependency.
Go to the **pytorch/pytorch/** directory and install the Python dependency.
```python3
cd ../pytorch
pip3 install -r requirements.txt
```
## Compile the binary package of Torch.
Go to the **pytorch/pytorch/** directory and run the following command:
```sh
# Python 3.7
bash build.sh
or
bash build.sh --python=3.7 (recommended)
# Python 3.8
bash build.sh --python=3.8
```
The generated binary package is in the **pytorch/pytorch/dist/** directory.
# Installation
### (Version 1.5.0 is used as an example. The same rule applies to version 1.8.1.)
**x86_64:**
**torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl** (The actual name may contain the minor version number, for example, **torch-1.5.0.post2+ascend-cp37-cp37m-linux_x86_64.whl**.)
```shell
cd dist
pip3 uninstall torch
pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl
```
**arm:**
**torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl** (The actual name may contain the minor version number, for example, **torch-1.5.0.post2+ascend-cp37-cp37m-linux_aarch64.whl**.)
```shell
cd dist
pip3 uninstall torch
pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl
```
# Running
## Execute environment variables.
Run the script for setting environment variables in the root directory of the current repository.
```
cd ../
source env.sh
```
## Customize environment variables.
The following environment variables are function classes used in NPU scenarios or environment variables that can improve performance:
```
export TASK_QUEUE_ENABLE=1 # Delivered by an asynchronous task to asynchronously call the ACL interface. You are advised to enable this environment variable and set its value to 1 when there is a bottleneck in the delivery of tasks.
export PTCOPY_ENABLE=1 # Use the PTCopy operator mode to accelerate continuous rotation and copy. You are advised to enable this environment variable and set its value to 1.
```
The following are optional environment variables that may affect running models:
```
export DYNAMIC_COMPILE_ENABLE=1 # Dynamic shape feature. This environment variable is optional for shape change scenarios. To enable it, set its value to 1.
export COMBINED_ENABLE=1 # Optimization of scenarios where two inconsecutive operators are combined. This environment variable is optional. To enable it, set its value to 1.
export TRI_COMBINED_ENABLE=1 # Optimization of scenarios where three inconsecutive operators are combined. This environment variable is optional. To enable it, set its value to 1.
export ACL_DUMP_DATA=1 # Operator data dump function, which is used for debugging. This environment variable is optional. To enable it, set its value to 1.
export DYNAMIC_OP="ADD#MUL" # Operator implementation. The ADD and MUL operators have different performance in different scenarios. This environment variable is optional.
```
## Run the unit test script.
Verify the execution. The output result is OK.
```shell
// Select a test script that matches the preceding version. The following uses the 1.5.0 version as an example.
python3 pytorch1.5.0/test/test_npu/test_network_ops/test_div.py
// The following uses the 1.8.1 version as an example.
python3 pytorch1.8.1/test/test_npu/test_network_ops/test_div.py
```
# Documentation
For more details about the installation guide, model porting and training/inference tutorials, and API list, see [User Documents](https://gitee.com/ascend/pytorch/tree/master/docs/en).
# Suggestions and Communication
We sincerely welcome you to join discussions in the community and contribute your suggestions. We will reply to you as soon as possible.
# Branch Maintenance Policies
The version branches of AscendPyTorch have the following maintenance phases:
| **Status**| **Duration**| **Description**|
| ----------------- | ------------- | -------------------------------------------------- |
| Planning | 1 - 3 months | Plan features.|
| Development | 3 months | Develop features.|
| Maintained | 6 - 12 months | Allow the incorporation of all resolved issues and release the version.|
| Unmaintained | 0 - 3 months | Allow the incorporation of all resolved issues. No dedicated maintenance personnel are available. No version will be released.|
| End Of Life (EOL) | N/A | Do not accept any modifications to a branch. |
# Maintenance Status of Existing Branches
| **Branch Name**| **Status**| **Launch Date**| **Subsequent Status**| **EOL Date**|
| ---------- | ------------ | ------------ | -------------------------------------- | ------------ |
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
| **v2.0.3** | Maintained | 2021-10-15 | Unmaintained <br> 2022-10-15 estimated | |
| **v2.0.4** | Maintained | 2022-11-15 | Unmaintained <br> 2023-01-15 estimated | |
# FAQs
## The error message "no module named yaml/typing_extensions." is displayed when **bash build.sh** is run during compilation.
PyTorch compilation depends on the YAML and typing_extensions libraries, which need to be manually installed.
```
pip3 install pyyaml
pip3 install typing_extensions
```
After the installation is successful, run **make clean** and then **bash build.sh** to perform compilation. Otherwise, an unknown compilation error may occur due to the cache.
## TE cannot be found during running
Development state:
```
cd /urs/local/Ascend/ascend-toolkit/latest/{arch}-linux/lib64
```
User state:
```
cd /urs/local/Ascend/nnae/latest/{arch}-linux/lib64
pip3 install --upgrade topi-0.4.0-py3-none-any.whl
pip3 install --upgrade te-0.4.0-py3-none-any.whl
```
## An error message is reported during CMake compilation, indicating that the version is too early.
Download the Linux version from the CMake official website and install it. (The current version is 3.18.0.)
1. Run the **yum install -y cmake==3.18.0** command to install it.
2. Download the **cmake sh** script and install it. (For details, see the CMake official website.)
Recommended script in the x86_64 environment: **cmake-3.18.2-Linux-x86_64.sh**
## GCC version switch errors occur.
When the test environment is switched from GCC 4.8.5 to GCC 7.3.0, errors may occur and the PyTorch compilation may fail. The following lists the libraries that require soft connections:
gcc, g++, c++ (The version must be 7.3.0.)
libstdc++->libstdc++.so.6.0.24 (7.3.0)
## libblas.so cannot be found.
The OpenBLAS library is missing in the environment. You need to install it.
CentOS and EulerOS
```sh
yum -y install openblas
```
Ubuntu
```sh
apt install libopenblas-dev
```
# Release Notes
For details, see [Release Notes](https://gitee.com/ascend/pytorch/tree/master/docs/en/RELEASENOTE).
+26 -11
View File
@@ -29,19 +29,27 @@ apt-get install -y gcc g++ make build-essential libssl-dev zlib1g-dev libbz2-dev
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 |
| :------------ | :----------- | :----------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0 |
| 2.0.3 | CANN 5.0.3 | 1.5.0,1.8.1(仅支持resnet50模型) |
| 2.0.3 | CANN 5.0.3 | 1.5.0,1.8.1(仅支持resnet50模型) |
| 2.0.4 | CANN 5.0.4 | 1.5.0,1.8.1(仅支持resnet50模型) |
# 使用方式 --生成全量代码并编译
## 获取适配昇腾AI处理器的PyTorch源代码patch
获取适配昇腾AI处理器的PyTorch源代码(即当前仓库代码),并切换到所需的分支。
```
git clone https://gitee.com/ascend/pytorch.git
# 默认是master分支,若需要其他分支请使用git checkout 命令切换
cd pytorch
git checkout -b 2.0.4.tr5 remotes/origin/2.0.4.tr5
```
## 获取原生PyTorch源代码和third_party代码
当前支持pytorch 1.5.0和1.8.1的版本。根据需求,在当前仓库根目录pytorch/下获取原生PyTorch的源代码
```sh
//昇腾Pytorch
git clone -b 2.0.3.tr5 https://gitee.com/ascend/pytorch.git
cd pytorch
// 1.5.0 版本
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
// 1.8.1 版本
@@ -51,17 +59,19 @@ git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
进入到pytorch/pytorch/目录下, 获取PyTorch被动依赖代码(获取时间较长,请耐心等待)。
```sh
cd pytorch
git submodule sync
git submodule update --init --recursive
```
完成且没有报错之后就生成了PyTorch及其依赖的三方代码
## 生成适配昇腾AI处理器的PyTorch代码。
## 生成适配昇腾AI处理器的PyTorch全量代码。
进入到pytorch/scripts目录,根据选择的版本执行,执行脚本(注意:下载原生Pytorch源代码和下面版本要对应,否则可能出错)
```sh
cd ../scripts/
// 默认为1.5.0版本
bash gen.sh
// 对于1.8.1版本,则通过-v 参数指定
@@ -76,6 +86,7 @@ bash gen.sh -v 1.8.1
进入到pytorch/pytorch/目录,依赖库安装:
```python3
cd ../pytorch/
pip3 install -r requirements.txt
```
@@ -105,6 +116,7 @@ bash build.sh --python=3.8
torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl (实际可能附带小版本号例如torch-1.5.0.post2+ascend-cp37-cp37m-linux_x86_64.whl)
```shell
cd dist/
pip3 uninstall torch
pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl
```
@@ -115,6 +127,7 @@ pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl
torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl (实际可能附带小版本号例如torch-1.5.0.post2+ascend-cp37-cp37m-linux_aarch64.whl)
```shell
cd dist/
pip3 uninstall torch
pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl
```
@@ -127,6 +140,7 @@ pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl
在当前仓库根目录中执行设置环境变量脚本
```
cd ../
source pytorch/env.sh
```
@@ -136,7 +150,7 @@ source pytorch/env.sh
以下环境变量为NPU场景下使用的功能类或可以提升性能的环境变量:
```
export TASK_QUEUE_ENABLE=1 # 使用异步任务下发,异步调用acl接口,建议默认开启,开启设置为1
export TASK_QUEUE_ENABLE=1 # 使用异步任务下发,异步调用acl接口,主机侧任务下发出现瓶颈时建议开启,开启设置为1
export PTCOPY_ENABLE=1 # 使用PTCopy算子模式,加速转连续及copy等过程,建议默认开启,开启设置为1
```
@@ -157,9 +171,9 @@ export DYNAMIC_OP="ADD#MUL" # 算子实现,ADD和MUL算子在不同场景下
```shell
// 根据前述版本,选择对应的测试脚本,以下为1.5.0版本
python3 pytorch1.5.0/test/test_npu/test_div.py
python3 pytorch1.5.0/test/test_npu/test_network_ops/test_div.py
// 以下为1.8.1版本
python3 pytorch1.8.1/test/test_npu/test_div.py
python3 pytorch1.8.1/test/test_npu/test_network_ops/test_div.py
```
# 文档
@@ -188,6 +202,7 @@ Ascend PyTorch的版本分支有以下几种维护阶段:
|------------|--------------|----------------------|----------------------------------------|------------|
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
| **v2.0.3** | Maintained | 2021-10-15 | Unmaintained <br> 2022-10-15 estimated | |
| **v2.0.4** | Maintained | 2022-01-15 | Unmaintained <br> 2023-01-15 estimated | |
# FAQ
@@ -205,11 +220,11 @@ pip3 install typing_extensions
开发态:
cd /urs/local/ascend-toolkit/latest/fwkacllib/lib64
cd /urs/local/Ascend/ascend-toolkit/latest/{arch}-linux/lib64
用户态:
cd /urs/local/nnae/latest/fwkacllib/lib64
cd /urs/local/Ascend/nnae/latest/{arch}-linux/lib64
pip3 install --upgrade topi-0.4.0-py3-none-any.whl
@@ -0,0 +1,900 @@
# Overview
Users can obtain PyTorch training models from Ascend ModelZoo, but the models do not support multi-server multi-device training. You need to modify the models based on the actual model code. This document describes how to quickly train a PyTorch model in Distributed Data Parallel (DDP) mode in multi-server multi-device scenario.
# Training Workflow
The process of training a PyTorch model in multi-server multi-device scenario includes environment preparation, model preparation, model modification, and training startup.
1. Environment Preparation
Prepare the software, hardware, and network environment for multi-server multi-device training, including setting up the development and operating environment, connecting the cluster network, setting the processor IP address, and setting the firewall.
2. Model Preparation
Prepare a PyTorch model, data loader, and optimizer for training. You can download them from the open source community (https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch) or prepare them by yourself.
3. Model Modification
Modify the basic model and add the code and environment variables required by DDP to enable the multi-server multi-device training.
4. Training Startup
Start model training in the multi-server multi-device scenario and view training logs.
# Quick Start
## Overview
The example presented in this document helps you quickly understand how a PyTorch model is trained in multi-server multi-device scenario. The example uses a custom model for training in two-computer eight-device scenario. The two computers are named AI Server0 and AI Server1. The eight Ascend 910 Processors on each computer are named device0 to device7.
## Preparing the Environment
At least two computers with Ascend 910 Processors installed are required, and the NPU firmware and driver are correctly installed on each computer.
1. Prepare the development and operating environment on each computer.
- Install the CANN development and operating environment. For details, see the *CANN Software Installation Guide*. Use CANN later than 5.0.3.
- Install the PyTorch that adapts to NPU. For details, see the *PyTorch Installation Guide*.
2. Prepare the network.
Set up the network by directly connecting switches or optical ports. For details, see the *Ascend Data Center Solution Networking Guide* at https://support.huawei.com/enterprise/en/doc/EDOC1100221995/229cc0e4.
In this example, two computers with eight devices are used for training, so optical ports are used for network connection.
3. Configure the device IP address.
Configure the device IP address on AI Server0.
```shell
hccn_tool -i 0 -ip -s address 192.168.100.101 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.101 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.101 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.101 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.100 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.100 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.100 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.100 netmask 255.255.255.0
```
Configure the device IP address on AI Server1.
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.111 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.111 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.111 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.110 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.110 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.110 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.110 netmask 255.255.255.0
```
4. Configure the firewall.
- Command for disabling the firewall on Ubuntu:
```shell
ufw disable
```
```
- Command for disabling the firewall on Red Hat or CentOS 7:
```shell
systemctl stop firewalld
```
## Preparing a Model
This example creates a simple model for you to quickly understand multi-server multi-device training. You can also obtain the Ascend NPU-based PyTorch training model from the open source community (https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch).
1. Prepare a DDP model.
The following is an example of main.py for multi-server multi-device training.
```python
import argparse
import os
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
### 1. Perform basic operations. ###
# Build a model.
class ToyModel(nn.Module):
def __init__(self):
super(ToyModel, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 16 * 5 * 5)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x
# Obtain a dataset.
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
### 2. Initialize the parameters, data, model, loss function, and optimizer. ####
# Obtain local_rank and addr.
parser = argparse.ArgumentParser()
parser.add_argument("--local_rank", default=-1, type=int)
parser.add_argument("--addr", default='127.0.0.1', type=str, help='master addr')
FLAGS = parser.parse_args()
local_rank = FLAGS.local_rank
addr = FLAGS.addr
# Set the IP address and port of the master node.
os.environ['MASTER_ADDR'] = addr
os.environ['MASTER_PORT'] = '29501'
# Initialize the DDP backend.
loc = 'npu:{}'.format(local_rank)
torch.npu.set_device(loc)
dist.init_process_group(backend='hccl') # HCCL is the backend of the NPU device.
# Prepare data after DDP initialization.
trainloader = get_dataset()
# Instantiate the model.
model = ToyModel().to(loc)
# Load the model weight. The weight needs to be loaded only on the master node before the DDP model is built.
ckpt_path = None
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# Build the DDP model.
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
# Initialize the optimizer. After the DDP model is built, use the model to initialize the optimizer.
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# Initialize the loss function.
loss_func = nn.CrossEntropyLoss().to(loc)
### 3. Train the network.
model.train()
iterator = range(100)
for epoch in iterator:
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. Similar to the DP mode, when you save a model, note that model.module instead of model is saved.
# That is because the model actually refers to a DDP model, and the parameters are packaged by `model=DDP(model)`.
# 2. You only need to save the model on process 0 once to avoid repeated saving.
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
2. Ensure that the model is correct for training in the single-server multi-device scenario.
1. The Python third-party library is required if you install the model script yourself.
2. Configure NPU environment variables. For information about the **env_npu.sh** script, see the appendix.
```shell
source env_npu.sh
```
3. Execute **torch.distributed.launch** to run the following main.py command to train a model in single-server multi-device scenario.
```shell
python -m torch.distributed.launch --nproc_per_node 8 main.py
```
`--nproc_per_node` indicates the number of training cards.
After the command is run successfully, the model is trained on the eight NPUs of the device.
## Modifying the Model
The example provided in "Quick Start" is adapted to the multi-server multi-device training. You do not need to modify the script. For details about how to modify other models, see section "Multi-server Multi-device Training".
## Starting the Training
1. Upload main.py model script to any directory on AI Server0 and AI Server1.
2. Query the host IP addresses of the servers.
```shell
hostname -I
```
All IP addresses are displayed, and the first IP address is the host IP address of the current server.
For example, the host IP address of AI Server0 is **192.168.*xx*.22**, and that of AI Server1 is **192.168.*xx*.23**.
3. Use AI Server0 as the master node, and start the 2 x 8 cluster.
Startup commands for AI Server0:
```shell
# Set environment variables. Obtain the env_npu.sh script content from the appendix.
source env_npu.sh
# Disable the trustlist of HCCL channel.
export HCCL_WHITELIST_DISABLE=1
# Initialize the IP address of the HCCL communication NIC, and set the IP address to the host IP address of the current server.
export HCCL_IF_IP=192.168.xx.22
#
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=0 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
Startup commands for AI Server1:
```shell
# Set environment variables. Obtain the env_npu.sh script content from the appendix.
source env_npu.sh
# Disable the trustlist of HCCL channel.
export HCCL_WHITELIST_DISABLE=1
# Initialize the IP address of the HCCL communication NIC, and set the IP address to the host IP address of the current server.
export HCCL_IF_IP=192.168.xx.23
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=1 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
Parameter description:
--nnode: specifies the number of nodes used for distributed training scripts.
--node_rank: specifies the rank of the current node during multi-node distributed training.
--nproc_per_node: specifies the number of GPU-based training processes on the current node.
--master_addr: address of the master node (rank is 0). The value can be the IP address or the host name of node 0.
--master_port: specifies the port number used by the master node during distributed training.
--addr: input parameter of the main.py script, specifying the host IP address of the master node.
3. View the host logs.
Host logs are stored in the `~/ascend/log` directory. You can go to this directory to view the device logs of each host.
# Multi-server Multi-device Training
## Common Concepts and Parameters
Basic concepts for PyTorch distributed training
| Basic Concept | Description |
| :-----------: | ------------------------------------------------------------ |
| AI Server | Computer with an Ascend 910 Processors. Multiple computers are identified as AI Server +serial number, for example, AI Server0 and AI Server1. |
| device | Ascend 910 Processors on the AI server. Multiple processors are represented as device 0, device 1, ..., and device 7. |
| host | AI server host. |
| master | Select one of multiple AI servers as the master node for data communication. |
| group | Process group. By default, there is only one group. Use the default value. |
| world size | Number of global parallel processes, which can be obtained by running **torch.distributed.get_world_size()**. The value is the same for different processes. |
| rank | Sequence number of the current process, which is used for communication between processes. For example, for a 2 x 8 cluster, the **world size** is 16, and the rank in each process is [0, 1, 2, ..., 15]. |
| local_rank | Sequence number of processes on each host, for example, there are processes 0-7 on each host. Generally, **local_rank** is used to set the GPU/NPU on which the current model runs. |
Parameters for executing **torch.distributed.launch** to start multi-device training
| Parameter | Description |
| ------------------ | ------------------------------------------------------------ |
| **nnodes** | Specifies the number of nodes used for distributed training scripts. |
| **node_rank** | Specifies the rank of the current node during multi-node distributed training. |
| **nproc_per_node** | Specifies the number of GPU-based training processes on the current node. You are advised to set this parameter to the number of GPUs on the current node. In this way, each process can independently control a GPU to achieve the highest efficiency. |
| **master_addr** | Address of the master node (rank is 0). The value can be the IP address or the host name of node 0. For single-node multi-process training, set this parameter to **127.0.0.1**. |
| **master_port**: | Specifies the port number used by the master node during distributed training. The port number must be different from the port numbers of other applications. |
## Multi-server Multi-device Training Process
### Preparing the Environment
At least two computers with Ascend 910 Processors installed are required, and the NPU firmware and driver are correctly installed on each server.
1. Prepare the development and operating environment on each computer.
- Install the CANN development and operating environment. For details, see the *CANN Software Installation Guide*. Use CANN later than 5.0.3.
- Install the PyTorch that adapts to NPU. For details, see the *PyTorch Installation Guide.*
2. Prepare the network.
Cluster training is completed by multiple computers (a maximum of 128) with Ascend 910 Processors installed. The computers need to work with switches to form a fully-connected active/standby network on the data plane. The 8 x *n*-device training is supported. Two computers can be directly connected through optical ports. For details, see the *Ascend Data Center Solution Networking Guide * at https://support.huawei.com/enterprise/en/doc/EDOC1100221995/229cc0e4.
3. Configure the device IP address.
Use hccn_tool to configure the device IP address. hccn_tool is provided by CANN.
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
```
Observe the following rules when configuring the device IP address:
1. On the AI servers, devices 0/4, 1/5, 2/6, and 3/7 must be in the same network segment. But devices 0, 1, 2, and 3 must be in different network segments, and devices 4, 5, 6, and 7 must be in different network segments.
2. In the cluster scenario, the devices corresponding to each AI server must be in the same network segment. NICs 0 and 1 of AI Server0 and AI Server1 must be in the same network segment.
3. Each IP address must be unique. IP addresses in the same network segment must be distinguished by the last eight bits.
Use hccn_tool to check whether the device IP address is correct.
- Query the IP address of each device.
```shell
hccn_tool -i 0 -ip –g
```
The IP addresses are displayed:
> ipaddr:192.168.100.101
>
> netmask:255.255.255.0
- Use hccn_tool to ensure that the devices of the two hosts are correctly connected by performing the test for eight times from device0 to devcie7.
```shell
hccn_tool -i 0 -netdetect -s address xx.xx.xx.xx
hccn_tool -i 0 -net_health –g
```
**-i**: device ID.
**-s address**: ***xx.xx.xx.xx*** is the IP address of device *i* on the other host.
If `success` is returned, the connection is successful.
4. Configure the firewall.
During HCCL communication, the firewall may intercept the communication port, causing communication timeout. Therefore, you need to disable the firewall on the server for PyTorch cluster training.
- Command for disabling the firewall on Ubuntu:
```shell
ufw disable
```
- Command for disabling the firewall on Red Hat or CentOS 7:
```shell
systemctl stop firewalld
```
### Preparing a Model
There are two methods for preparing a model.
- Download a PyTorch training model from the open source community (https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch).
The model obtained from the open source community supports single-server multi-device training. Modify the model based on the related parameters described in section "Modifying the Model".
- Manually build a PyTorch training model.
1. Prepare a PyTorch training model and data loader.
Prepare a PyTorch model:
```python
class ToyModel(nn.Module):
def __init__(self):
...
def forward(self,x):
...
```
Prepare data:
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(my_trainset,batch_size=16,)
return trainloader
trainloader=get_dataset()
```
2. Instantiate the model.
```python
# Instantiate the model.
model = ToyModel().to(loc)
# Load the model weight
if ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
```
3. Prepare the loss function and optimizer.
```python
# Initialize the optimizer. After the DDP model is built, use the model to initialize the optimizer.
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# Initialize the loss function.
loss_func = nn.CrossEntropyLoss().to(loc)
```
4. Train the model.
```python
### 3. Train the network.
model.train()
iterator = range(100)
for epoch in iterator:
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
torch.save(model.state_dict(), "%d.ckpt" % epoch)
```
### Modifying the Model
Modify the IP address and port of the master node, initialize the **distributed ** function, model DDP, data DDP, and optimizer, and modify the DDP model training method based on the initial model code.
1. Set the IP address and port for the master node. In the NPU distributed training, HCCL is used for communication, while in PyTorch, the HCCL communication mechanism that is detected by automatic topology is used. That is, **RANK_TABLE_FLIE** is not required, but the communication depends on the NIC on the host side. Therefore, you need to set environment variables in the code to set the communication NIC.
```python
os.environ['MASTER_ADDR'] = xxx.xxx.xxx.xxx
os.environ['MASTER_PORT'] = 'xxx'
```
**MASTER_ADDR**: Set this parameter to the IP address of the master node in the cluster. (Select any host as the master node.)
**MASTER_PORT**: Set this parameter to the idle port of the master node.
In the model code, the IP address and port number of the master node are generally presented as transferred parameters. In some open-source code, the IP address and port number may be presented as **127.0.0.1**. In this case, you need to modify them.
The preceding variables must be declared before **torch.distributed.init_process_group()** is invoked.
2. Initialize **distributed**.
In PyTorch, `dist.init_process_group(backend='hccl', world_size=world_size, rank=rank)` is used to initialize thread groups. The parameters are described as follows:
`backend`: communication protocol used for distributed training. Only hccl can be used on the NPU.
`world_size`: total number of devices used for training.
`rank`: rank ID of the currently initialized device, that is, the global logical ID.
There are two methods to start multi-device training:
- **torch.distributed.launch**:
```python
import torch.distributed as dist
dist.init_process_group(backend='hccl') # HCCL is the backend of the NPU device.
```
- **mp.spawn**:
```python
import torch.distributed as dist
def main_worker(pid_idx, device_nums_per_node, args):
args.distributed_rank = args.rank * device_nums_per_node + pid_idx
dist.init_process_group(backend=args.dist_backend, world_size=args.distributed_world_size, rank=args.distributed_rank)
```
In the preceding commands:
`pid_idx`: device ID.
`device_nums_per_node`: number of devices on each AI server.
3. Initialize the model DDP.
```python
# Instantiate the model.
model = ToyModel().to(loc)
# Load the model weight. It needs to be loaded only on the master node before the DDP model is built.
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# Build the DDP model.
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
```
4. Initialize the data DDP.
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
trainloader = get_dataset()
```
5. Initialize the loss function and optimizer.
```python
# Initialize the optimizer. After the DDP model is built, use the model to initialize the optimizer.
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# Initialize the loss function.
loss_func = nn.CrossEntropyLoss().to(loc)
```
6. Train the DDP model.
```python
model.train()
iterator = range(100)
for epoch in iterator:
# Set epoch.
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. Similar to the DP mode, when you save a model, note that model.module instead of model is saved.
# That is because the model actually refers to a DDP model, and the parameters are packaged by `model=DDP(model)`.
# 2. You only need to save the model on process 0 once to avoid repeated saving.
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
### Start the Training
The training can be started manually or using the shell script.
- Start the training manually using **torch.distributed.launch**.
1. Configure NPU environment variables. For details, see the **env_npu.sh** script in the appendix.
2. Add environment variables. For multi-server training, add the `HCCL_WHITELIST_DISABLE` and `HCCL_IF_IP` environment variables.
- **HCCL_WHITELIST_DISABLE**: HCCL channel trustlist. The value **1** indicates that the trustlist is disabled.
- **HCCL_IF_IP**: initialized IP address of the HCCL communication NIC. Set it to the IP address of the host NIC IP of the current server.
3. Upload the modified model script to each AI server.
4. Install the required Python library on each AI server.
5. Select an AI server as the master node and query the IP address of each AI server.
6. Run the following commands on each AI server:
```
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
In the preceding commands:
**--nnodes**: number of AI servers used for distributed training scripts.
**--node_rank**: AI server ID.
**--nproc_per_node**: number of devices of each AI server.
**--master_addr**: IP address of the AI server that functions as the master node.
**--master_port**: port number of the AI server that functions as the master node.
**main.py**: Change it to the name of the startup script.
**--addr**: indicates the IP address of the master node, which is a parameter transferred to the startup script.
- Start the training using Open MPI.
1. Install the PI open-source library.
In the multi-server multi-device scenario, distributed training deployment depends on the Open MPI open-source library, which must be installed on each server that participates in model training. Currently, Open MPI 4.0.1, 4.0.2, or 4.0.3 is required.
Run the **mpirun --version** command to check whether Open MPI has been installed. If `mpirun (Open MPI) 4.0.2 Report bugs to http://www.open-mpi.org/community/help/` is returned, Open MPI has been installed. If it has been installed and its version is 4.0.1, 4.0.2, or 4.0.3, you do not need to install it again.
Otherwise, perform the following steps to install it
1. Visit the following link to download the Open MPI software package, for example, openmpi-4.0.2.tar.bz2.
https://www.open-mpi.org/software/ompi/v4.0/
2. Log in to the installation environment as the root user.
3. Upload the downloaded Open MPI software package to a directory in the installation environment.
4. Go to the directory and run the following command to decompress the software package:
```shell
tar -jxvf openmpi-4.0.2.tar.bz2
```
5. Go to the directory generated after the decompression, and run the following commands to configure, compile, and install Open MPI:
```shell
./configure --prefix=/usr/local/mpirun4.0.2
make
make install
```
The **--prefix** parameter specifies the Open MPI installation path. Change it based on the site requirements.
6. Run the **vi ~/.bashrc** command to open the **.bashrc** file, and add the following environment variables to the end of the file:
```shell
export OPENMPI=/usr/local/mpirun4.0.2
export LD_LIBRARY_PATH=$OPENMPI/lib
export PATH=$OPENMPI/bin:$PATH
```
In the environment variables, **/usr/local/mpirun4.0.2** indicates the Open MPI installation path. Change it based on the site requirements.
Run the **:wq!** command to save the file and exit.
7. Make the configuration take effect.
```
source ~/.bashrc
```
8. After the installation is complete, run the following command to check the installation version. If the required version information is displayed, the installation is successful.
```
mpirun --version
```
2. Configure SSH password-free login for the AI servers.
If Open MPI is used for distributed training deployment in the multi-server multi-device scenario, you need to configure SSH password-free login between every two servers to ensure that the servers can communicate with each other. The procedure is as follows:
1. Log in to each server as the root user.
2. Configure the reliability among hosts in the cluster.
Open the **/etc/ssh/ssh_config** file and add the following fields to the end of the file:
```
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```
3. Open the **/etc/hosts** file on each server and add the corresponding IP address and host name of the server to the first line of the file. If the file already contains the IP address and host name, skip this step. The following is an example of the content to be added:
```
10.90.140.199 ubuntu
```
In the preceding content, **10.90.140.199** is the IP address of the server, and **ubuntu** is the host name.
4. Run the following commands on the first server to generate a public key (Assume that the IP address of the first server is **10.90.140.199**.):
```
cd ~/.ssh/ # If the directory does not exist, run the ssh localhost command first.
ssh-keygen -t rsa # After the key is generated, a message is displayed. Press Enter for three consecutive times.
mv id_rsa.pub authorized_keys # Renames the generated key id_rsa.pub to authorized_keys.
```
5. Generate a key on each of the other servers, and copy the keys to the **authorized_keys** file on the first server.
1. Run the following commands on each of the other servers to generate a key:
cd ~/.ssh/
ssh-keygen -t rsa
2. Download the key file **id_rsa.pub** generated on each server to the local host and copy the key in the file.
3. On the first server, run the following command to open the authorized_keys file and copy the keys of each of other servers to the end of the public key of the first server.
```
vi ~/.ssh/authorized_keys
```
Run the **:wq!** command to save the file.
6. Run the following commands on each of the other servers to copy the public key of the first server to each of the other servers:
cd ~/.ssh/
scp root@10.90.140.199:~/.ssh/authorized_keys ./
7. Run the following command on each server to test password-free login:
```
ssh User name@IP address
```
For example, run the **ssh root@10.90.140.231** command to log in to the server whose IP address is 10.90.140.231 from the first server whose IP address is 10.90.140.199 without a password.
If information similar to the following is displayed, the login without a password is successful.
```
Linux ubuntu 4.19.28 #1 SMP Tue Jun 23 19:05:23 EDT 2020 x86_64
The programs included with the ubuntu GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
ubuntu GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Sep 15 14:37:21 2020 from 10.254.88.75
```
You can run the **exit** command to log out of the server. If information similar to the following is displayed, the logout is successful.
```
logout
Connection to 10.90.140.231 closed.
```
3. Use Open MPI to start model training.
1. Compile a startup script for each AI server, for example, train.sh, and move the startup script to the same path of the corresponding AI server.
```
# Configure NPU environment variables. For information about the env_npu.sh script, see the appendix.
source env_npu.sh
#Disable the trustlist of HCCL channel.
export HCCL_WHITELIST_DISABLE=1
# Initialize the IP address of the HCCL communication NIC , and set the IP address to the host IP address of the current server.
export HCCL_IF_IP=xxx.xxx.xx.xxx
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr xxx.xxx.xx.xxx --master_port 29501 main.py --addr xxx.xxx.xx.xxx
```
For details about the script parameters, see section "Start the training manually using **torch.distributed.launch**".
2. Compile the startup script.
```
# Configuring the mpirun environment variables.
export PATH=$PATH:/usr/local/mpirun4.0.2/bin
# Run the mpirun tool.
mpirun -H xxx.xxx.xxx.xxx:1,xxx.xxx.xxx.xxx:1 \
--bind-to none -map-by slot \
--mca btl_tcp_if_exclude lo,docker0,endvnic\
--allow-run-as-root \
--prefix /usr/local/mpirun4.0.2/ \
./train.sh
```
In the preceding command:
**-H**: IP address of each AI server and the number of started processes.
**--bind-to**: process-binding policy.
**--mca**: MCA parameter in a specific context. **arg0** is the parameter name, and **arg1** is the parameter value.
**--allow-run-as-root**: The root user is allowed to run this script.
**--prefix**: path of mpirun4.0.2.
**./train.sh**: path of the startup script of each AI server.
4. View the log information after the training succeeds.
Host logs are stored in the `~/ascend/log` directory. You can go to this directory to view the device logs of each host.
# Appendix
The following shows the NPU environment variable configuration script **env_npu.sh**, which can be used to configure the operating and development environment variables.
```shell
#!/bin/bash
export install_path=/usr/local/Ascend
if [ -d ${install_path}/toolkit ]; then
export LD_LIBRARY_PATH=/usr/include/hdf5/lib/:/usr/local/:/usr/local/lib/:/usr/lib/:${install_path}/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons:${path_lib}:${LD_LIBRARY_PATH}
export PATH=${install_path}/fwkacllib/ccec_compiler/bin:${install_path}/fwkacllib/bin:$PATH
export PYTHONPATH=${install_path}/fwkacllib/python/site-packages:${install_path}/tfplugin/python/site-packages:${install_path}/toolkit/python/site-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/python3.7.5/lib/python3.7/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=${install_path}/opp
else
if [ -d ${install_path}/nnae/latest ];then
exportLD_LIBRARY_PATH=/usr/local/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:/usr/local/lib/:/usr/lib64/:/usr/lib/:${install_path}/nnae/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64_64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/nnae/latest/fwkacllib/ccec_compiler/bin/:${install_path}/nnae/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/nnae/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/nnae/latest/fwkacllib/python/site-packages/:${install_path}/nnae/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/nnae/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/nnae/latest
else
export LD_LIBRARY_PATH=/usr/local/:/usr/local/lib/:/usr/lib64/:/usr/lib/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin/:${install_path}/ascend-toolkit/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/ascend-toolkit/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/ascend-toolkit/latest
fi
fi
#Output host logs to the serial port. 0: disable; 1: enable.
export ASCEND_SLOG_PRINT_TO_STDOUT=0
#Set the default log level. 0: debug; 1: info; 2: warning; 3: error.
export ASCEND_GLOBAL_LOG_LEVEL=3
#Enable or disable the event log. 0: disable; 1: enable.
export ASCEND_GLOBAL_EVENT_ENABLE=0
#Enable or disable taskque. 0: disable; 1: enable.
export TASK_QUEUE_ENABLE=1
#Enable or disable the HCCL trustlist. 1: disable; 0: enable.
export HCCL_WHITELIST_DISABLE=1
#Set the device-side log to error.
${install_path}/driver/tools/msnpureport -g error -d 0
${install_path}/driver/tools/msnpureport -g error -d 1
${install_path}/driver/tools/msnpureport -g error -d 2
${install_path}/driver/tools/msnpureport -g error -d 3
${install_path}/driver/tools/msnpureport -g error -d 4
${install_path}/driver/tools/msnpureport -g error -d 5
${install_path}/driver/tools/msnpureport -g error -d 6
${install_path}/driver/tools/msnpureport -g error -d 7
#Disable the event log on the device side.
${install_path}/driver/tools/msnpureport -e disable
path_lib=$(python3.7 -c """
import sys
import re
result=''
for index in range(len(sys.path)):
match_sit = re.search('-packages', sys.path[index])
if match_sit is not None:
match_lib = re.search('lib', sys.path[index])
if match_lib is not None:
end=match_lib.span()[1]
result += sys.path[index][0:end] + ':'
result+=sys.path[index] + '/torch/lib:'
print(result)"""
)
echo ${path_lib}
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib/:${path_lib}:$LD_LIBRARY_PATH
```
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

@@ -8,7 +8,7 @@
- [References](#referencesmd)
- [Installing CMake](#installing-cmakemd)
- [How Do I Install GCC 7.3.0?](#how-do-i-install-gcc-7-3-0md)
- [What Do I Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?](#what-do-i-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd)
- [What to Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?](#what-to-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd)
<h2 id="overviewmd">Overview</h2>
When setting up the environment for PyTorch model development and running, you can manually build and install the modules adapted to the PyTorch framework on a server.
@@ -33,10 +33,11 @@ When setting up the environment for PyTorch model development and running, you c
#### Prerequisites<a name="en-us_topic_0000001105856382_en-us_topic_0275872734_section108914373254"></a>
- The development or operating environment of CANN has been installed. For details, see the _CANN Software Installation Guide_.
- The development or operating environment of CANN has been installed. For details, see the _CANN Software Installation Guide_.
- CMake 3.12.0 or later has been installed. For details about how to install CMake, see [Installing CMake](#installing-cmakemd).
- GCC 7.3.0 or later has been installed. For details about how to install and use GCC 7.3.0, see [How Do I Install GCC 7.3.0?](#how-do-i-install-gcc-7-3-0md).
- Python 3.7.5 or 3.8 has been installed.
- Python 3.7.5, 3.8, or 3.9 has been installed.
- Note that PyTorch 1.5 does not support Python 3.9 build and installation. Only Torch 1.8.1 supports Python 3.9 build and installation.
- The Patch and Git tools have been installed in the environment. To install the tools for Ubuntu and CentOS, run the following commands:
- Ubuntu
@@ -70,10 +71,14 @@ When setting up the environment for PyTorch model development and running, you c
3. Obtain the PyTorch source code.
1. Run the following command to obtain the PyTorch source code adapted to Ascend AI Processors:
1. Run the following command to obtain the PyTorch source code adapted to Ascend AI Processors and switch to the required branch:
```
git clone https://gitee.com/ascend/pytorch.git
# By default, the masterf branch is used. If other branches are required, run the git checkout command to switch to that branch.
cd pytorch
git checkout -b 2.0.4.tr5 remotes/origin/2.0.4.tr5
```
The directory structure of the downloaded source code is as follows:
@@ -106,7 +111,7 @@ When setting up the environment for PyTorch model development and running, you c
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
```
3. Run the following commands to go to the native PyTorch code directory **pytorch** and obtain the PyTorch passive dependency code:
3. Go to the native PyTorch code directory **pytorch** and obtain the PyTorch passive dependency code.
```
cd pytorch
@@ -143,6 +148,9 @@ When setting up the environment for PyTorch model development and running, you c
bash build.sh --python=3.7
or
bash build.sh --python=3.8
or
bash build.sh --python=3.9 # PyTorch 1.5 does not support build and installation using Python 3.9.
```
Specify the Python version in the environment for build. The generated binary package is stored in the current dist directory **pytorch/pytorch/dist**.
@@ -152,6 +160,7 @@ When setting up the environment for PyTorch model development and running, you c
Go to the **pytorch/pytorch/dist** directory and run the following command to install PyTorch:
```
cd dist
pip3 install --upgrade torch-1.5.0+ascend.post3-cp37-cp37m-linux_{arch}.whl
```
@@ -169,7 +178,8 @@ After the software packages are installed, configure environment variables to us
1. Configure the operating environment variables by running the following command in the **root** directory of the PyTorch source code adapted to Ascend AI Processors:
```
source pytorch/env.sh
cd ../
source env.sh
```
2. Select a proper HCCL initialization mode based on the actual scenario and configure the corresponding environment variables.
@@ -179,7 +189,7 @@ After the software packages are installed, configure environment variables to us
export HCCL_WHITELIST_DISABLE=1 # Disable the HCCL trustlist.
# Scenario 2: Multi-node scenario
export HCCL_WHITELIST_DISABLE=1 # Disable the HCCL trustlist.
export HCCL_IF_IP="1.1.1.1" # 1.1.1.1 is the NIC IP address of the host. Change it based on the site requirements. Ensure that the NIC IP addresses in use can communicate with each other in the cluster.
export HCCL_IF_IP="1.1.1.1" # Replace 1.1.1.1 with the actual NIC IP address of the host. Ensure that the NIC IP addresses in use can communicate with each other in the cluster.
```
3. \(Optional\) Configure function or performance environment variables in the NPU scenario. The variables are disabled by default.
@@ -329,7 +339,7 @@ After the software packages are installed, configure environment variables to us
1. Run the following command to obtain the Apex source code adapted to Ascend AI Processors:
```
git clone -b 2.0.3.tr5 https://gitee.com/ascend/apex.git
git clone -b 2.0.4.tr5 https://gitee.com/ascend/apex.git
```
The directory structure of the downloaded source code is as follows:
@@ -338,7 +348,7 @@ After the software packages are installed, configure environment variables to us
apex
│ ├─patch # Directory of the patch adapted to Ascend AI Processors
│ ├─npu.patch
│ ├─scripts # Build and create a directory.
│ ├─scripts # Build and creation directory
│ ├─gen.sh
│ ├─src # Source code directory
│ ├─tests # Directory for storing test cases
@@ -358,7 +368,7 @@ After the software packages are installed, configure environment variables to us
│ ├─apex # Directory for storing the native Apex code
│ ├─patch # Directory of the patch adapted to Ascend AI Processors
│ ├─npu.patch
│ ├─scripts # Build and create a directory.
│ ├─scripts # Build and creation directory
│ ├─gen.sh
│ ├─src # Source code directory
│ ├─tests # Directory for storing test cases
@@ -384,7 +394,7 @@ After the software packages are installed, configure environment variables to us
The full code adapted to Ascend AI Processors is generated in the **apex/apex** directory.
2. Go to the full code directory **apex/apex**, and compile and generate the binary installation package of Apex.
2. Go to the full code directory **apex/apex**, and build and generate the binary installation package of Apex.
```
cd ../apex
@@ -414,12 +424,12 @@ After the software packages are installed, configure environment variables to us
- **[How Do I Install GCC 7.3.0?](#how-do-i-install-gcc-7-3-0md)**
- **[What Do I Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?](#what-do-i-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd)**
- **[What to Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?](#what-to-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd)**
<h3 id="installing-cmakemd">Installing CMake</h3>
Procedure for upgrading CMake to 3.12.1
The following describes how to install CMake 3.12.1.
1. Obtain the CMake software package.
@@ -447,8 +457,7 @@ Procedure for upgrading CMake to 3.12.1
ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
```
5. Run the following command to check whether CMake has been installed:
5. Check whether CMake has been installed.
```
cmake --version
```
@@ -525,7 +534,7 @@ Perform the following steps as the **root** user.
5. Set the environment variable.
Training must be performed in the compilation environment with GCC upgraded. If you want to run training, configure the following environment variable in your training script:
Training must be performed in the compilation environment with GCC upgraded. Therefore, configure the following environment variable in your training script:
```
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
@@ -537,11 +546,11 @@ Perform the following steps as the **root** user.
>Skip this step if you do not need to use the compilation environment with GCC upgraded.
<h3 id="what-do-i-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd">What Do I Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?</h3>
<h3 id="what-to-do-if-torch-1-5-0xxxx-and-torchvision-do-not-match-when-torch--whl-is-installedmd">What to Do If "torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed?</h3>
#### Symptom<a name="en-us_topic_0000001105856364_en-us_topic_0175549220_section197270431505"></a>
During the installation of **torch-**_\*_**.whl**, the message "ERROR: torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible" " is displayed.
During the installation of **torch-**_\*_**.whl**, the message "ERROR: torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible" is displayed.
![](figures/en-us_image_0000001190081735.png)
@@ -57,10 +57,10 @@ The following are the environment variables required for starting the inference
export PATH=/usr/local/python3.7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
# Sets the logical ID of a processor.
# Set the logical ID of a processor.
export ASCEND_DEVICE_ID=0
# Outputs log information. Replace it as required.
# Output log information. Replace it as required.
export ASCEND_SLOG_PRINT_TO_STDOUT=1
export ASCEND_GLOBAL_LOG_LEVEL=0
@@ -416,11 +416,11 @@ The following uses the ResNet-50 model as an example to describe how to perform
2. Edit the inference script.
Create a model script file **resnet50\_infer\_for\_pytorch.py** and write code by referring to [Sample Code]().
Create a model script file **resnet50\_infer\_for\_pytorch.py** and write code. For how to write the code, see [Sample Code]().
3. Run inference.
Set environment variables by referring to [Environment Variable Configuration](#environment-variable-configurationmd) and then run the following command:
Set environment variables (for how to set them, see [Environment Variable Configuration](#environment-variable-configurationmd)) and then run the following command:
```
python3 pytorch-resnet50-apex.py --data /data/imagenet \
@@ -491,13 +491,13 @@ However, the mixed precision training is limited by the precision range expresse
#### Initializing the Mixed Precision Model<a name="section18178125518268"></a>
1. To use the mixed precision module Apex, you need to import the amp module from the Apex library as follows:
1. To use the mixed precision module Apex, import the amp module from the Apex library.
```
from apex import amp
```
2. After the amp module is imported, you need to initialize it so that it can modify the model, optimizer, and PyTorch internal functions. The initialization code is as follows:
2. Initialize the amp module so that it can modify the model, optimizer, and PyTorch internal functions.
```
model, optimizer = amp.initialize(model, optimizer)
@@ -585,7 +585,7 @@ Perform the following steps as the **root** user.
5. Set the environment variable.
The build environment after GCC upgrade is required for training. Therefore, you need to configure the following environment variable in the training script:
Training must be performed in the compilation environment with GCC upgraded. Therefore, configure the following environment variable in the training script:
```
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
@@ -594,6 +594,6 @@ Perform the following steps as the **root** user.
**$\{install\_path\}** indicates the GCC 7.3.0 installation path configured in [3.](#en-us_topic_0000001146754749_en-us_topic_0000001072593337_l75d31a2874534a2092e80a5f865b46f0). In this example, the GCC 7.3.0 installation path is **/usr/local/linux\_gcc7.3.0/**.
>![](public_sys-resources/icon-note.gif) **NOTE:**
>The environment variable needs to be configured only when you need to use the build environment after the GCC upgrade.
>Skip this step if you do not the compilation environment with GCC upgraded.
@@ -444,13 +444,13 @@ You can develop an operator adaptation plugin to convert the formats of the inpu
3. Define the main adaptation function of the operator.
Determine the adaptation theme function for custom operators based on the dispatch function in the registered operator.
Determine the main adaptation function for custom operators based on the dispatch function in the registered operator.
4. Implement the main adaptation functions.
Implement the operator adaptation theme function and construct the corresponding input, output, and attributes based on the TBE operator prototype.
Implement the operator's main adaptation function and construct the corresponding input, output, and attributes based on the TBE operator prototype.
5. Use the **TORCH\_LIBRARY\_IMPL** macro to associate the operator description func in the **native\_functions.yaml** file generated during the operator registration. \(Only PyTorch 1.8.1 requires this step.\)
5. \(Only PyTorch 1.8.1 requires this step.\) Use the **TORCH\_LIBRARY\_IMPL** macro to associate the operator description func in the **native\_functions.yaml** file generated during the operator registration.
**TORCH\_LIBRARY\_IMPL** is a macro provided by PyTorch for registered operator distribution. To use it, perform the following steps:
@@ -618,7 +618,7 @@ The following uses the torch.add\(\) operator as an example to describe how to a
}
```
5. Use the **TORCH\_LIBRARY\_IMPL** macro to associate the registered operator. \(Only PyTorch 1.8.1 requires this step.\)
5. \(Only PyTorch 1.8.1 requires this step.\) Use the **TORCH\_LIBRARY\_IMPL** macro to associate the registered operator.
```
TORCH_LIBRARY_IMPL(aten, NPU, m) {
@@ -827,7 +827,7 @@ pip3.7 install torchvision --no-deps
#### Symptom<a name="en-us_topic_0000001125315883_en-us_topic_0175549220_section197270431505"></a>
During the installation of **torch-**_\*_**.whl**, the message "ERROR: torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible" " is displayed.
During the installation of **torch-**_\*_**.whl**, the message "ERROR: torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible" is displayed.
![](figures/en-us_image_0000001144082048.png)
@@ -900,7 +900,7 @@ The custom TBE operator has been developed and adapted to PyTorch. However, the
There should be no error in this step. The log added in **add** should be displayed. If an error occurs, check the code to ensure that no newly developed code affects the test.
3. The newly developed custom TBE operator is combined into CANN. Logs are added to the operator entry as the running identifier.
3. Combine the newly developed custom TBE operator into CANN. Add logs to the operator entry as the running identifier.
4. After the compilation and installation of CANN are complete, call **python3.7.5 test\_add.py** to perform the test.
>![](public_sys-resources/icon-note.gif) **NOTE:**
@@ -1047,7 +1047,7 @@ The following describes how to upgrade CMake to 3.12.1.
ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
```
5. Run the following command to check whether CMake has been installed:
5. Check whether CMake has been installed.
```
cmake --version
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

@@ -1,411 +1,493 @@
# FrameworkPTAdapter 2.0.3 Release Notes
- [FrameworkPTAdapter 2.0.3](#frameworkptadapter-2-0-3md)
- [Before You Start](#before-you-startmd)
- [New Features](#new-featuresmd)
- [Modified Features](#modified-featuresmd)
- [Resolved Issues](#resolved-issuesmd)
- [Known Issues](#known-issuesmd)
- [Compatibility](#compatibilitymd)
- [FrameworkPTAdapter 2.0.2](#frameworkptadapter-2-0-2md)
- [Before You Start](#before-you-start-0md)
- [New Features](#new-features-1md)
- [Modified Features](#modified-features-2md)
- [Resolved Issues](#resolved-issues-3md)
- [Known Issues](#known-issues-4md)
- [Compatibility](#compatibility-5md)
<h2 id="frameworkptadapter-2-0-3md">FrameworkPTAdapter 2.0.3</h2>
- **[Before You Start](#before-you-startmd)**
- **[New Features](#new-featuresmd)**
- **[Modified Features](#modified-featuresmd)**
- **[Resolved Issues](#resolved-issuesmd)**
- **[Known Issues](#known-issuesmd)**
- **[Compatibility](#compatibilitymd)**
<h3 id="before-you-startmd">Before You Start</h3>
This framework is modified based on the open-source PyTorch 1.5.0 developed by Facebook, inherits native PyTorch features, and uses NPUs for dynamic image training. Models are adapted by operator granularity, code can be reused, and current networks can be ported and used on NPUs with only device types or data types modified.
PyTorch 1.8.1 is supported by this version and later, and this version inherits the features of PyTorch 1.5.0 and provides the same functions, except for the profiling tool. In addition, it optimizes the backend operator adaptation. Currently, PyTorch 1.8.1 supports only the ResNet-50 network model.
<h3 id="new-featuresmd">New Features</h3>
**Table 1** Features supported by PyTorch
<a name="t76c34275cbb74753970f7c5a9eb594fa"></a>
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.459999999999999%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>Level-1 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="26.27%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>Level-2 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="63.27%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row7979351559"><td class="cellrowborder" rowspan="5" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>PyTorch features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>PyTorch 1.8.1</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>Added PyTorch 1.8.1. Currently, only the ResNet-50 network is supported, including the training scenario for distributed data parallel (DDP).</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>Python 3.8</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>Supported compilation and use of Python 3.8.</p>
</td>
</tr>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>Operator overflow/underflow detection tool</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>Supported IR-level operator overflow/underflow detection in the PyTorch framework. When AI Core operator overflow/underflow occurs, the IR information is displayed.</p>
</td>
</tr>
<tr id="row185381431133610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p953883153611"><a name="p953883153611"></a><a name="p953883153611"></a>OS compatibility</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p13538203153618"><a name="p13538203153618"></a><a name="p13538203153618"></a>Supported UOS 20 1020e ARM.</p>
</td>
</tr>
<tr id="row91681125173610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p2168172519364"><a name="p2168172519364"></a><a name="p2168172519364"></a>Basic framework functions</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1416815259367"><a name="p1416815259367"></a><a name="p1416815259367"></a>Added the function of adapted operator development. For details, see the operator list.</p>
</td>
</tr>
<tr id="row11970351050"><td class="cellrowborder" rowspan="26" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p298314333514"><a name="p298314333514"></a><a name="p298314333514"></a>Model training</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p19984193312511"><a name="p19984193312511"></a><a name="p19984193312511"></a>CenterFace</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p7517351258"><a name="p7517351258"></a><a name="p7517351258"></a>-</p>
</td>
</tr>
<tr id="row9965351254"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1984033458"><a name="p1984033458"></a><a name="p1984033458"></a>PCBU</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p298411338513"><a name="p298411338513"></a><a name="p298411338513"></a>-</p>
</td>
</tr>
<tr id="row14966351959"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p198414331957"><a name="p198414331957"></a><a name="p198414331957"></a>Net++</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798413331756"><a name="p1798413331756"></a><a name="p1798413331756"></a>-</p>
</td>
</tr>
<tr id="row20966351454"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p4984183317518"><a name="p4984183317518"></a><a name="p4984183317518"></a>FCN8S</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698453311519"><a name="p1698453311519"></a><a name="p1698453311519"></a>-</p>
</td>
</tr>
<tr id="row19653517518"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298483319512"><a name="p1298483319512"></a><a name="p1298483319512"></a>OSNetRetinaFace</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798423312519"><a name="p1798423312519"></a><a name="p1798423312519"></a>-</p>
</td>
</tr>
<tr id="row39619351751"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298414331513"><a name="p1298414331513"></a><a name="p1298414331513"></a>PSPnet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p10984633254"><a name="p10984633254"></a><a name="p10984633254"></a>-</p>
</td>
</tr>
<tr id="row496335654"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984433351"><a name="p19984433351"></a><a name="p19984433351"></a>EDSR</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p898473314517"><a name="p898473314517"></a><a name="p898473314517"></a>-</p>
</td>
</tr>
<tr id="row17953357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p14984123312515"><a name="p14984123312515"></a><a name="p14984123312515"></a>Tsm</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p159841033855"><a name="p159841033855"></a><a name="p159841033855"></a>-</p>
</td>
</tr>
<tr id="row16951435551"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984933457"><a name="p19984933457"></a><a name="p19984933457"></a>pnasnet5large</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p89846335512"><a name="p89846335512"></a><a name="p89846335512"></a>-</p>
</td>
</tr>
<tr id="row2095113520514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1798416331952"><a name="p1798416331952"></a><a name="p1798416331952"></a>Gaitset</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p098417336516"><a name="p098417336516"></a><a name="p098417336516"></a>-</p>
</td>
</tr>
<tr id="row89516351511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11985153312516"><a name="p11985153312516"></a><a name="p11985153312516"></a>fcn</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p169858331155"><a name="p169858331155"></a><a name="p169858331155"></a>-</p>
</td>
</tr>
<tr id="row5953353513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18985103311514"><a name="p18985103311514"></a><a name="p18985103311514"></a>Albert</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098513334519"><a name="p2098513334519"></a><a name="p2098513334519"></a>-</p>
</td>
</tr>
<tr id="row119533516513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p598511336511"><a name="p598511336511"></a><a name="p598511336511"></a>AdvancedEast</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p119850331513"><a name="p119850331513"></a><a name="p119850331513"></a>-</p>
</td>
</tr>
<tr id="row39511356512"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p698553311512"><a name="p698553311512"></a><a name="p698553311512"></a>ReidStrongBaseline</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198514331659"><a name="p1198514331659"></a><a name="p1198514331659"></a>-</p>
</td>
</tr>
<tr id="row129463518517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p99851633158"><a name="p99851633158"></a><a name="p99851633158"></a>Fast-scnn</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1298514331359"><a name="p1298514331359"></a><a name="p1298514331359"></a>-</p>
</td>
</tr>
<tr id="row9942035757"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p109854331151"><a name="p109854331151"></a><a name="p109854331151"></a>RDN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198583317511"><a name="p1198583317511"></a><a name="p1198583317511"></a>-</p>
</td>
</tr>
<tr id="row79415357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6985833351"><a name="p6985833351"></a><a name="p6985833351"></a>SRFlow</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p29851033350"><a name="p29851033350"></a><a name="p29851033350"></a>-</p>
</td>
</tr>
<tr id="row12947357514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149859334518"><a name="p149859334518"></a><a name="p149859334518"></a>MGN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p19851833850"><a name="p19851833850"></a><a name="p19851833850"></a>-</p>
</td>
</tr>
<tr id="row3941735855"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p898533316518"><a name="p898533316518"></a><a name="p898533316518"></a>Roberta</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p998553318518"><a name="p998553318518"></a><a name="p998553318518"></a>-</p>
</td>
</tr>
<tr id="row1093335856"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1985533451"><a name="p1985533451"></a><a name="p1985533451"></a>RegNetY</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p59851033355"><a name="p59851033355"></a><a name="p59851033355"></a>-</p>
</td>
</tr>
<tr id="row49373518516"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19986173311512"><a name="p19986173311512"></a><a name="p19986173311512"></a>VoVNet-39</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p798683310515"><a name="p798683310515"></a><a name="p798683310515"></a>-</p>
</td>
</tr>
<tr id="row5930351357"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p189862336515"><a name="p189862336515"></a><a name="p189862336515"></a>RegNetX</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1398618331651"><a name="p1398618331651"></a><a name="p1398618331651"></a>-</p>
</td>
</tr>
<tr id="row169312351655"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149863337513"><a name="p149863337513"></a><a name="p149863337513"></a>RefineNet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098615331959"><a name="p2098615331959"></a><a name="p2098615331959"></a>-</p>
</td>
</tr>
<tr id="row11931235957"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1198616331657"><a name="p1198616331657"></a><a name="p1198616331657"></a>RefineDet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698611332518"><a name="p1698611332518"></a><a name="p1698611332518"></a>-</p>
</td>
</tr>
<tr id="row189215359511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p16986183319512"><a name="p16986183319512"></a><a name="p16986183319512"></a>AlignedReID</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1898715331055"><a name="p1898715331055"></a><a name="p1898715331055"></a>-</p>
</td>
</tr>
<tr id="row89213351858"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p119878330511"><a name="p119878330511"></a><a name="p119878330511"></a>FaceBoxes</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p129878331158"><a name="p129878331158"></a><a name="p129878331158"></a>-</p>
</td>
</tr>
</tbody>
</table>
<h3 id="modified-featuresmd">Modified Features</h3>
N/A
<h3 id="resolved-issuesmd">Resolved Issues</h3>
N/A
<h3 id="known-issuesmd">Known Issues</h3>
<a name="table1969972073016"></a>
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>Known Issue</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>Data type</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPU does not support the input or output of the inf/nan data of the float16 type.</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>Data format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>Dimensions cannot be reduced when the format larger than 4D is used.</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>Restrictions on collective communication</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>The graphs executed on different devices in a training job must be the same.</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>Allocation at only 1, 2, 4, or 8 processors is supported.</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>Only the int8, int32, float16, and float32 data types are supported.</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex function</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>In the current version, Apex is implemented mainly using Python, and the customized optimization of CUDA kernel in Apex is not supported.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="compatibilitymd">Compatibility</h3>
Atlas 800 \(model 9010\): CentOS 7.6, Ubuntu 18.04, BC-Linux 7.6, Debian 9.9, Debian 10, and openEuler 20.03 LTS.
Atlas 800 \(model 9000\): CentOS 7.6, Euler 2.8, Kylin v10, BC-Linux 7.6, OpenEuler 20.03 LTS, and UOS 20 1020e.
<h2 id="frameworkptadapter-2-0-2md">FrameworkPTAdapter 2.0.2</h2>
- **[Before You Start](#before-you-start-0md)**
- **[New Features](#new-features-1md)**
- **[Modified Features](#modified-features-2md)**
- **[Resolved Issues](#resolved-issues-3md)**
- **[Known Issues](#known-issues-4md)**
- **[Compatibility](#compatibility-5md)**
<h3 id="before-you-start-0md">Before You Start</h3>
This framework is modified based on the open-source PyTorch 1.5.0 primarily developed by Facebook, inherits native PyTorch features, and uses NPUs for dynamic image training. Models are adapted by operator granularity, code can be reused, and current networks can be ported and used on NPUs with only device types or data types modified.
<h3 id="new-features-1md">New Features</h3>
**Table 1** Features supported by PyTorch
<a name="t76c34275cbb74753970f7c5a9eb594fa"></a>
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.489999999999998%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>Level-1 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="26.3%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>Level-2 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="63.21%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row171322953713"><td class="cellrowborder" rowspan="7" valign="top" width="10.489999999999998%" headers="mcps1.2.4.1.1 "><p id="p10237517181"><a name="p10237517181"></a><a name="p10237517181"></a>Adapted training models</p>
</td>
<td class="cellrowborder" valign="top" width="26.3%" headers="mcps1.2.4.1.2 "><p id="p6134294377"><a name="p6134294377"></a><a name="p6134294377"></a>YOLOV4</p>
</td>
<td class="cellrowborder" valign="top" width="63.21%" headers="mcps1.2.4.1.3 "><p id="p314533811397"><a name="p314533811397"></a><a name="p314533811397"></a>-</p>
</td>
</tr>
<tr id="row15990182233714"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p399019224374"><a name="p399019224374"></a><a name="p399019224374"></a>YOLOV3</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1714553816396"><a name="p1714553816396"></a><a name="p1714553816396"></a>-</p>
</td>
</tr>
<tr id="row5301255373"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1530325123719"><a name="p1530325123719"></a><a name="p1530325123719"></a>DB</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p5146193819390"><a name="p5146193819390"></a><a name="p5146193819390"></a>-</p>
</td>
</tr>
<tr id="row274203413712"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p197423343379"><a name="p197423343379"></a><a name="p197423343379"></a>RFCN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15828941153919"><a name="p15828941153919"></a><a name="p15828941153919"></a>-</p>
</td>
</tr>
<tr id="row78671918163714"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p188671318183713"><a name="p188671318183713"></a><a name="p188671318183713"></a>CRNN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p10828241123917"><a name="p10828241123917"></a><a name="p10828241123917"></a>-</p>
</td>
</tr>
<tr id="row16912221171"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6913132676"><a name="p6913132676"></a><a name="p6913132676"></a>Densenset161</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p209131221474"><a name="p209131221474"></a><a name="p209131221474"></a>-</p>
</td>
</tr>
<tr id="row1016073314719"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p3160153320717"><a name="p3160153320717"></a><a name="p3160153320717"></a>Densenset191</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1516012331173"><a name="p1516012331173"></a><a name="p1516012331173"></a>-</p>
</td>
</tr>
<tr id="row9627165910386"><td class="cellrowborder" rowspan="4" valign="top" width="10.489999999999998%" headers="mcps1.2.4.1.1 "><p id="p1561535993811"><a name="p1561535993811"></a><a name="p1561535993811"></a>PyTorch features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.3%" headers="mcps1.2.4.1.2 "><p id="p136151659163819"><a name="p136151659163819"></a><a name="p136151659163819"></a>Basic Framework Functions</p>
</td>
<td class="cellrowborder" valign="top" width="63.21%" headers="mcps1.2.4.1.3 "><p id="p1661535983813"><a name="p1661535983813"></a><a name="p1661535983813"></a>Added the function of adapted operator development. For details, see the operator list.</p>
</td>
</tr>
<tr id="row7627155917380"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1561525916383"><a name="p1561525916383"></a><a name="p1561525916383"></a>Model Accuracy Analyzer</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p19616115953816"><a name="p19616115953816"></a><a name="p19616115953816"></a>Added model accuracy analyzers and supported training accuracy demarcation.</p>
</td>
</tr>
<tr id="row46269593383"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p0616559163819"><a name="p0616559163819"></a><a name="p0616559163819"></a>Ascend 710 AI Processor</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p186161459193813"><a name="p186161459193813"></a><a name="p186161459193813"></a>Supported the online inference on the Ascend 710 AI Processor.</p>
</td>
</tr>
<tr id="row76261059153817"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11616175953812"><a name="p11616175953812"></a><a name="p11616175953812"></a>OS Compatibility</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p8935115971714"><a name="p8935115971714"></a><a name="p8935115971714"></a>Supported Ubuntu 18.04.5 and openEuler 20.03 LTS.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="modified-features-2md">Modified Features</h3>
N/A
<h3 id="resolved-issues-3md">Resolved Issues</h3>
N/A
<h3 id="known-issues-4md">Known Issues</h3>
<a name="table1969972073016"></a>
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>Known Issue</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>Data type</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>The NPU does not support the input or output of the inf/nan data of the float16 type.</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>Data format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>Dimensions cannot be reduced when the format larger than 4D is used.</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>Restrictions on collective communication</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>The graphs executed on different devices in a training job must be the same.</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>Allocation at only 1, 2, 4, or 8 processors is supported.</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>Only the int8, int32, float16, and float32 data types are supported.</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex function</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>In the current version, Apex is implemented mainly using Python, and the customized optimization CUDA kernel in Apex is not supported.</p>
</td>
</tr>
</tbody>
</table>
<h3 id="compatibility-5md">Compatibility</h3>
Atlas 800 \(model 9010\): CentOS 7.6/Ubuntu 18.04/BC-Linux 7.6/Debian 9.9/Debian 10/openEuler 20.03 LTS
Atlas 800 \(model 9000\): CentOS 7.6/EulerOS 2.8/Kylin v10/BC-Linux 7.6/openEuler 20.03 LTS
# FrameworkPTAdapter 2.0.4 Release Notes
- [FrameworkPTAdapter 2.0.4 Release Notes](#frameworkptadapter-204-release-notes)
- [FrameworkPTAdapter 2.0.4](#frameworkptadapter-204)
- [Before You Start](#before-you-start)
- [New Features](#new-features)
- [Modified Features](#modified-features)
- [Resolved Issues](#resolved-issues)
- [Known Issues](#known-issues)
- [Compatibility](#compatibility)
- [FrameworkPTAdapter 2.0.3](#frameworkptadapter-203)
- [Before You Start](#before-you-start-1)
- [New Features](#new-features-1)
- [Modified Features](#modified-features-1)
- [Resolved Issues](#resolved-issues-1)
- [Known Issues](#known-issues-1)
- [Compatibility](#compatibility-1)
- [FrameworkPTAdapter 2.0.2](#frameworkptadapter-202)
- [Before You Start](#before-you-start-2)
- [New Features](#new-features-2)
- [Modified Features](#modified-features-2)
- [Resolved Issues](#resolved-issues-2)
- [Known Issues](#known-issues-2)
- [Compatibility](#compatibility-2)
## FrameworkPTAdapter 2.0.4
### Before You Start
This framework is modified based on the open-source PyTorch 1.5.0 and 1.8.1 developed by Facebook, inherits native PyTorch features, and uses NPUs for dynamic image training. Models are adapted by operator granularity, code can be reused, and current networks can be ported and used on NPUs with only device types or data types modified.
PyTorch 1.8.1 inherits the features of PyTorch 1.5.0. Their functions are basically the same, but PyTorch 1.8.1 provides better development experience for backend operator adaptation. Currently, PyTorch 1.8.1 supports only the ResNet-50 network model.
### New Features
**Table 1** Features supported by PyTorch
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.459999999999999%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>Level-1 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="26.27%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>Level-2 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="63.27%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row7979351559"><td class="cellrowborder" rowspan="3" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>PyTorch 1.5.0 features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>Optimization of Model Accuracy Analyzer</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>Supported mapping between IR and TBE operators and enabled the NPU dump data to be loaded to the GPU side for comparison.</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>E2E prof</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>Integrated the profile data obtained by the native PyTorch Profiling tool and CANN prof tool to implement end-to-end model and operator performance analysis.</p>
</td>
</tr>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>Basic framework functions</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>Added the function of adapted operator development. For details, see the operator list.</p>
</td>
</tr>
<tr id="row7979351559"><td class="cellrowborder" rowspan="2" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>PyTorch 1.8.1 features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>AMP</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>Supported the native training with automatic mixed precision (AMP) of PyTorch.</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>Profiling</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>Supported the native profiling function of PyTorch.</p>
</td>
</tr>
<tr id="row7979351559"><td class="cellrowborder" rowspan="2" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>OS compatibility</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>OS compatibility</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>Supported Ubuntu 20.04 (x86 and ARM) and EulerOS 2.10 (ARM).</p>
</td>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>Python version compatibility</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>Supported compilation and use of Python 3.9 (only in PyTorch 1.8.1).</p>
</td>
</tr>
</tbody>
</table>
### Modified Features
N/A
### Resolved Issues
N/A
### Known Issues
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>Known Issue</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>Data type support</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPUs do not support the input or output of the inf/nan data of the float16 type.</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>Data format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>Dimensions cannot be reduced when the format larger than 4D is used.</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>Restrictions on collective communication</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>The graphs executed on different devices in a training job must be the same.</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>Allocation at only 1, 2, 4, or 8 processors is supported.</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>Only the int8, int32, float16, and float32 data types are supported.</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex function</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>In the current version, Apex is implemented mainly using Python, and the customized optimization of CUDA kernel in Apex is not supported.</p>
</td>
</tr>
</tbody>
</table>
### Compatibility
Atlas 800 (model 9010): CentOS 7.6, Ubuntu 18.04/2.04, BC-Linux 7.6, Debian 9.9, Debian 10, openEuler 20.03 LTS
Atlas 800 (model 9000): CentOS 7.6, Ubuntu 18.04/2.04, EulerOS 2.8/2.10, Kylin V10, BC-Linux 7.6, openEuler 20.03 LTS, UOS 20 1020e
## FrameworkPTAdapter 2.0.3
### Before You Start
This framework is modified based on the open-source PyTorch 1.5.0 developed by Facebook, inherits native PyTorch features, and uses NPUs for dynamic image training. Models are adapted by operator granularity, code can be reused, and current networks can be ported and used on NPUs with only device types or data types modified.
PyTorch 1.8.1 is supported by this version and later, and this version inherits the features of PyTorch 1.5.0 and provides the same functions, except for the Profiling tool. In addition, it optimizes the backend operator adaptation. Currently, PyTorch 1.8.1 supports only the ResNet-50 network model.
### New Features
**Table 1** Features supported by PyTorch
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.459999999999999%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>Level-1 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="26.27%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>Level-2 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="63.27%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row7979351559"><td class="cellrowborder" rowspan="5" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>PyTorch features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>PyTorch 1.8.1</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>Added PyTorch 1.8.1. Currently, only the ResNet-50 network is supported, including the training scenario for distributed data parallel (DDP).</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>Python 3.8</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>Supported compilation and use of Python 3.8.</p>
</td>
</tr>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>Operator overflow/underflow detection tool</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>Supported IR-level operator overflow/underflow detection in the PyTorch framework. When an AI Core operator overflow/underflow occurs, the IR information is displayed.</p>
</td>
</tr>
<tr id="row185381431133610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p953883153611"><a name="p953883153611"></a><a name="p953883153611"></a>OS compatibility</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p13538203153618"><a name="p13538203153618"></a><a name="p13538203153618"></a>Supported UOS 20 1020e ARM.</p>
</td>
</tr>
<tr id="row91681125173610"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p2168172519364"><a name="p2168172519364"></a><a name="p2168172519364"></a>Basic framework functions</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1416815259367"><a name="p1416815259367"></a><a name="p1416815259367"></a>Added the function of adapted operator development. For details, see the operator list.</p>
</td>
</tr>
<tr id="row11970351050"><td class="cellrowborder" rowspan="26" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p298314333514"><a name="p298314333514"></a><a name="p298314333514"></a>Model training</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p19984193312511"><a name="p19984193312511"></a><a name="p19984193312511"></a>CenterFace</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p7517351258"><a name="p7517351258"></a><a name="p7517351258"></a>-</p>
</td>
</tr>
<tr id="row9965351254"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1984033458"><a name="p1984033458"></a><a name="p1984033458"></a>PCBU</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p298411338513"><a name="p298411338513"></a><a name="p298411338513"></a>-</p>
</td>
</tr>
<tr id="row14966351959"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p198414331957"><a name="p198414331957"></a><a name="p198414331957"></a>Net++</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798413331756"><a name="p1798413331756"></a><a name="p1798413331756"></a>-</p>
</td>
</tr>
<tr id="row20966351454"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p4984183317518"><a name="p4984183317518"></a><a name="p4984183317518"></a>FCN8S</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698453311519"><a name="p1698453311519"></a><a name="p1698453311519"></a>-</p>
</td>
</tr>
<tr id="row19653517518"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298483319512"><a name="p1298483319512"></a><a name="p1298483319512"></a>OSNetRetinaFace</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1798423312519"><a name="p1798423312519"></a><a name="p1798423312519"></a>-</p>
</td>
</tr>
<tr id="row39619351751"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1298414331513"><a name="p1298414331513"></a><a name="p1298414331513"></a>PSPnet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p10984633254"><a name="p10984633254"></a><a name="p10984633254"></a>-</p>
</td>
</tr>
<tr id="row496335654"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984433351"><a name="p19984433351"></a><a name="p19984433351"></a>EDSR</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p898473314517"><a name="p898473314517"></a><a name="p898473314517"></a>-</p>
</td>
</tr>
<tr id="row17953357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p14984123312515"><a name="p14984123312515"></a><a name="p14984123312515"></a>Tsm</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p159841033855"><a name="p159841033855"></a><a name="p159841033855"></a>-</p>
</td>
</tr>
<tr id="row16951435551"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19984933457"><a name="p19984933457"></a><a name="p19984933457"></a>pnasnet5large</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p89846335512"><a name="p89846335512"></a><a name="p89846335512"></a>-</p>
</td>
</tr>
<tr id="row2095113520514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1798416331952"><a name="p1798416331952"></a><a name="p1798416331952"></a>Gaitset</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p098417336516"><a name="p098417336516"></a><a name="p098417336516"></a>-</p>
</td>
</tr>
<tr id="row89516351511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11985153312516"><a name="p11985153312516"></a><a name="p11985153312516"></a>fcn</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p169858331155"><a name="p169858331155"></a><a name="p169858331155"></a>-</p>
</td>
</tr>
<tr id="row5953353513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18985103311514"><a name="p18985103311514"></a><a name="p18985103311514"></a>Albert</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098513334519"><a name="p2098513334519"></a><a name="p2098513334519"></a>-</p>
</td>
</tr>
<tr id="row119533516513"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p598511336511"><a name="p598511336511"></a><a name="p598511336511"></a>AdvancedEast</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p119850331513"><a name="p119850331513"></a><a name="p119850331513"></a>-</p>
</td>
</tr>
<tr id="row39511356512"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p698553311512"><a name="p698553311512"></a><a name="p698553311512"></a>ReidStrongBaseline</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198514331659"><a name="p1198514331659"></a><a name="p1198514331659"></a>-</p>
</td>
</tr>
<tr id="row129463518517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p99851633158"><a name="p99851633158"></a><a name="p99851633158"></a>Fast-scnn</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1298514331359"><a name="p1298514331359"></a><a name="p1298514331359"></a>-</p>
</td>
</tr>
<tr id="row9942035757"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p109854331151"><a name="p109854331151"></a><a name="p109854331151"></a>RDN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1198583317511"><a name="p1198583317511"></a><a name="p1198583317511"></a>-</p>
</td>
</tr>
<tr id="row79415357517"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6985833351"><a name="p6985833351"></a><a name="p6985833351"></a>SRFlow</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p29851033350"><a name="p29851033350"></a><a name="p29851033350"></a>-</p>
</td>
</tr>
<tr id="row12947357514"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149859334518"><a name="p149859334518"></a><a name="p149859334518"></a>MGN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p19851833850"><a name="p19851833850"></a><a name="p19851833850"></a>-</p>
</td>
</tr>
<tr id="row3941735855"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p898533316518"><a name="p898533316518"></a><a name="p898533316518"></a>Roberta</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p998553318518"><a name="p998553318518"></a><a name="p998553318518"></a>-</p>
</td>
</tr>
<tr id="row1093335856"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1985533451"><a name="p1985533451"></a><a name="p1985533451"></a>RegNetY</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p59851033355"><a name="p59851033355"></a><a name="p59851033355"></a>-</p>
</td>
</tr>
<tr id="row49373518516"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p19986173311512"><a name="p19986173311512"></a><a name="p19986173311512"></a>VoVNet-39</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p798683310515"><a name="p798683310515"></a><a name="p798683310515"></a>-</p>
</td>
</tr>
<tr id="row5930351357"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p189862336515"><a name="p189862336515"></a><a name="p189862336515"></a>RegNetX</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1398618331651"><a name="p1398618331651"></a><a name="p1398618331651"></a>-</p>
</td>
</tr>
<tr id="row169312351655"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p149863337513"><a name="p149863337513"></a><a name="p149863337513"></a>RefineNet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p2098615331959"><a name="p2098615331959"></a><a name="p2098615331959"></a>-</p>
</td>
</tr>
<tr id="row11931235957"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1198616331657"><a name="p1198616331657"></a><a name="p1198616331657"></a>RefineDet</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1698611332518"><a name="p1698611332518"></a><a name="p1698611332518"></a>-</p>
</td>
</tr>
<tr id="row189215359511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p16986183319512"><a name="p16986183319512"></a><a name="p16986183319512"></a>AlignedReID</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1898715331055"><a name="p1898715331055"></a><a name="p1898715331055"></a>-</p>
</td>
</tr>
<tr id="row89213351858"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p119878330511"><a name="p119878330511"></a><a name="p119878330511"></a>FaceBoxes</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p129878331158"><a name="p129878331158"></a><a name="p129878331158"></a>-</p>
</td>
</tr>
</tbody>
</table>
### Modified Features
N/A
### Resolved Issues
N/A
### Known Issues
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>Known Issue</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>Data type support</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPUs do not support the input or output of the inf/nan data of the float16 type.</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>Data format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>Dimensions cannot be reduced when the format larger than 4D is used.</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>Restrictions on collective communication</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>The graphs executed on different devices in a training job must be the same.</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>Allocation at only 1, 2, 4, or 8 processors is supported.</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>Only the int8, int32, float16, and float32 data types are supported.</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex function</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>In the current version, Apex is implemented mainly using Python, and the customized optimization of CUDA kernel in Apex is not supported.</p>
</td>
</tr>
</tbody>
</table>
### Compatibility
Atlas 800 (model 9010): CentOS 7.6, Ubuntu 18.04, BC-Linux 7.6, Debian 9.9, Debian 10, and openEuler 20.03 LTS.
Atlas 800 (model 9000): CentOS 7.6, Euler 2.8, Kylin v10, BC-Linux 7.6, OpenEuler 20.03 LTS, and UOS 20 1020e.
## FrameworkPTAdapter 2.0.2
### Before You Start
This framework is modified based on the open-source PyTorch 1.5.0 primarily developed by Facebook, inherits native PyTorch features, and uses NPUs for dynamic image training. Models are adapted by operator granularity, code can be reused, and current networks can be ported and used on NPUs with only device types or data types modified.
### New Features
**Table 1** Features supported by PyTorch
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.489999999999998%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>Level-1 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="26.3%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>Level-2 Feature</p>
</th>
<th class="cellrowborder" valign="top" width="63.21%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row171322953713"><td class="cellrowborder" rowspan="7" valign="top" width="10.489999999999998%" headers="mcps1.2.4.1.1 "><p id="p10237517181"><a name="p10237517181"></a><a name="p10237517181"></a>Adapted training models</p>
</td>
<td class="cellrowborder" valign="top" width="26.3%" headers="mcps1.2.4.1.2 "><p id="p6134294377"><a name="p6134294377"></a><a name="p6134294377"></a>YOLOv4</p>
</td>
<td class="cellrowborder" valign="top" width="63.21%" headers="mcps1.2.4.1.3 "><p id="p314533811397"><a name="p314533811397"></a><a name="p314533811397"></a>-</p>
</td>
</tr>
<tr id="row15990182233714"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p399019224374"><a name="p399019224374"></a><a name="p399019224374"></a>YOLOv3</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1714553816396"><a name="p1714553816396"></a><a name="p1714553816396"></a>-</p>
</td>
</tr>
<tr id="row5301255373"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1530325123719"><a name="p1530325123719"></a><a name="p1530325123719"></a>DB</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p5146193819390"><a name="p5146193819390"></a><a name="p5146193819390"></a>-</p>
</td>
</tr>
<tr id="row274203413712"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p197423343379"><a name="p197423343379"></a><a name="p197423343379"></a>RFCN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p15828941153919"><a name="p15828941153919"></a><a name="p15828941153919"></a>-</p>
</td>
</tr>
<tr id="row78671918163714"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p188671318183713"><a name="p188671318183713"></a><a name="p188671318183713"></a>CRNN</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p10828241123917"><a name="p10828241123917"></a><a name="p10828241123917"></a>-</p>
</td>
</tr>
<tr id="row16912221171"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p6913132676"><a name="p6913132676"></a><a name="p6913132676"></a>Densenset161</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p209131221474"><a name="p209131221474"></a><a name="p209131221474"></a>-</p>
</td>
</tr>
<tr id="row1016073314719"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p3160153320717"><a name="p3160153320717"></a><a name="p3160153320717"></a>Densenset191</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1516012331173"><a name="p1516012331173"></a><a name="p1516012331173"></a>-</p>
</td>
</tr>
<tr id="row9627165910386"><td class="cellrowborder" rowspan="4" valign="top" width="10.489999999999998%" headers="mcps1.2.4.1.1 "><p id="p1561535993811"><a name="p1561535993811"></a><a name="p1561535993811"></a>PyTorch features adapted to NPUs</p>
</td>
<td class="cellrowborder" valign="top" width="26.3%" headers="mcps1.2.4.1.2 "><p id="p136151659163819"><a name="p136151659163819"></a><a name="p136151659163819"></a>Basic framework functions</p>
</td>
<td class="cellrowborder" valign="top" width="63.21%" headers="mcps1.2.4.1.3 "><p id="p1661535983813"><a name="p1661535983813"></a><a name="p1661535983813"></a>Added the function of adapted operator development. For details, see the operator list.</p>
</td>
</tr>
<tr id="row7627155917380"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1561525916383"><a name="p1561525916383"></a><a name="p1561525916383"></a>Model Accuracy Analyzer</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p19616115953816"><a name="p19616115953816"></a><a name="p19616115953816"></a>Added the Model Accuracy Analyzer and supported training accuracy demarcation.</p>
</td>
</tr>
<tr id="row46269593383"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p0616559163819"><a name="p0616559163819"></a><a name="p0616559163819"></a>Ascend 710 AI Processor</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p186161459193813"><a name="p186161459193813"></a><a name="p186161459193813"></a>Supported the online inference on Ascend 710 AI Processors.</p>
</td>
</tr>
<tr id="row76261059153817"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p11616175953812"><a name="p11616175953812"></a><a name="p11616175953812"></a>OS compatibility</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p8935115971714"><a name="p8935115971714"></a><a name="p8935115971714"></a>Supported Ubuntu 18.04.5 and openEuler 20.03 LTS.</p>
</td>
</tr>
</tbody>
</table>
### Modified Features
N/A
### Resolved Issues
N/A
### Known Issues
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>Known Issue</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>Data type support</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPUs do not support the input or output of the inf/nan data of the float16 type.</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>Data format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>Dimensions cannot be reduced when the format larger than 4D is used.</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>Restrictions on collective communication</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>The graphs executed on different devices in a training job must be the same.</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>Allocation at only 1, 2, 4, or 8 processors is supported.</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>Only the int8, int32, float16, and float32 data types are supported.</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex function</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>In the current version, Apex is implemented mainly using Python, and the customized optimization CUDA kernel in Apex is not supported.</p>
</td>
</tr>
</tbody>
</table>
### Compatibility
Atlas 800 (model 9010): CentOS 7.6/Ubuntu 18.04/BC-Linux 7.6/Debian 9.9/Debian 10/openEuler 20.03 LTS
Atlas 800 (model 9000): CentOS 7.6/EulerOS 2.8/Kylin v10/BC-Linux 7.6/openEuler 20.03 LTS
File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

File diff suppressed because it is too large Load Diff
@@ -11,7 +11,7 @@
- [安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md)
<h2 id="简介md">简介</h2>
用户在准备相关环境进行基于PyTorch框架模型的开发、运行时,可以选择在服务器中手动编译安装PyTorch框架相关模块。
用户在准备相关环境进行基于PyTorch框架模型的开发、运行时,可以选择在服务器中手动编译安装PyTorch框架相关模块。
**图 1** 环境准备流程图<a name="zh-cn_topic_0000001119176876_fig1938918396117"></a>
@@ -35,18 +35,21 @@
- 需完成CANN开发或运行环境的安装,具体操作请参考《CANN 软件安装指南》。
##### Ascend配套软件
| AscendPytorch版本 | CANN版本 | 支持PyTorch版本 |
| :---------------- | ---------- | -------------------------------------- |
| ----------------- | ---------- | -------------------------------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0 |
| 2.0.3 | CANN 5.0.3 | 1.5.0/1.8.1(1.8.1仅支持resnet50模型) |
| 2.0.4 | CANN 5.0.4 | 1.5.0/1.8.1(1.8.1仅支持resnet50模型) |
- 需安装3.12.0以上版本的CMake,安装方法请参考[CMake安装方法](#CMake安装方法md)。
- 需确保已安装7.3.0以上版本的gcc,7.3.0版本gcc具体安装及使用方式请参考[安装7.3.0版本gcc](#安装7-3-0版本gccmd)。
- 需安装python版本为3.7.5或3.8。
- 需安装python版本为3.7.5、3.8、3.9。
- 需注意torch1.5版本不支持python3.9编译安装(与官方保持一致),仅torch1.8.1版本支持python版本3.9进行编译安装。
- 需确保环境中已安装patch、git工具,以Ubuntu和CentOS系统为例,命令如下:
- Ubuntu系统
@@ -79,12 +82,15 @@
pip3 install wheel
```
3. 获取PyTorch源代码。
3. 获取PyTorch源代码。
1. 运行如下命令,获取适配昇腾AI处理器的PyTorch源代码。
1. 运行如下命令,获取适配昇腾AI处理器的PyTorch源代码,并切换到所需的分支。
```
git clone https://gitee.com/ascend/pytorch.git
# 默认是masterf分支,若需要其他分支请使用git checkout 命令切换
cd pytorch
git checkout -b 2.0.4.tr5 remotes/origin/2.0.4.tr5
```
下载的源码主要目录结构如下所示:
@@ -154,15 +160,18 @@
bash build.sh --python=3.7
或
bash build.sh --python=3.8
或
bash build.sh --python=3.9 #torch1.5不支持使用python3.9编译安装
```
请指定环境中python版本进行编译。生成的二进制包在当前的dist目录下,即“pytorch/pytorch/dist”文件夹目录下。
5. <a name="zh-cn_topic_0000001152776301_li49671667141"></a>安装PyTorch。
进入“pytorch/pytorch/dist“文件夹目录,执行如下命令安装。
```
cd dist
pip3 install --upgrade torch-1.5.0+ascend.post3-cp37-cp37m-linux_{arch}.whl
```
@@ -180,7 +189,8 @@
1. 配置运行环境变量,在适配昇腾AI处理器的PyTorch源代码根目录中运行如下命令。
```
source pytorch/env.sh
cd ../
source env.sh
```
2. 请依据实际场景,选择合适的HCCL初始化方式,并配置相应环境变量。
@@ -269,9 +279,9 @@
<p id="zh-cn_topic_0000001152616261_p1167163719217"><a name="zh-cn_topic_0000001152616261_p1167163719217"></a><a name="zh-cn_topic_0000001152616261_p1167163719217"></a>缺省时,按照以下优先级选定host通信网卡名:docker/local以外网卡(网卡名字字典序升序排列)&gt;docker 网卡 &gt; local网卡</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row1371356152313"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p15106173103120"><a name="p15106173103120"></a><a name="p15106173103120"></a>PTCOPY_ENABLE</p>
<tr id="zh-cn_topic_0000001152616261_row234714854615"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p2034724894619"><a name="zh-cn_topic_0000001152616261_p2034724894619"></a><a name="zh-cn_topic_0000001152616261_p2034724894619"></a>PTCOPY_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p71055317311"><a name="p71055317311"></a><a name="p71055317311"></a>使用PTCopy算子模式,加速转连续及copy等过程,建议开启,开启设置为1</p>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p53477489462"><a name="zh-cn_topic_0000001152616261_p53477489462"></a><a name="zh-cn_topic_0000001152616261_p53477489462"></a>使用PTCopy算子模式,加速转连续及Copy等过程,建议开启,开启设置为1。</p>
</td>
</tr>
<tr id="row743212132309"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p17433111312307"><a name="p17433111312307"></a><a name="p17433111312307"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
@@ -325,6 +335,8 @@
</tbody>
</table>
<h3 id="安装混合精度模块md">安装混合精度模块</h3>
#### 前提条件<a name="zh-cn_topic_0000001106176190_section3225481020"></a>
@@ -340,7 +352,7 @@
1. 运行如下命令,获取适配昇腾AI处理器的apex源代码。
```
git clone -b 2.0.3.tr5 https://gitee.com/ascend/apex.git
git clone -b 2.0.4.tr5 https://gitee.com/ascend/apex.git
```
下载的源码主要目录结构如下所示:
@@ -0,0 +1,922 @@
# 概述
用户可以从Ascend ModelZoo获得PyTorch训练模型,但不支持多机多卡训练,需要根据模型的实际代码进行修改。本文帮助用户快速实现Pytorch模型在多机多卡上使用DDP(Distributed Data Parallel)模式训练。
# 训练流程
PyTorch模型多机多卡训练流程一般包括准备环境、准备模型、修改模型、启动训练四个部分。
1. 准备环境。
准备多机多卡训练的软件、硬件、网络环境,包括开发和运行环境搭建、集群组网链接、芯片IP设置、防火墙设置等。
2. 准备模型。
准备PyTorch模型、数据加载器、优化器等训练需要的模块,从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)获取,也可以自行实现。
3. 修改模型。
在基础模型上进行修改,添加DDP需要的代码和环境变量,使模型支持在多机多卡训练。
4. 启动训练。
实现在多机多卡环境启动模型训练并查看训练日志。
# 快速上手
## 概述
通过示例帮助用户快速了解PyTorch模型是如何在多机多卡上训练的。该示例使用自定义模型实现两台计算机8卡训练。两台计算机分别命名为AI Server0、AI Server1,每台计算机上的8个Ascend 910处理器命名为device 0~7。
## 准备环境
首先您需要具有至少两台装有Ascend 910处理器的计算机,并保证每台计算机都正确的安装NPU固件和驱动。
1. 准备开发和运行环境。
在每台计算机上分别完成开发和运行环境准备。
- 完成CANN开发和运行环境的安装,请参见《CANN 软件安装指南》,支持5.0.3以后版本。
- 安装适配NPU的PyTorch,安装方法请参见《PyTorch安装指南》。
2. 准备组网。
通过交换机或光口直连的方式完成计算设备组网搭建,搭建方法请参见《[数据中心训练场景组网](https://support.huawei.com/enterprise/zh/doc/EDOC1100221993/229cc0e4)》。
该示例中采用两台计算机8卡进行训练,故可以采用光口直连的方式准备组网。
3. 配置device IP
在AI Server0上配置device IP。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.101 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.101 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.101 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.101 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.100 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.100 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.100 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.100 netmask 255.255.255.0
```
在AI Server1上配置device IP。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
hccn_tool -i 1 -ip -s address 192.168.101.111 netmask 255.255.255.0
hccn_tool -i 2 -ip -s address 192.168.102.111 netmask 255.255.255.0
hccn_tool -i 3 -ip -s address 192.168.103.111 netmask 255.255.255.0
hccn_tool -i 4 -ip -s address 192.168.100.110 netmask 255.255.255.0
hccn_tool -i 5 -ip -s address 192.168.101.110 netmask 255.255.255.0
hccn_tool -i 6 -ip -s address 192.168.102.110 netmask 255.255.255.0
hccn_tool -i 7 -ip -s address 192.168.103.110 netmask 255.255.255.0
```
4. 配置防火墙
- Ubuntu系统防火墙关闭命令
```shell
ufw disable
- Redhat或CentOS 7系统防火墙关闭命令
```shell
systemctl stop firewalld
## 准备模型
该示例创建一个简单的模型,供用户快速了解多机多卡训练。用户也可以从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)获取基于Ascned NPU的PyTorch训练模型。
1. DDP模型。
实现一个简单的样例main.py用于多机多卡训练。
```python
import argparse
import os
import torch
import torchvision
import torch.nn as nn
import torch.nn.functional as F
import torch.distributed as dist
from torch.nn.parallel import DistributedDataParallel as DDP
### 1.基础模块 ###
# 搭建模型
class ToyModel(nn.Module):
def __init__(self):
super(ToyModel, self).__init__()
self.conv1 = nn.Conv2d(3, 6, 5)
self.pool = nn.MaxPool2d(2, 2)
self.conv2 = nn.Conv2d(6, 16, 5)
self.fc1 = nn.Linear(16 * 5 * 5, 120)
self.fc2 = nn.Linear(120, 84)
self.fc3 = nn.Linear(84, 10)
def forward(self, x):
x = self.pool(F.relu(self.conv1(x)))
x = self.pool(F.relu(self.conv2(x)))
x = x.view(-1, 16 * 5 * 5)
x = F.relu(self.fc1(x))
x = F.relu(self.fc2(x))
x = self.fc3(x)
return x
# 获取数据集方法
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
### 2. 初始化参数、数据、模型、损失函数、优化器 ####
# 获取local_rank和addr参数
parser = argparse.ArgumentParser()
parser.add_argument("--local_rank", default=-1, type=int)
parser.add_argument("--addr", default='127.0.0.1', type=str, help='master addr')
FLAGS = parser.parse_args()
local_rank = FLAGS.local_rank
addr = FLAGS.addr
# 设置系统的Master地址和端口
os.environ['MASTER_ADDR'] = addr
os.environ['MASTER_PORT'] = '29501'
# DDP backend初始化
loc = 'npu:{}'.format(local_rank)
torch.npu.set_device(loc)
dist.init_process_group(backend='hccl') # hccl是NPU设备上的后端
# 准备数据,要在DDP初始化之后进行
trainloader = get_dataset()
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重,在构造DDP模型之前,且只需要在master上加载就行了。
ckpt_path = None
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# 构造DDP model
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
### 3. 网络训练 ###
model.train()
iterator = range(100)
for epoch in iterator:
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. save模型的时候,和DP模式一样,有一个需要注意的点:保存的是model.module而不是model。
# 因为model其实是DDP model,参数是被`model=DDP(model)`包起来的。
# 2. 只需要在进程0上保存一次就行了,避免多次保存重复的东西。
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
2. 在单机多卡上运行训练,确保模型正确。
1. 用户自行安装模型脚本需要的Python第三方库。
2. 配置NPU环境变量,env_npu.sh脚本请参见附录。
```shell
source env_npu.sh
```
3. 使用torch.distributed.launch执行main.py如下命令在单机多卡上训练模型。
```shell
python -m torch.distributed.launch --nproc_per_node 8 main.py
```
`--nproc_per_node` 为训练卡的数量。
运行成功后,模型在该设备的8张NPU上进行训练。
## 修改模型
该快速上手提供的示例,已经对多机多卡训练进行了适配,不需要对脚本进行修改。其他模型的多机多卡适配修改,请参考”多机多卡训练“章节。
## 启动训练
1. 将main.py模型脚本上传至AI Server0和AI Server1任意路径下。
2. 查询服务器的host IP:
```shell
hostname -I
```
打印出所有IP,第一个为IP当前服务器的host IP。
比如:AI Server0服务器的host IP为:192.168.xx.22, AI Server1服务器的host IP为:192.168.xx.23。
3. 使用AI Server0为master节点,我们现在拉起2 x 8的集群。
在AI server0服务器上启动命令:
```shell
# 设置环境变量,env_npu.sh脚本内容从附录获取
source env_npu.sh
# 关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=192.168.xx.22
#
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=0 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
在AI server1服务器上启动命令:
```shell
# 设置环境变量,env_npu.sh脚本内容从附录获取
source env_npu.sh
# 关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=192.168.xx.23
python3.7 -m torch.distributed.launch --nnodes=2 --node_rank=1 --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
参数说明。
--nnode:指定用来分布式训练脚本的节点数。
--node_rank:多节点分布式训练时,指定当前节点的 rank。
--nproc_per_node:指定当前节点上,使用GPU训练的进程数。
--master_addr:master节点(rank为0)的地址,应该为ip地址或者node 0 的 hostname。
--master_port:指定分布式训练中,master 节点使用的端口号。
--addr:main.py 脚本的入参,输入master节点的host IP。
3. host日志查看
host日志保存在`~/ascend/log`路径下,用户可以到该路径下查看每个host的device日志。
通过该简单的示例您已经完成了多机多卡模型的训练。
# 多机多卡训练
## 常用概念及参数介绍
pytorch分布式训练基本概念
| 基本概念 | 说明 |
| ---------- | ------------------------------------------------------------ |
| AI Server | 带有Ascend 910处理器的计算机,多台计算机用AI Server0+序号表示,如AI Server0、AI Server1。 |
| device | AI Server上Ascend 910卡,多卡用device 0、device 1……device 7表示。 |
| host | AI Server主机。 |
| master | 在多台AI Server选取一台作为master,作为数据通信的主机。 |
| group | 即进程组。默认情况下,只有一个组,采用用默认的就行。 |
| world size | 表示全局的进程并行数,可通过torch.distributed.get_world_size()获取, 在不同进程里,该值是一样的。 |
| rank | 表示当前进的序号, 用于进程间通讯。比如是2x8的集群,world size 就是16,rank在每个进程里依次是0,1,2,…,15。 |
| local_rank | 每台机子上的进程的序号。机器一上有0,1,2,3,4,5,6,7,机器二上也有0,1,2,3,4,5,6,7。一般情况下,你需要用这个local_rank来设置当前模型是跑在当前机器的哪块GPU/NPU上面的。 |
使用torch.distributed.launch启动多卡训练时的参数
| 参数名称 | 说明 |
| ------------------ | ------------------------------------------------------------ |
| **nnodes** | 指定用来分布式训练脚本的节点数 |
| **node_rank** | 多节点分布式训练时,指定当前节点的 rank |
| **nproc_per_node** | 指定当前节点上,使用GPU训练的进程数。建议将该参数设置为当前节点的GPU数量,这样每个进程都能单独控制一个GPU,效率最高。 |
| **master_addr** | master节点(rank为0)的地址,应该为ip地址或者node 0 的 hostname。对于单节点多进程训练的情况,该参数可以设置为 127.0.0.1。 |
| **master_port**: | 指定分布式训练中,master 节点使用的端口号,必须与其他应用的端口号不冲突。 |
## 多机多卡训练流程
### 准备环境
首先您需要具有至少两台AI Server(装有Ascend 910处理器的计算机),并保证每台计算机已安装正确版本的NPU固件和驱动。
1. 准备开发和运行环境。
在每台计算机上分别完成开发和运行环境准备。
- 完成CANN开发和运行环境的安装,请参见《CANN 软件安装指南》,支持5.0.3以后版本。
- 安装适配NPU的PyTorch,安装方法请参见《PyTorch安装指南》。
2. 准备组网。
集群训练由多台装有Ascend 910处理器的计算机完成(最多128台),需要配合交换机组成数据面全连接主备网络,支持8 x n卡训练场景,2台机器可以采用光口直连的方式。搭建方法请参见《[数据中心训练场景组网](https://support.huawei.com/enterprise/zh/doc/EDOC1100221993/229cc0e4)》。
3. 配置device IP
使用hccn_tool工具配置device IP,hccn_tool工具CANN软件以提供。
```shell
hccn_tool -i 0 -ip -s address 192.168.100.111 netmask 255.255.255.0
```
配置device IP需遵守以下规则:
1. AI Server中的第0/4,1/5,2/6,3/7号device需处于同一网段,第0/1/2/3号device在不同网段,第4/5/6/7号device在不同网段。
2. 对于集群场景,各AI Server对应的位置的device需处于同一网段,AI Server0和AI Server1的0号网卡需处于同一网段、1号网卡需要在同一网段
3. 每个IP都不能冲突,相同网段下的IP需在最后8位做区分
使用hccn_tool工具验证device IP是否配置正确。
- 查询每个device的ip。
```shell
hccn_tool -i 0 -ip –g
```
打印查询结果:
> ipaddr:192.168.100.101
>
> netmask:255.255.255.0
- 使用hccn_tool 确保2机器的卡间连通性,从device0 - devcie7 测试8次,确保所有两机间所有卡都连通。
```shell
hccn_tool -i 0 -netdetect -s address xx.xx.xx.xx
hccn_tool -i 0 -net_health –g
```
-i:device序号
-s address:xx.xx.xx.xx是另外一台机器的device i的IP
如果返回`success`则表示已经连通。
4. 配置防火墙
在进行HCCL通信的时候可能出现防火墙拦截通信端口导致通信超时,因此在运行pytorch的集群训练的时候需要注意将服务器上的防火墙关闭。
- Ubuntu系统防火墙关闭命令
```shell
ufw disable
```
- Redhat或CentOS 7系统防火墙关闭命令
```shell
systemctl stop firewalld
```
### 准备模型
准备模型阶段主要有两种方式。
- 从[开源社区](https://gitee.com/ascend/modelzoo/tree/master/built-in/PyTorch)下载PyTorch训练模型
从开源社区获取的模型已经支持单机多卡训练,请用户参照“修改模型”小节需要修改的项目,根据具体模型完成相应修改。
- 手动搭建PyTorch训练模型
1. 准备PyTorch训练模型、数据加载器
准备PyTorch模型。
```python
class ToyModel(nn.Module):
def __init__(self):
...
def forward(self,x):
...
```
准备数据获取方法。
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
trainloader = torch.utils.data.DataLoader(my_trainset,batch_size=16,)
return trainloader
trainloader=get_dataset()
```
2. 实例化模型
```python
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重
if ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
```
3. 准备损失函数和优化器。
```python
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
```
4. 训练模型
```python
### 3. 网络训练 ###
model.train()
iterator = range(100)
for epoch in iterator:
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
torch.save(model.state_dict(), "%d.ckpt" % epoch)
```
### 修改模型
模型修改主要涉及以下6项,包括master ip地址和端口的设置,distributed初始化,模型DDP初始化,数据DDP初始化,优化器初始化,DDP模型训练方法修改。请用户结合初始模型代码,灵活修改。
1. 设置master ip地址和端口,在NPU进行分布式训练使用HCCL进行通信,在PyTorch中使用的是自动拓扑探测的HCCL通信机制,即不需要使用RANK_TABLE_FLIE,但是其依赖于host侧的网卡进行通信,因此需要在代码中设置环境变量来设置通信网卡。
```python
os.environ['MASTER_ADDR'] = xxx.xxx.xxx.xxx
os.environ['MASTER_PORT'] = 'xxx'
```
MASTER_ADDR:设置为集群中master的IP(任意挑选一台作为master即可)
MASTER_PORT:设置为master的一个空闲端口
master ip地址和端口在模型代码中一般会设置为传参的形式,也有可能某些开源代码中设置为"127.0.0.1",需要进行修改。
上述变量需在调用torch.distributed.init_process_group()之前声明。
2. distributed初始化
PyTorch中使用`dist.init_process_group(backend='hccl', world_size=world_size, rank=rank)`来初始化线程组其中参数含义如下。
`backend`:进行分布式训练的使用的通信协议,在NPU上只能使用"hccl"
`world_size`:进行训练时使用的device的总数
`rank`: 当前初始化的device的rank_id,也就是全局的逻辑ID
有两种方法启动多卡训练,分别初始化的方法如下。
- 使用torch.distributed.launch启动多卡训练。
```python
import torch.distributed as dist
dist.init_process_group(backend='hccl') # hccl是NPU设备上的后端
```
- 使用mp.spawn启动多卡训练。
```python
import torch.distributed as dist
def main_worker(pid_idx, device_nums_per_node, args):
args.distributed_rank = args.rank * device_nums_per_node + pid_idx
dist.init_process_group(backend=args.dist_backend, world_size=args.distributed_world_size, rank=args.distributed_rank)
```
其中:
`pid_idx`:device序号。
`device_nums_per_node`:每个AI Server的device数量。
3. 模型DDP初始化
```python
# 实例化模型
model = ToyModel().to(loc)
# 加载模型权重,在构造DDP模型之前,且只需要在master上加载。
if dist.get_rank() == 0 and ckpt_path is not None:
model.load_state_dict(torch.load(ckpt_path))
# 构造DDP model
model = DDP(model, device_ids=[local_rank], output_device=local_rank)
```
4. 数据DDP初始化
```python
def get_dataset():
transform = torchvision.transforms.Compose([
torchvision.transforms.ToTensor(),
torchvision.transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))
])
my_trainset = torchvision.datasets.CIFAR10(root='./data', train=True,
download=True, transform=transform)
train_sampler = torch.utils.data.distributed.DistributedSampler(my_trainset)
trainloader = torch.utils.data.DataLoader(my_trainset,
batch_size=16, num_workers=2, sampler=train_sampler)
return trainloader
trainloader = get_dataset()
```
5. 损失方法、优化器。
```python
# 初始化优化器,在构造DDP model之后,用model初始化optimizer。
optimizer = torch.optim.SGD(model.parameters(), lr=0.001)
# 初始化损失函数
loss_func = nn.CrossEntropyLoss().to(loc)
```
6. DDP模型训练
```python
model.train()
iterator = range(100)
for epoch in iterator:
# 设置epoch
trainloader.sampler.set_epoch(epoch)
for data, label in trainloader:
data, label = data.to(local_rank), label.to(local_rank)
optimizer.zero_grad()
prediction = model(data)
loss = loss_func(prediction, label)
loss.backward()
print("loss = %0.3f \n" % loss)
optimizer.step()
# 1. save模型的时候,和DP模式一样,有一个需要注意的点:保存的是model.module而不是model。
# 因为model其实是DDP model,参数是被`model=DDP(model)`包起来的。
# 2. 只需要在进程0上保存一次就行了,避免多次保存重复的东西。
if dist.get_rank() == 0:
torch.save(model.module.state_dict(), "%d.ckpt" % epoch)
```
### 启动训练
启动训练提供两种方式,手动启动和shell脚本启动
- 手动启动(使用torch.distributed.launch方式启动)
1. 配置NPU 环境变量,请参考附录提供的env_npu.sh脚本
2. 添加环境变量,多机训练需要增加`HCCL_WHITELIST_DISABLE`和`HCCL_IF_IP`环境变量。
- HCCL_WHITELIST_DISABLE:HCCL通道白名单,一般性设置为1表示关闭白名单。
- HCCL_IF_IP:HCCL初始化通信网卡IP,设置为当前服务器的host网卡IP。
3. 将修改的模型脚本上传至每个AI Server
4. 在每个AI Server上安装必要Python库
5. 任选一个AI Server作为masker节点,并查询每个AI Server的IP。
6. 在每个AI server服务器上启动命令
```
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr 192.168.xx.22 --master_port 29501 main.py --addr 192.168.xx.22
```
其中:
--nnodes:用来分布式训练脚本的AI server数。
--node_rank:AI server的序号,每个AI server有对应的序号。
--nproc_per_node:每个AI server的device数量。
--master_addr:作为maskter节点的AI server IP地址。
--master_port: 作为maskter节点的AI server 端口号。
main.py:请修改为启动脚本名称。
--addr :传入启动脚本的参数,master IP地址。
- 使用OpenMPI启动
1. 安装 OpenMPI开源库
多机多卡环境下分布式训练部署依赖于OpenMPI开源库,参与模型训练的每台服务器都需要安装OpenMPI开源库。目前OpenMPI开源库的版本要求为4.0.1、4.0.2或4.0.3。
执行`mpirun --version`命令检查是否已安装OpenMPI。如果返回`mpirun (Open MPI) 4.0.2 Report bugs to http://www.open-mpi.org/community/help/` ,说明已经安装。如果已安装,且版本为4.0.1、4.0.2或4.0.3其中一个,则无需再安装。
否则请按照如下步骤安装OpenMPI:
1. 访问如下链接下载OpenMPI软件包。例如openmpi-4.0.2.tar.bz2。
https://www.open-mpi.org/software/ompi/v4.0/
2. 以root用户登录安装环境。
3. 将下载的OpenMPI软件包上传到安装环境的某一目录下。
4. 进入软件包所在目录,执行如下命令解压软件包。
```shell
tar -jxvf openmpi-4.0.2.tar.bz2
```
5. 进入解压后的目录,执行如下命令配置、编译和安装。
```shell
./configure --prefix=/usr/local/mpirun4.0.2
make
make install
```
其中“--prefix”参数用于指定OpenMPI安装路径,用户根据实际情况进行修改。
6. 执行vi ~/.bashrc命令,打开.bashrc文件,在文件的最后添加如下环境变量。
```shell
export OPENMPI=/usr/local/mpirun4.0.2
export LD_LIBRARY_PATH=$OPENMPI/lib
export PATH=$OPENMPI/bin:$PATH
```
其中“/usr/local/mpirun4.0.2”为OpenMPI安装路径,用户需要根据实际进行修改。
执行:wq!命令保存文件并退出。
7. 执行如下命令使环境变量生效。
```
source ~/.bashrc
```
8. 安装完成之后,执行如下命令查看安装版本,如果返回正确的版本信息,则说明安装成功。
```
mpirun --version
```
2. 配置AI Server SSH免密登录
如果使用OpenMPI在多机多卡环境下分布式训练部署,需要在每两台服务器之间配置SSH免密登录,确保服务器之间可以互通。具体操作步骤如下:
1. 以root用户登录每台服务器。
2. 配置集群中主机间的可信度。
打开并编辑**/etc/ssh/ssh_config**文件,在文件最后增加如下字段:
```
StrictHostKeyChecking no
UserKnownHostsFile /dev/null
```
3. 在每台服务器上分别打开**/etc/hosts**文件,在该文件中添加本服务器对应的IP地址和主机名,且需要添加到该文件的首行。如果文件中已添加,则跳过此步骤。添加内容示例如下:
```
10.90.140.199 ubuntu
```
其中10.90.140.199为该服务器的IP地址,ubuntu为主机名。
4. 在第一台服务器执行如下命令生成公钥(例如第一台服务器IP为10.90.140.199)。
```
cd ~/.ssh/ # 若没有该目录,请先执行一次ssh localhost
ssh-keygen -t rsa # 生成秘钥,会出现提示,连续点击3次"Enter"即可
mv id_rsa.pub authorized_keys # 将生成的秘钥id_rsa.pub重命名为公钥authorized_keys
```
5. 在其他每台服务器上都生成秘钥,并复制到第一台服务器的authorized_keys文件中。
1. 在其他每台服务器上执行如下命令生成秘钥。
cd ~/.ssh/
ssh-keygen -t rsa
2. 将其他每台服务器上生成的秘钥文件id_rsa.pub下载到本地,并复制该文件中的秘钥。
3. 在第一台服务器内执行如下命令打开公钥文件authorized_keys,将[5.b](#li361025101116 "link to:#li361025101116
ctrl +click to jump")复制的其他每台服务器的秘钥粘贴到第一台服务器的公钥后面。
```
vi ~/.ssh/authorized_keys
```
执行**:wq!**保存该文件。
6. 在其他每台服务器上执行如下命令将第一台服务器制作好的公钥复制到其他每台服务器内。
cd ~/.ssh/
scp root@10.90.140.199:~/.ssh/authorized_keys ./
7. 在每台服务器执行如下命令测试免密登录。
```
ssh 用户名@IP地址
```
例如:在第一台服务器10.90.140.199免密登录服务器10.90.140.231,执行**ssh root@10.90.140.231**命令。
若显示类似如下信息,说明已免密登录服务器10.90.140.231。
```
Linux ubuntu 4.19.28 #1 SMP Tue Jun 23 19:05:23 EDT 2020 x86_64
The programs included with the ubuntu GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
ubuntu GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Sep 15 14:37:21 2020 from 10.254.88.75
```
执行**exit**命令可以退出登录,若显示类似如下信息,说明已退出登录。
```
logout
Connection to 10.90.140.231 closed.
```
3. 使用OpenMPI拉起模型训练。
1. 分别为每一个AI server编写启动脚本,如train.sh,并将启动脚本分别移到相应AI server的同一路径下。
```
# 配置NPU环境变量,env_npu.sh脚本参见附录
source env_npu.sh
#关闭HCCL通道白名单
export HCCL_WHITELIST_DISABLE=1
# HCCL初始化通信网卡IP,设置为当前服务器的host IP
export HCCL_IF_IP=xxx.xxx.xx.xxx
python3 -m torch.distributed.launch --nnodes=${nnodes} --node_rank=i --nproc_per_node 8 --master_addr xxx.xxx.xx.xxx --master_port 29501 main.py --addr xxx.xxx.xx.xxx
```
脚本参数请参见手动启动。
2. 编写启动脚本
```
# 配置mpirun环境变量
export PATH=$PATH:/usr/local/mpirun4.0.2/bin
# 执行mpirun工具
mpirun -H xxx.xxx.xxx.xxx:1,xxx.xxx.xxx.xxx:1 \
--bind-to none -map-by slot \
--mca btl_tcp_if_exclude lo,docker0,endvnic\
--allow-run-as-root \
--prefix /usr/local/mpirun4.0.2/ \
./train.sh
```
其中
-H:每个AI server的IP:启动进程数。
--bind-to:绑定进程的策略。
--mca:特定上下文的MCA参数,arg0为参数名,arg1为参数值。
--allow-run-as-root:允许使用root用户运行。
--prefix:mpirun4.0.2路径。
./train.sh:各个AI server的启动脚本路径。
4.
训练成功后可以查看日志信息。
host日志保存在`~/ascend/log`路径下,用户可以到该路径下查看每个host的device日志。
# 附录
NPU环境变量配置脚本env_npu.sh,可使用该脚本进行运行和开发环境变量的配置。
```shell
#!/bin/bash
export install_path=/usr/local/Ascend
if [ -d ${install_path}/toolkit ]; then
export LD_LIBRARY_PATH=/usr/include/hdf5/lib/:/usr/local/:/usr/local/lib/:/usr/lib/:${install_path}/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons:${path_lib}:${LD_LIBRARY_PATH}
export PATH=${install_path}/fwkacllib/ccec_compiler/bin:${install_path}/fwkacllib/bin:$PATH
export PYTHONPATH=${install_path}/fwkacllib/python/site-packages:${install_path}/tfplugin/python/site-packages:${install_path}/toolkit/python/site-packages:$PYTHONPATH
export PYTHONPATH=/usr/local/python3.7.5/lib/python3.7/site-packages:$PYTHONPATH
export ASCEND_OPP_PATH=${install_path}/opp
else
if [ -d ${install_path}/nnae/latest ];then
exportLD_LIBRARY_PATH=/usr/local/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:/usr/local/lib/:/usr/lib64/:/usr/lib/:${install_path}/nnae/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64_64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/nnae/latest/fwkacllib/ccec_compiler/bin/:${install_path}/nnae/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/nnae/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/nnae/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/nnae/latest/fwkacllib/python/site-packages/:${install_path}/nnae/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/nnae/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/nnae/latest
else
export LD_LIBRARY_PATH=/usr/local/:/usr/local/lib/:/usr/lib64/:/usr/lib/:/usr/local/python3.7.5/lib/:/usr/local/openblas/lib:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/:${install_path}/driver/lib64/common/:${install_path}/driver/lib64/driver/:${install_path}/add-ons/:/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH
export PATH=$PATH:${install_path}/ascend-toolkit/latest/fwkacllib/ccec_compiler/bin/:${install_path}/ascend-toolkit/latest/toolkit/tools/ide_daemon/bin/
export ASCEND_OPP_PATH=${install_path}/ascend-toolkit/latest/opp/
export OPTION_EXEC_EXTERN_PLUGIN_PATH=${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libfe.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libaicpu_engine.so:${install_path}/ascend-toolkit/latest/fwkacllib/lib64/plugin/opskernel/libge_local_engine.so
export PYTHONPATH=${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/auto_tune.egg/auto_tune:${install_path}/ascend-toolkit/latest/fwkacllib/python/site-packages/schedule_search.egg:$PYTHONPATH
export ASCEND_AICPU_PATH=${install_path}/ascend-toolkit/latest
fi
fi
#将Host日志输出到串口,0-关闭/1-开启
export ASCEND_SLOG_PRINT_TO_STDOUT=0
#设置默认日志级别,0-debug/1-info/2-warning/3-error
export ASCEND_GLOBAL_LOG_LEVEL=3
#设置Event日志开启标志,0-关闭/1-开启
export ASCEND_GLOBAL_EVENT_ENABLE=0
#设置是否开启taskque,0-关闭/1-开启
export TASK_QUEUE_ENABLE=1
#HCCL白名单开关,1-关闭/0-开启
export HCCL_WHITELIST_DISABLE=1
#设置device侧日志登记为error
${install_path}/driver/tools/msnpureport -g error -d 0
${install_path}/driver/tools/msnpureport -g error -d 1
${install_path}/driver/tools/msnpureport -g error -d 2
${install_path}/driver/tools/msnpureport -g error -d 3
${install_path}/driver/tools/msnpureport -g error -d 4
${install_path}/driver/tools/msnpureport -g error -d 5
${install_path}/driver/tools/msnpureport -g error -d 6
${install_path}/driver/tools/msnpureport -g error -d 7
#关闭Device侧Event日志
${install_path}/driver/tools/msnpureport -e disable
path_lib=$(python3.7 -c """
import sys
import re
result=''
for index in range(len(sys.path)):
match_sit = re.search('-packages', sys.path[index])
if match_sit is not None:
match_lib = re.search('lib', sys.path[index])
if match_lib is not None:
end=match_lib.span()[1]
result += sys.path[index][0:end] + ':'
result+=sys.path[index] + '/torch/lib:'
print(result)"""
)
echo ${path_lib}
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib/:${path_lib}:$LD_LIBRARY_PATH
```
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

File diff suppressed because it is too large Load Diff
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

+132 -1
View File
@@ -1,4 +1,11 @@
# FrameworkPTAdapter 2.0.3 版本说明书
# FrameworkPTAdapter 2.0.4 版本说明书
- [FrameworkPTAdapter 2.0.4](#FrameworkPTAdapter-2-0-3md)
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
- [特性修改](#特性修改md)
- [已修复问题](#已修复问题md)
- [已知问题](#已知问题md)
- [兼容性](#兼容性md)
- [FrameworkPTAdapter 2.0.3](#FrameworkPTAdapter-2-0-3md)
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
@@ -13,6 +20,130 @@
- [已修复问题](#已修复问题-3md)
- [已知问题](#已知问题-4md)
- [兼容性](#兼容性-5md)
<h2 id="FrameworkPTAdapter-2-0-3md">FrameworkPTAdapter 2.0.4</h2>
<h3 id="用户须知md">用户须知</h3>
本框架基于Facebook主导的开源PyTorch1.5.0和1.8.1版本进行修改,延续原生的PyTorch特性,使用NPU进行动态图训练;以算子粒度进行模型适配,代码重用性好,支持现有的网络只修改设备类型或数据类型,即可迁移到NPU上使用。
PyTorch1.8.1版本延续PyTorch1.5.0特性,功能基本保持一致,对后端算子适配提供较好开发体验。当期1.8.1版本仅支持Resent50网络模型。
<h3 id="新增特性md">新增特性</h3>
**表 1** PyTorch支持的版本特性列表
<a name="t76c34275cbb74753970f7c5a9eb594fa"></a>
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="10.459999999999999%" id="mcps1.2.4.1.1"><p id="a7888762cf8294977b7d114b1c898d1bd"><a name="a7888762cf8294977b7d114b1c898d1bd"></a><a name="a7888762cf8294977b7d114b1c898d1bd"></a>一级特性</p>
</th>
<th class="cellrowborder" valign="top" width="26.27%" id="mcps1.2.4.1.2"><p id="a4581ffde4a5f455faadfba144243a9d4"><a name="a4581ffde4a5f455faadfba144243a9d4"></a><a name="a4581ffde4a5f455faadfba144243a9d4"></a>二级特性</p>
</th>
<th class="cellrowborder" valign="top" width="63.27%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="row7979351559"><td class="cellrowborder" rowspan="3" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>适配NPU的PyTorch1.5.0特性</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>精度对比工具完善</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>支持IR与对应TBE算子映射,支持在GPU侧加载NPU侧dump数据对比。</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>支持E2E prof工具</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>将PyTorch原生profiling工具和cann prof工具获取到的性能数据统一集成,实现端到端的模型和算子性能分析。</p>
</td>
</tr>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>框架基础功能</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a> 新增适配算子开发(详见算子清单)。</p>
</td>
</tr>
<tr id="row7979351559"><td class="cellrowborder" rowspan="2" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>适配NPU的PyTorch1.8.1特性</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>支持AMP</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>支持PyTorch原生自动混合精度。</p>
</td>
</tr>
<tr id="row109719353511"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p18983183315515"><a name="p18983183315515"></a><a name="p18983183315515"></a>支持Profiling</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p836221112812"><a name="p836221112812"></a><a name="p836221112812"></a>支持PyTorch原生Profiling功能。</p>
</td>
</tr>
<tr id="row7979351559"><td class="cellrowborder" rowspan="2" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>OS兼容性</p>
</td>
<td class="cellrowborder" valign="top" width="26.27%" headers="mcps1.2.4.1.2 "><p id="p149831333357"><a name="p149831333357"></a><a name="p149831333357"></a>OS兼容性</p>
</td>
<td class="cellrowborder" valign="top" width="63.27%" headers="mcps1.2.4.1.3 "><p id="p1398313336511"><a name="p1398313336511"></a><a name="p1398313336511"></a>新增支持Ubuntu20.04 x86+arm,Euler 2.10 arm系统。</p>
</td>
<tr id="row13971435754"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p79831331353"><a name="p79831331353"></a><a name="p79831331353"></a>Python版本兼容性</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>支持python3.9环境编译及使用(仅PyTorch1.8.1)。</p>
</td>
</tr>
</tbody>
</table>
<h3 id="特性修改md">特性修改</h3>
不涉及
<h3 id="已修复问题md">已修复问题</h3>
不涉及
<h3 id="已知问题md">已知问题</h3>
<a name="table1969972073016"></a>
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>已知问题</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>问题描述</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>数据类型支持</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPU不支持float16类型的inf/nan数据输入输出。</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>数据Format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>出现4D以上的format时不能降维。</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>集合通信约束</p>
<p id="p0465121912402"><a name="p0465121912402"></a><a name="p0465121912402"></a></p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>要求一次训练任务中不同device上执行的图相同。</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>当前只支持1/2/4/8P粒度的分配。</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>只支持int8,int32,float16和float32数据类型。</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex功能支持</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>Apex当前版本的实现方式主要为python实现,不支持APEX中的自定义优化CUDA Kernel。</p>
</td>
</tr>
</tbody>
</table>
<h3 id="兼容性md">兼容性</h3>
A800-9010:CentOS 7.6/Ubuntu 18.04, 2.04/BC-Linux 7.6/Debian 9.9/Debian 10/OpenEuler 20.03 LTS
A800-9000:CentOS 7.6/Ubuntu 18.04, 2.04/Euler 2.8, 2.10/Kylin v10/BC-Linux 7.6/OpenEuler 20.03 LTS/UOS 20 1020e
<h2 id="FrameworkPTAdapter-2-0-3md">FrameworkPTAdapter 2.0.3</h2>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 580 B

File diff suppressed because it is too large Load Diff
+1737 -483
View File
File diff suppressed because it is too large Load Diff
+105 -102
View File
@@ -1,6 +1,6 @@
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/CMakeLists.txt pytorch-develop-181/aten/CMakeLists.txt
--- pytorch-v1.8.1/aten/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/CMakeLists.txt 2021-12-04 10:36:12.835451477 +0800
+++ pytorch-develop-181/aten/CMakeLists.txt 2022-01-12 16:48:14.334567816 +0800
@@ -22,9 +22,11 @@
set(ATen_CPU_INCLUDE)
set(ATen_THIRD_PARTY_INCLUDE)
@@ -50,9 +50,21 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
set(ATen_HIP_INCLUDE ${ATen_HIP_INCLUDE} PARENT_SCOPE)
set(ATen_THIRD_PARTY_INCLUDE ${ATen_THIRD_PARTY_INCLUDE} PARENT_SCOPE)
set(ATen_CPU_DEPENDENCY_LIBS ${ATen_CPU_DEPENDENCY_LIBS} PARENT_SCOPE)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/autocast_mode.h pytorch-develop-181/aten/src/ATen/autocast_mode.h
--- pytorch-v1.8.1/aten/src/ATen/autocast_mode.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/autocast_mode.h 2022-01-12 16:48:14.342567779 +0800
@@ -5,7 +5,7 @@
namespace {
bool is_autocast_eligible(const Tensor& tensor) {
- return (tensor.is_cuda() || tensor.is_xla()) && tensor.is_floating_point();
+ return (tensor.is_cuda() || tensor.is_xla() || tensor.is_npu()) && tensor.is_floating_point();
}
} // namespace
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/CMakeLists.txt pytorch-develop-181/aten/src/ATen/CMakeLists.txt
--- pytorch-v1.8.1/aten/src/ATen/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/CMakeLists.txt 2021-12-04 10:36:12.835451477 +0800
+++ pytorch-develop-181/aten/src/ATen/CMakeLists.txt 2022-01-12 16:48:14.334567816 +0800
@@ -85,6 +85,10 @@
file(GLOB native_quantized_h "native/quantized/*.h" "native/quantized/cpu/*.h")
file(GLOB native_cpu_h "native/cpu/*.h")
@@ -103,7 +115,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
set(ATen_HIP_SRCS ${ATen_HIP_SRCS} PARENT_SCOPE)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/core/dispatch/Dispatcher.h pytorch-develop-181/aten/src/ATen/core/dispatch/Dispatcher.h
--- pytorch-v1.8.1/aten/src/ATen/core/dispatch/Dispatcher.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/Dispatcher.h 2021-12-04 10:36:12.847451560 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/Dispatcher.h 2022-01-12 16:48:14.346567761 +0800
@@ -417,6 +417,11 @@
}
}
@@ -118,7 +130,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/core/dispatch/ObservedOperators.cpp pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.cpp
--- pytorch-v1.8.1/aten/src/ATen/core/dispatch/ObservedOperators.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.cpp 2021-12-04 10:36:12.847451560 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.cpp 2022-01-12 16:48:14.346567761 +0800
@@ -6,6 +6,7 @@
namespace c10 {
@@ -129,7 +141,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
std::unordered_set<std::string> not_observed_ops = {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/core/dispatch/ObservedOperators.h pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.h
--- pytorch-v1.8.1/aten/src/ATen/core/dispatch/ObservedOperators.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.h 2021-12-04 10:36:12.847451560 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/ObservedOperators.h 2022-01-12 16:48:14.346567761 +0800
@@ -1,12 +1,16 @@
#pragma once
@@ -149,7 +161,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/core/dispatch/OperatorEntry.h pytorch-develop-181/aten/src/ATen/core/dispatch/OperatorEntry.h
--- pytorch-v1.8.1/aten/src/ATen/core/dispatch/OperatorEntry.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/OperatorEntry.h 2021-12-04 10:36:12.847451560 +0800
+++ pytorch-develop-181/aten/src/ATen/core/dispatch/OperatorEntry.h 2022-01-12 16:48:14.346567761 +0800
@@ -10,6 +10,7 @@
#include <ATen/core/boxing/KernelFunction.h>
#include <ATen/core/dispatch/DispatchKeyExtractor.h>
@@ -160,7 +172,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
#include <ATen/core/dispatch/RegistrationHandleRAII.h>
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/core/VariableFallbackKernel.cpp pytorch-develop-181/aten/src/ATen/core/VariableFallbackKernel.cpp
--- pytorch-v1.8.1/aten/src/ATen/core/VariableFallbackKernel.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/core/VariableFallbackKernel.cpp 2021-12-04 10:36:12.843451532 +0800
+++ pytorch-develop-181/aten/src/ATen/core/VariableFallbackKernel.cpp 2022-01-12 16:48:14.342567779 +0800
@@ -48,4 +48,8 @@
m.fallback(torch::CppFunction::makeFallthrough());
}
@@ -172,7 +184,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/Convolution.cpp pytorch-develop-181/aten/src/ATen/native/Convolution.cpp
--- pytorch-v1.8.1/aten/src/ATen/native/Convolution.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/Convolution.cpp 2021-12-04 10:36:12.859451643 +0800
+++ pytorch-develop-181/aten/src/ATen/native/Convolution.cpp 2022-01-12 16:48:14.354567723 +0800
@@ -603,7 +603,9 @@
const Tensor& input, const Tensor& weight, const Tensor& bias,
IntArrayRef stride, IntArrayRef padding, IntArrayRef dilation,
@@ -186,7 +198,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
at::Tensor _convolution(
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/Memory.cpp pytorch-develop-181/aten/src/ATen/native/Memory.cpp
--- pytorch-v1.8.1/aten/src/ATen/native/Memory.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/Memory.cpp 2021-12-04 10:36:12.863451670 +0800
+++ pytorch-develop-181/aten/src/ATen/native/Memory.cpp 2022-01-12 16:48:14.358567706 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -237,7 +249,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
detail::computeStorageNbytes(
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/native_functions.yaml pytorch-develop-181/aten/src/ATen/native/native_functions.yaml
--- pytorch-v1.8.1/aten/src/ATen/native/native_functions.yaml 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/native_functions.yaml 2021-12-04 10:36:12.895451891 +0800
+++ pytorch-develop-181/aten/src/ATen/native/native_functions.yaml 2022-01-12 16:48:14.394567540 +0800
@@ -2073,6 +2073,8 @@
dispatch:
CPU, CUDA: isnan
@@ -294,16 +306,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
- func: tile(Tensor self, int[] dims) -> Tensor
variants: function, method
@@ -5446,6 +5459,8 @@
dispatch:
CPU, CUDA: ne
QuantizedCPU: ne_quantized_cpu
+ npu_dispatch:
+ NPU: ne_npu
- func: ne_.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)
variants: method
@@ -5611,18 +5626,24 @@
@@ -5611,18 +5624,24 @@
dispatch:
CPU, CUDA: gt_out
QuantizedCPU: gt_out_quantized_cpu
@@ -328,7 +331,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
- func: gt.Tensor(Tensor self, Tensor other) -> Tensor
variants: method, function
@@ -9233,3 +9254,146 @@
@@ -9233,3 +9252,146 @@
- func: _test_ambiguous_defaults.b(Tensor dummy, int a=2, str b="2") -> Tensor
cpp_no_default_args: ['a', 'b']
python_module: nn
@@ -477,7 +480,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
+- func: npu_apply_adam.out(Scalar beta1_power, Scalar beta2_power, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, bool? use_locking, bool? use_nesterov, *, Tensor(a!) var, Tensor(b!) m, Tensor(c!) v) -> (Tensor(a!), Tensor(b!), Tensor(c!))
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/NPUVariableMethodStubs.cpp pytorch-develop-181/aten/src/ATen/native/NPUVariableMethodStubs.cpp
--- pytorch-v1.8.1/aten/src/ATen/native/NPUVariableMethodStubs.cpp 1970-01-01 08:00:00.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/NPUVariableMethodStubs.cpp 2021-12-04 10:36:12.863451670 +0800
+++ pytorch-develop-181/aten/src/ATen/native/NPUVariableMethodStubs.cpp 2022-01-12 16:48:14.358567706 +0800
@@ -0,0 +1,464 @@
+#include "ATen/native/npu/common/FormatCastHelper.h"
+#include "ATen/native/npu/frame/FormatHelper.h"
@@ -1861,7 +1864,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
-}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/TensorFactories.cpp pytorch-develop-181/aten/src/ATen/native/TensorFactories.cpp
--- pytorch-v1.8.1/aten/src/ATen/native/TensorFactories.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/TensorFactories.cpp 2021-12-04 10:36:12.875451753 +0800
+++ pytorch-develop-181/aten/src/ATen/native/TensorFactories.cpp 2022-01-12 16:48:14.374567632 +0800
@@ -1,3 +1,20 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -1894,7 +1897,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
namespace {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/native/vulkan/api/vk_mem_alloc.h pytorch-develop-181/aten/src/ATen/native/vulkan/api/vk_mem_alloc.h
--- pytorch-v1.8.1/aten/src/ATen/native/vulkan/api/vk_mem_alloc.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/native/vulkan/api/vk_mem_alloc.h 2021-12-04 10:36:12.931452140 +0800
+++ pytorch-develop-181/aten/src/ATen/native/vulkan/api/vk_mem_alloc.h 2022-01-12 16:48:14.430567374 +0800
@@ -1,19229 +1,19229 @@
-//
-// Copyright (c) 2017-2020 Advanced Micro Devices, Inc. All rights reserved.
@@ -40356,7 +40359,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
+#endif // #ifdef VMA_IMPLEMENTATION
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/record_function.cpp pytorch-develop-181/aten/src/ATen/record_function.cpp
--- pytorch-v1.8.1/aten/src/ATen/record_function.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/record_function.cpp 2021-12-04 10:36:12.935452168 +0800
+++ pytorch-develop-181/aten/src/ATen/record_function.cpp 2022-01-12 16:48:14.434567356 +0800
@@ -400,6 +400,9 @@
rf_tls_.tls_record_function_enabled_ = enable;
}
@@ -40369,7 +40372,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
if (rf_tls_ptr->tls_record_function_enabled_) {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/record_function.h pytorch-develop-181/aten/src/ATen/record_function.h
--- pytorch-v1.8.1/aten/src/ATen/record_function.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/record_function.h 2021-12-04 10:36:12.935452168 +0800
+++ pytorch-develop-181/aten/src/ATen/record_function.h 2022-01-12 16:48:14.434567356 +0800
@@ -2,6 +2,7 @@
#include <ATen/core/ivalue.h>
@@ -40405,7 +40408,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
// scope - record scope that this function tracks
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/templates/TensorBody.h pytorch-develop-181/aten/src/ATen/templates/TensorBody.h
--- pytorch-v1.8.1/aten/src/ATen/templates/TensorBody.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/templates/TensorBody.h 2021-12-04 10:36:12.935452168 +0800
+++ pytorch-develop-181/aten/src/ATen/templates/TensorBody.h 2022-01-12 16:48:14.434567356 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40438,7 +40441,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
bool is_xpu() const;
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/templates/TensorMethods.cpp pytorch-develop-181/aten/src/ATen/templates/TensorMethods.cpp
--- pytorch-v1.8.1/aten/src/ATen/templates/TensorMethods.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/templates/TensorMethods.cpp 2021-12-04 10:36:12.935452168 +0800
+++ pytorch-develop-181/aten/src/ATen/templates/TensorMethods.cpp 2022-01-12 16:48:14.434567356 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40483,7 +40486,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/ATen/Utils.cpp pytorch-develop-181/aten/src/ATen/Utils.cpp
--- pytorch-v1.8.1/aten/src/ATen/Utils.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/ATen/Utils.cpp 2021-12-04 10:36:12.843451532 +0800
+++ pytorch-develop-181/aten/src/ATen/Utils.cpp 2022-01-12 16:48:14.342567779 +0800
@@ -1,3 +1,18 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40527,7 +40530,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/TH/generic/THStorage.cpp pytorch-develop-181/aten/src/TH/generic/THStorage.cpp
--- pytorch-v1.8.1/aten/src/TH/generic/THStorage.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/TH/generic/THStorage.cpp 2021-12-04 10:36:12.939452195 +0800
+++ pytorch-develop-181/aten/src/TH/generic/THStorage.cpp 2022-01-12 16:48:14.438567337 +0800
@@ -1,9 +1,32 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40640,7 +40643,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/aten/src/TH/generic/THStorage.h pytorch-develop-181/aten/src/TH/generic/THStorage.h
--- pytorch-v1.8.1/aten/src/TH/generic/THStorage.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/aten/src/TH/generic/THStorage.h 2021-12-04 10:36:12.939452195 +0800
+++ pytorch-develop-181/aten/src/TH/generic/THStorage.h 2022-01-12 16:48:14.438567337 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40679,7 +40682,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/CMakeLists.txt pytorch-develop-181/c10/CMakeLists.txt
--- pytorch-v1.8.1/c10/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/CMakeLists.txt 2021-12-04 10:36:12.951452278 +0800
+++ pytorch-develop-181/c10/CMakeLists.txt 2022-01-12 16:48:14.450567282 +0800
@@ -79,6 +79,14 @@
message(STATUS "don't use NUMA")
endif()
@@ -40708,7 +40711,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# not checked in
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/Backend.h pytorch-develop-181/c10/core/Backend.h
--- pytorch-v1.8.1/c10/core/Backend.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/Backend.h 2021-12-04 10:36:12.951452278 +0800
+++ pytorch-develop-181/c10/core/Backend.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40802,7 +40805,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/Device.cpp pytorch-develop-181/c10/core/Device.cpp
--- pytorch-v1.8.1/c10/core/Device.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/Device.cpp 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/Device.cpp 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40833,7 +40836,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
types.begin(),
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/Device.h pytorch-develop-181/c10/core/Device.h
--- pytorch-v1.8.1/c10/core/Device.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/Device.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/Device.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40868,7 +40871,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
bool is_cpu() const noexcept {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DeviceType.cpp pytorch-develop-181/c10/core/DeviceType.cpp
--- pytorch-v1.8.1/c10/core/DeviceType.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DeviceType.cpp 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DeviceType.cpp 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40908,7 +40911,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return false;
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DeviceType.h pytorch-develop-181/c10/core/DeviceType.h
--- pytorch-v1.8.1/c10/core/DeviceType.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DeviceType.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DeviceType.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40950,7 +40953,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
constexpr DeviceType kMSNPU = DeviceType::MSNPU;
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DispatchKey.cpp pytorch-develop-181/c10/core/DispatchKey.cpp
--- pytorch-v1.8.1/c10/core/DispatchKey.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DispatchKey.cpp 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DispatchKey.cpp 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,18 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -40999,7 +41002,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
case DispatchKey::PrivateUse1:
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DispatchKey.h pytorch-develop-181/c10/core/DispatchKey.h
--- pytorch-v1.8.1/c10/core/DispatchKey.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DispatchKey.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DispatchKey.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41046,7 +41049,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
PrivateUse3_PreAutograd = AutogradPrivateUse3,
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DispatchKeySet.cpp pytorch-develop-181/c10/core/DispatchKeySet.cpp
--- pytorch-v1.8.1/c10/core/DispatchKeySet.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DispatchKeySet.cpp 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DispatchKeySet.cpp 2022-01-12 16:48:14.450567282 +0800
@@ -11,6 +11,7 @@
DispatchKey::XLA,
DispatchKey::NestedTensor,
@@ -41066,7 +41069,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
case DispatchKey::AutogradXPU:
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/DispatchKeySet.h pytorch-develop-181/c10/core/DispatchKeySet.h
--- pytorch-v1.8.1/c10/core/DispatchKeySet.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/DispatchKeySet.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/DispatchKeySet.h 2022-01-12 16:48:14.450567282 +0800
@@ -193,6 +193,7 @@
DispatchKey::AutogradCPU,
DispatchKey::AutogradCUDA,
@@ -41077,7 +41080,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
DispatchKey::AutogradPrivateUse1,
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/Storage.h pytorch-develop-181/c10/core/Storage.h
--- pytorch-v1.8.1/c10/core/Storage.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/Storage.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/Storage.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41111,7 +41114,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
};
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/StorageImpl.h pytorch-develop-181/c10/core/StorageImpl.h
--- pytorch-v1.8.1/c10/core/StorageImpl.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/StorageImpl.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/StorageImpl.h 2022-01-12 16:48:14.450567282 +0800
@@ -1,12 +1,42 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41171,7 +41174,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/TensorImpl.h pytorch-develop-181/c10/core/TensorImpl.h
--- pytorch-v1.8.1/c10/core/TensorImpl.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/TensorImpl.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/TensorImpl.h 2022-01-12 16:48:14.454567264 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41214,7 +41217,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return ts.has(DispatchKey::SparseCPU) ||
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/core/TensorOptions.h pytorch-develop-181/c10/core/TensorOptions.h
--- pytorch-v1.8.1/c10/core/TensorOptions.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/core/TensorOptions.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/core/TensorOptions.h 2022-01-12 16:48:14.454567264 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41255,7 +41258,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
} else if (tid == DispatchKey::QuantizedXPU) {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/c10/macros/Export.h pytorch-develop-181/c10/macros/Export.h
--- pytorch-v1.8.1/c10/macros/Export.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/c10/macros/Export.h 2021-12-04 10:36:12.955452306 +0800
+++ pytorch-develop-181/c10/macros/Export.h 2022-01-12 16:48:14.454567264 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -41324,7 +41327,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
#define C10_API_ENUM C10_API
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/caffe2/CMakeLists.txt pytorch-develop-181/caffe2/CMakeLists.txt
--- pytorch-v1.8.1/caffe2/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/caffe2/CMakeLists.txt 2021-12-04 10:36:12.963452361 +0800
+++ pytorch-develop-181/caffe2/CMakeLists.txt 2022-01-12 16:48:14.462567227 +0800
@@ -76,6 +76,7 @@
# Add source, includes, and libs to lists
list(APPEND Caffe2_CPU_SRCS ${ATen_CPU_SRCS})
@@ -41449,7 +41452,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# Call again since Caffe2_HIP_INCLUDE is extended with ATen include dirs.
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/cmake/BuildVariables.cmake pytorch-develop-181/cmake/BuildVariables.cmake
--- pytorch-v1.8.1/cmake/BuildVariables.cmake 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/cmake/BuildVariables.cmake 2021-12-04 10:36:13.039452886 +0800
+++ pytorch-develop-181/cmake/BuildVariables.cmake 2022-01-12 16:48:14.534566896 +0800
@@ -11,6 +11,7 @@
# CMakeLists.txt files under each folder respectively.
set(Caffe2_CPU_SRCS)
@@ -41473,7 +41476,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# symbols. However, if the lib is whole linked in caffe2 lib, we don't want
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/cmake/Codegen.cmake pytorch-develop-181/cmake/Codegen.cmake
--- pytorch-v1.8.1/cmake/Codegen.cmake 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/cmake/Codegen.cmake 2021-12-04 10:36:13.039452886 +0800
+++ pytorch-develop-181/cmake/Codegen.cmake 2022-01-12 16:48:14.534566896 +0800
@@ -208,13 +208,14 @@
file(READ ${CMAKE_BINARY_DIR}/aten/src/ATen/generated_cpp.txt generated_cpp)
file(READ ${CMAKE_BINARY_DIR}/aten/src/ATen/generated_cpp.txt-cuda cuda_generated_cpp)
@@ -41506,7 +41509,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
function(append_filelist name outputvar)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/cmake/Dependencies.cmake pytorch-develop-181/cmake/Dependencies.cmake
--- pytorch-v1.8.1/cmake/Dependencies.cmake 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/cmake/Dependencies.cmake 2021-12-04 10:36:13.043452913 +0800
+++ pytorch-develop-181/cmake/Dependencies.cmake 2022-01-12 16:48:14.534566896 +0800
@@ -1771,6 +1771,13 @@
endif(NOT C_HAS_THREAD)
endif()
@@ -41523,7 +41526,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
#
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/cmake/Summary.cmake pytorch-develop-181/cmake/Summary.cmake
--- pytorch-v1.8.1/cmake/Summary.cmake 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/cmake/Summary.cmake 2021-12-04 10:36:13.043452913 +0800
+++ pytorch-develop-181/cmake/Summary.cmake 2022-01-12 16:48:14.538566877 +0800
@@ -127,6 +127,7 @@
message(STATUS " USE_MKLDNN_CBLAS : ${USE_MKLDNN_CBLAS}")
endif()
@@ -41542,7 +41545,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
message(STATUS " Private Dependencies : ${Caffe2_DEPENDENCY_LIBS}")
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/cmake/TorchConfig.cmake.in pytorch-develop-181/cmake/TorchConfig.cmake.in
--- pytorch-v1.8.1/cmake/TorchConfig.cmake.in 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/cmake/TorchConfig.cmake.in 2021-12-04 10:36:13.043452913 +0800
+++ pytorch-develop-181/cmake/TorchConfig.cmake.in 2022-01-12 16:48:14.538566877 +0800
@@ -158,6 +158,11 @@
list(APPEND TORCH_LIBRARIES ${TORCH_CUDA_LIBRARIES})
endif()
@@ -41557,7 +41560,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
set(TORCH_CXX_FLAGS "-D_GLIBCXX_USE_CXX11_ABI=@GLIBCXX_USE_CXX11_ABI@")
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/CMakeLists.txt pytorch-develop-181/CMakeLists.txt
--- pytorch-v1.8.1/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/CMakeLists.txt 2021-12-04 10:36:12.827451422 +0800
+++ pytorch-develop-181/CMakeLists.txt 2022-01-12 16:48:14.326567852 +0800
@@ -261,6 +261,10 @@
"USE_DISTRIBUTED" OFF)
option(USE_TBB "Use TBB" OFF)
@@ -41601,7 +41604,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
if(APPLE)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/setup.py pytorch-develop-181/setup.py
--- pytorch-v1.8.1/setup.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/setup.py 2021-12-04 10:36:13.055452996 +0800
+++ pytorch-develop-181/setup.py 2022-01-12 16:48:14.550566822 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -41670,7 +41673,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
'utils/benchmark/utils/valgrind_wrapper/*.h',
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/autograd/derivatives.yaml pytorch-develop-181/tools/autograd/derivatives.yaml
--- pytorch-v1.8.1/tools/autograd/derivatives.yaml 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/autograd/derivatives.yaml 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/autograd/derivatives.yaml 2022-01-12 16:48:15.014564687 +0800
@@ -1976,3 +1976,7 @@
- name: nonzero(Tensor self) -> Tensor
@@ -41681,7 +41684,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
+ mat2: npu_bmm_v2_mat2_backward(grad, self, mat2, mat2.sizes())
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/autograd/gen_python_functions.py pytorch-develop-181/tools/autograd/gen_python_functions.py
--- pytorch-v1.8.1/tools/autograd/gen_python_functions.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/autograd/gen_python_functions.py 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/autograd/gen_python_functions.py 2022-01-12 16:48:15.014564687 +0800
@@ -1,3 +1,20 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -41705,7 +41708,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# The bindings are generated as methods on python_variable or functions on the
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/autograd/templates/Functions.cpp pytorch-develop-181/tools/autograd/templates/Functions.cpp
--- pytorch-v1.8.1/tools/autograd/templates/Functions.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/autograd/templates/Functions.cpp 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/autograd/templates/Functions.cpp 2022-01-12 16:48:15.014564687 +0800
@@ -14,6 +14,35 @@
namespace torch { namespace autograd { namespace generated {
@@ -41744,7 +41747,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}}} // namespace torch::autograd::generated
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/autograd/templates/python_torch_functions.cpp pytorch-develop-181/tools/autograd/templates/python_torch_functions.cpp
--- pytorch-v1.8.1/tools/autograd/templates/python_torch_functions.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/autograd/templates/python_torch_functions.cpp 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/autograd/templates/python_torch_functions.cpp 2022-01-12 16:48:15.014564687 +0800
@@ -30,7 +30,7 @@
#include "torch/csrc/autograd/generated/variable_factories.h"
#include "torch/csrc/utils/structseq.h"
@@ -41780,7 +41783,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return torch::range(start, end, step, options);
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/autograd/templates/python_variable_methods.cpp pytorch-develop-181/tools/autograd/templates/python_variable_methods.cpp
--- pytorch-v1.8.1/tools/autograd/templates/python_variable_methods.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/autograd/templates/python_variable_methods.cpp 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/autograd/templates/python_variable_methods.cpp 2022-01-12 16:48:15.014564687 +0800
@@ -20,7 +20,13 @@
#ifdef USE_CUDA
#include "torch/csrc/cuda/Event.h"
@@ -41848,7 +41851,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
{"has_names", THPVariable_has_names, METH_NOARGS, NULL},
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/build_variables.bzl pytorch-develop-181/tools/build_variables.bzl
--- pytorch-v1.8.1/tools/build_variables.bzl 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/build_variables.bzl 2021-12-04 10:36:13.535456310 +0800
+++ pytorch-develop-181/tools/build_variables.bzl 2022-01-12 16:48:15.014564687 +0800
@@ -362,6 +362,7 @@
libtorch_cuda_core_sources = [
"torch/csrc/CudaIPCTypes.cpp",
@@ -41867,7 +41870,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
"torch/csrc/utils/python_arg_parser.cpp",
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/codegen/gen.py pytorch-develop-181/tools/codegen/gen.py
--- pytorch-v1.8.1/tools/codegen/gen.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/codegen/gen.py 2021-12-04 10:36:13.539456338 +0800
+++ pytorch-develop-181/tools/codegen/gen.py 2022-01-12 16:48:15.018564668 +0800
@@ -815,7 +815,7 @@
core_fm = make_file_manager(core_install_dir)
cpu_fm = make_file_manager(options.install_dir)
@@ -41915,7 +41918,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
main()
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/tools/codegen/model.py pytorch-develop-181/tools/codegen/model.py
--- pytorch-v1.8.1/tools/codegen/model.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/tools/codegen/model.py 2021-12-04 10:36:13.539456338 +0800
+++ pytorch-develop-181/tools/codegen/model.py 2022-01-12 16:48:15.018564668 +0800
@@ -79,6 +79,7 @@
SparseHIP = auto()
SparseXPU = auto()
@@ -42057,7 +42060,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
-)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/autograd/profiler.py pytorch-develop-181/torch/autograd/profiler.py
--- pytorch-v1.8.1/torch/autograd/profiler.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/autograd/profiler.py 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/autograd/profiler.py 2022-01-12 16:48:15.022564651 +0800
@@ -37,14 +37,17 @@
class EventList(list):
"""A list of Events (for pretty printing)"""
@@ -42736,7 +42739,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return ''.join(result)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/_C/_autograd.pyi pytorch-develop-181/torch/_C/_autograd.pyi
--- pytorch-v1.8.1/torch/_C/_autograd.pyi 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/_C/_autograd.pyi 2021-12-04 10:36:13.539456338 +0800
+++ pytorch-develop-181/torch/_C/_autograd.pyi 2022-01-12 16:48:15.018564668 +0800
@@ -9,14 +9,17 @@
CUDA = ...
NVTX = ...
@@ -42757,7 +42760,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
class ProfilerConfig:
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/CMakeLists.txt pytorch-develop-181/torch/CMakeLists.txt
--- pytorch-v1.8.1/torch/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/CMakeLists.txt 2021-12-04 10:36:13.539456338 +0800
+++ pytorch-develop-181/torch/CMakeLists.txt 2022-01-12 16:48:15.018564668 +0800
@@ -131,6 +131,20 @@
endif()
@@ -42781,7 +42784,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
list(APPEND TORCH_PYTHON_SRCS ${GENERATED_THNN_CXX_CUDA})
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/engine.cpp pytorch-develop-181/torch/csrc/autograd/engine.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/engine.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/engine.cpp 2021-12-04 10:36:13.547456393 +0800
+++ pytorch-develop-181/torch/csrc/autograd/engine.cpp 2022-01-12 16:48:15.026564632 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -42878,7 +42881,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
auto outputs = call_function(graph_task, func, inputs);
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/functions/tensor.cpp pytorch-develop-181/torch/csrc/autograd/functions/tensor.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/functions/tensor.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/functions/tensor.cpp 2021-12-04 10:36:13.547456393 +0800
+++ pytorch-develop-181/torch/csrc/autograd/functions/tensor.cpp 2022-01-12 16:48:15.026564632 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -42910,7 +42913,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
/*non_blocking=*/false,
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/init.cpp pytorch-develop-181/torch/csrc/autograd/init.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/init.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/init.cpp 2021-12-04 10:36:13.547456393 +0800
+++ pytorch-develop-181/torch/csrc/autograd/init.cpp 2022-01-12 16:48:15.026564632 +0800
@@ -52,6 +52,7 @@
.value("Disabled", ProfilerState::Disabled)
.value("CPU", ProfilerState::CPU)
@@ -42953,7 +42956,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
.value("OPENCL", c10::DeviceType::OPENCL)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/input_buffer.cpp pytorch-develop-181/torch/csrc/autograd/input_buffer.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/input_buffer.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/input_buffer.cpp 2021-12-04 10:36:13.547456393 +0800
+++ pytorch-develop-181/torch/csrc/autograd/input_buffer.cpp 2022-01-12 16:48:15.026564632 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43005,7 +43008,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
auto& old_var = buffer[pos];
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/profiler_legacy.cpp pytorch-develop-181/torch/csrc/autograd/profiler_legacy.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/profiler_legacy.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/profiler_legacy.cpp 2021-12-04 10:36:13.551456420 +0800
+++ pytorch-develop-181/torch/csrc/autograd/profiler_legacy.cpp 2022-01-12 16:48:15.026564632 +0800
@@ -147,7 +147,7 @@
constexpr const CUDAStubs* default_stubs_addr = &default_stubs;
// Constant initialization, so it is guaranteed to be initialized before
@@ -43248,7 +43251,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
CUDAStubs::~CUDAStubs() = default;
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/profiler_legacy.h pytorch-develop-181/torch/csrc/autograd/profiler_legacy.h
--- pytorch-v1.8.1/torch/csrc/autograd/profiler_legacy.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/profiler_legacy.h 2021-12-04 10:36:13.551456420 +0800
+++ pytorch-develop-181/torch/csrc/autograd/profiler_legacy.h 2022-01-12 16:48:15.026564632 +0800
@@ -19,6 +19,8 @@
#include <sys/time.h> // for gettimeofday()
#endif
@@ -43437,7 +43440,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
std::vector<LegacyEvent>&& remoteProfiledEvents);
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/python_variable.cpp pytorch-develop-181/torch/csrc/autograd/python_variable.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/python_variable.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/python_variable.cpp 2021-12-04 10:36:13.551456420 +0800
+++ pytorch-develop-181/torch/csrc/autograd/python_variable.cpp 2022-01-12 16:48:15.030564614 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43491,7 +43494,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
{"is_mkldnn", (getter)THPVariable_is_mkldnn, nullptr, nullptr, nullptr},
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/autograd/python_variable_indexing.cpp pytorch-develop-181/torch/csrc/autograd/python_variable_indexing.cpp
--- pytorch-v1.8.1/torch/csrc/autograd/python_variable_indexing.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/autograd/python_variable_indexing.cpp 2021-12-04 10:36:13.551456420 +0800
+++ pytorch-develop-181/torch/csrc/autograd/python_variable_indexing.cpp 2022-01-12 16:48:15.030564614 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43524,7 +43527,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/distributed/c10d/init.cpp pytorch-develop-181/torch/csrc/distributed/c10d/init.cpp
--- pytorch-v1.8.1/torch/csrc/distributed/c10d/init.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/distributed/c10d/init.cpp 2021-12-04 10:36:13.555456448 +0800
+++ pytorch-develop-181/torch/csrc/distributed/c10d/init.cpp 2022-01-12 16:48:15.030564614 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43691,7 +43694,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
torch::class_<::c10d::DistributedC10d>("dist_c10d", "frontend")
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/DynamicTypes.cpp pytorch-develop-181/torch/csrc/DynamicTypes.cpp
--- pytorch-v1.8.1/torch/csrc/DynamicTypes.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/DynamicTypes.cpp 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/csrc/DynamicTypes.cpp 2022-01-12 16:48:15.022564651 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43740,7 +43743,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return it->second;
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/Generator.cpp pytorch-develop-181/torch/csrc/Generator.cpp
--- pytorch-v1.8.1/torch/csrc/Generator.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/Generator.cpp 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/csrc/Generator.cpp 2022-01-12 16:48:15.022564651 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43787,7 +43790,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
" is not supported for torch.Generator() api.");
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/generic/serialization.cpp pytorch-develop-181/torch/csrc/generic/serialization.cpp
--- pytorch-v1.8.1/torch/csrc/generic/serialization.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/generic/serialization.cpp 2021-12-04 10:36:13.555456448 +0800
+++ pytorch-develop-181/torch/csrc/generic/serialization.cpp 2022-01-12 16:48:15.034564595 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43885,7 +43888,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/generic/Storage.cpp pytorch-develop-181/torch/csrc/generic/Storage.cpp
--- pytorch-v1.8.1/torch/csrc/generic/Storage.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/generic/Storage.cpp 2021-12-04 10:36:13.555456448 +0800
+++ pytorch-develop-181/torch/csrc/generic/Storage.cpp 2022-01-12 16:48:15.034564595 +0800
@@ -1,7 +1,25 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -43965,7 +43968,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
for (Py_ssize_t i = 0; i < length; i++) {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/generic/StorageMethods.cpp pytorch-develop-181/torch/csrc/generic/StorageMethods.cpp
--- pytorch-v1.8.1/torch/csrc/generic/StorageMethods.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/generic/StorageMethods.cpp 2021-12-04 10:36:13.555456448 +0800
+++ pytorch-develop-181/torch/csrc/generic/StorageMethods.cpp 2022-01-12 16:48:15.034564595 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44045,7 +44048,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
};
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/Module.cpp pytorch-develop-181/torch/csrc/Module.cpp
--- pytorch-v1.8.1/torch/csrc/Module.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/Module.cpp 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/csrc/Module.cpp 2022-01-12 16:48:15.022564651 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44171,7 +44174,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
if (incref) {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/tensor/python_tensor.cpp pytorch-develop-181/torch/csrc/tensor/python_tensor.cpp
--- pytorch-v1.8.1/torch/csrc/tensor/python_tensor.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/tensor/python_tensor.cpp 2021-12-04 10:36:13.583456641 +0800
+++ pytorch-develop-181/torch/csrc/tensor/python_tensor.cpp 2022-01-12 16:48:15.058564485 +0800
@@ -1,3 +1,18 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44209,7 +44212,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/utils/python_arg_parser.h pytorch-develop-181/torch/csrc/utils/python_arg_parser.h
--- pytorch-v1.8.1/torch/csrc/utils/python_arg_parser.h 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/utils/python_arg_parser.h 2021-12-04 10:36:13.583456641 +0800
+++ pytorch-develop-181/torch/csrc/utils/python_arg_parser.h 2022-01-12 16:48:15.058564485 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44244,7 +44247,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return at::Device(device_str);
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/utils/tensor_layouts.cpp pytorch-develop-181/torch/csrc/utils/tensor_layouts.cpp
--- pytorch-v1.8.1/torch/csrc/utils/tensor_layouts.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_layouts.cpp 2021-12-04 10:36:13.583456641 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_layouts.cpp 2022-01-12 16:48:15.058564485 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44275,7 +44278,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
PyObject *sparse_coo_layout = THPLayout_New(at::Layout::Sparse, "torch.sparse_coo");
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/utils/tensor_new.cpp pytorch-develop-181/torch/csrc/utils/tensor_new.cpp
--- pytorch-v1.8.1/torch/csrc/utils/tensor_new.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_new.cpp 2021-12-04 10:36:13.583456641 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_new.cpp 2022-01-12 16:48:15.062564467 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44407,7 +44410,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
dispatch_key);
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/csrc/utils/tensor_types.cpp pytorch-develop-181/torch/csrc/utils/tensor_types.cpp
--- pytorch-v1.8.1/torch/csrc/utils/tensor_types.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_types.cpp 2021-12-04 10:36:13.583456641 +0800
+++ pytorch-develop-181/torch/csrc/utils/tensor_types.cpp 2022-01-12 16:48:15.062564467 +0800
@@ -1,3 +1,19 @@
+// Copyright (c) 2020 Huawei Technologies Co., Ltd
+// Copyright (c) 2019, Facebook CORPORATION.
@@ -44457,7 +44460,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
}
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/distributed/distributed_c10d.py pytorch-develop-181/torch/distributed/distributed_c10d.py
--- pytorch-v1.8.1/torch/distributed/distributed_c10d.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/distributed/distributed_c10d.py 2021-12-04 10:36:13.587456669 +0800
+++ pytorch-develop-181/torch/distributed/distributed_c10d.py 2022-01-12 16:48:15.062564467 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -44548,7 +44551,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
prefix_store,
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/__init__.py pytorch-develop-181/torch/__init__.py
--- pytorch-v1.8.1/torch/__init__.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/__init__.py 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/__init__.py 2022-01-12 16:48:15.022564651 +0800
@@ -675,3 +675,11 @@
# class usage. We add these lines here to preserve backward compatibility.
quantized_lstm = torch.ops.aten.quantized_lstm
@@ -44564,7 +44567,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
\ No newline at end of file
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/lib/c10d/CMakeLists.txt pytorch-develop-181/torch/lib/c10d/CMakeLists.txt
--- pytorch-v1.8.1/torch/lib/c10d/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/lib/c10d/CMakeLists.txt 2021-12-04 10:36:13.591456697 +0800
+++ pytorch-develop-181/torch/lib/c10d/CMakeLists.txt 2022-01-12 16:48:15.070564431 +0800
@@ -27,6 +27,10 @@
option(USE_C10D_NCCL "USE C10D NCCL" ON)
endif()
@@ -44617,7 +44620,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
copy_header(ProcessGroupMPI.hpp)
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/lib/c10d/comm.cpp pytorch-develop-181/torch/lib/c10d/comm.cpp
--- pytorch-v1.8.1/torch/lib/c10d/comm.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/lib/c10d/comm.cpp 2021-12-04 10:36:13.595456724 +0800
+++ pytorch-develop-181/torch/lib/c10d/comm.cpp 2022-01-12 16:48:15.074564412 +0800
@@ -12,6 +12,26 @@
class BroadcastWork {
@@ -44706,7 +44709,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
while (!in_flight.empty()) {
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/lib/c10d/reducer.cpp pytorch-develop-181/torch/lib/c10d/reducer.cpp
--- pytorch-v1.8.1/torch/lib/c10d/reducer.cpp 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/lib/c10d/reducer.cpp 2021-12-04 10:36:13.595456724 +0800
+++ pytorch-develop-181/torch/lib/c10d/reducer.cpp 2022-01-12 16:48:15.074564412 +0800
@@ -18,6 +18,18 @@
namespace c10d {
namespace {
@@ -44898,7 +44901,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
// A bucket with one or more dense tensors needs to be unflattened.
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/lib/libshm/CMakeLists.txt pytorch-develop-181/torch/lib/libshm/CMakeLists.txt
--- pytorch-v1.8.1/torch/lib/libshm/CMakeLists.txt 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/lib/libshm/CMakeLists.txt 2021-12-04 10:36:13.595456724 +0800
+++ pytorch-develop-181/torch/lib/libshm/CMakeLists.txt 2022-01-12 16:48:15.074564412 +0800
@@ -41,8 +41,11 @@
set_target_properties(shm PROPERTIES
PREFIX "lib"
@@ -44914,7 +44917,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# https://github.com/libgit2/libgit2/issues/2128#issuecomment-35649830
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/nn/modules/batchnorm.py pytorch-develop-181/torch/nn/modules/batchnorm.py
--- pytorch-v1.8.1/torch/nn/modules/batchnorm.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/nn/modules/batchnorm.py 2021-12-04 10:36:13.595456724 +0800
+++ pytorch-develop-181/torch/nn/modules/batchnorm.py 2022-01-12 16:48:15.078564394 +0800
@@ -1,3 +1,18 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -44936,7 +44939,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
from ._functions import SyncBatchNorm as sync_batch_norm
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/nn/modules/module.py pytorch-develop-181/torch/nn/modules/module.py
--- pytorch-v1.8.1/torch/nn/modules/module.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/nn/modules/module.py 2021-12-04 10:36:13.599456752 +0800
+++ pytorch-develop-181/torch/nn/modules/module.py 2022-01-12 16:48:15.078564394 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45062,7 +45065,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
if convert_to_format is not None and t.dim() == 4:
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/nn/modules/normalization.py pytorch-develop-181/torch/nn/modules/normalization.py
--- pytorch-v1.8.1/torch/nn/modules/normalization.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/nn/modules/normalization.py 2021-12-04 10:36:13.599456752 +0800
+++ pytorch-develop-181/torch/nn/modules/normalization.py 2022-01-12 16:48:15.078564394 +0800
@@ -167,8 +167,11 @@
init.zeros_(self.bias)
@@ -45079,7 +45082,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
return '{normalized_shape}, eps={eps}, ' \
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/nn/parallel/distributed.py pytorch-develop-181/torch/nn/parallel/distributed.py
--- pytorch-v1.8.1/torch/nn/parallel/distributed.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/nn/parallel/distributed.py 2021-12-04 10:36:13.599456752 +0800
+++ pytorch-develop-181/torch/nn/parallel/distributed.py 2022-01-12 16:48:15.078564394 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45111,7 +45114,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
output = self.module(*inputs[0], **kwargs[0])
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/serialization.py pytorch-develop-181/torch/serialization.py
--- pytorch-v1.8.1/torch/serialization.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/serialization.py 2021-12-04 10:36:13.607456807 +0800
+++ pytorch-develop-181/torch/serialization.py 2022-01-12 16:48:15.086564357 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45200,7 +45203,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
See also: `saving-loading-tensors`
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/storage.py pytorch-develop-181/torch/storage.py
--- pytorch-v1.8.1/torch/storage.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/storage.py 2021-12-04 10:36:13.607456807 +0800
+++ pytorch-develop-181/torch/storage.py 2022-01-12 16:48:15.086564357 +0800
@@ -8,6 +8,7 @@
class _StorageBase(object):
_cdata: Any
@@ -45220,7 +45223,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
else:
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/tensor.py pytorch-develop-181/torch/tensor.py
--- pytorch-v1.8.1/torch/tensor.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/tensor.py 2021-12-04 10:36:13.607456807 +0800
+++ pytorch-develop-181/torch/tensor.py 2022-01-12 16:48:15.086564357 +0800
@@ -1,3 +1,18 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45282,7 +45285,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
def __reversed__(self):
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/_tensor_str.py pytorch-develop-181/torch/_tensor_str.py
--- pytorch-v1.8.1/torch/_tensor_str.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/_tensor_str.py 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/_tensor_str.py 2022-01-12 16:48:15.022564651 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45326,7 +45329,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# TODO: add an API to map real -> complex dtypes
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/utils/data/dataloader.py pytorch-develop-181/torch/utils/data/dataloader.py
--- pytorch-v1.8.1/torch/utils/data/dataloader.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/utils/data/dataloader.py 2021-12-04 10:36:13.611456835 +0800
+++ pytorch-develop-181/torch/utils/data/dataloader.py 2022-01-12 16:48:15.094564320 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45387,7 +45390,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
pin_memory_thread.start()
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/utils/data/_utils/pin_memory.py pytorch-develop-181/torch/utils/data/_utils/pin_memory.py
--- pytorch-v1.8.1/torch/utils/data/_utils/pin_memory.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/utils/data/_utils/pin_memory.py 2021-12-04 10:36:06.943410746 +0800
+++ pytorch-develop-181/torch/utils/data/_utils/pin_memory.py 2022-01-12 16:48:08.474595064 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
@@ -45433,7 +45436,7 @@ diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=
# logic of this function.
diff -Nur '--exclude=.git*' '--exclude=.jenkins' '--exclude=android' '--exclude=OWNERS' '--exclude=third_party' '--exclude=README*' -Nur pytorch-v1.8.1/torch/_utils.py pytorch-develop-181/torch/_utils.py
--- pytorch-v1.8.1/torch/_utils.py 2021-03-24 10:28:21.000000000 +0800
+++ pytorch-develop-181/torch/_utils.py 2021-12-04 10:36:13.543456365 +0800
+++ pytorch-develop-181/torch/_utils.py 2022-01-12 16:48:15.022564651 +0800
@@ -1,3 +1,19 @@
+# Copyright (c) 2020 Huawei Technologies Co., Ltd
+# Copyright (c) 2019, Facebook CORPORATION.
+19 -6
View File
@@ -20,7 +20,7 @@ import sys
import subprocess
from abc import ABCMeta, abstractmethod
DEFAULT_UT_FILE = 'test/test_npu/test_add.py'
DEFAULT_UT_FILE = 'test/test_npu/pytorch_resnet.py'
class AccurateTest(metaclass=ABCMeta):
@abstractmethod
@@ -30,9 +30,10 @@ class AccurateTest(metaclass=ABCMeta):
"""
raise Exception("abstract method.")
def find_ut_by_regex(self, regex):
@staticmethod
def find_ut_by_regex(regex, mindepth=2):
ut_files = []
cmd = "find {} -name {}".format('test/test_npu', regex)
cmd = "find {} -mindepth {} -name {}".format('test/test_npu', mindepth, regex)
status, output = subprocess.getstatusoutput(cmd)
if status:
pass # 对于找不到的暂时不作处理
@@ -111,6 +112,10 @@ class TestMgr():
if os.path.exists(changed_file):
exist_ut_file.append(changed_file)
self.ut_files = exist_ut_file
for ut in self.ut_files:
if ut.split('/')[-1] == 'run_tests.py':
self.ut_files.remove(ut)
if len(self.ut_files) == 0:
self.ut_files.append(DEFAULT_UT_FILE)
@@ -125,7 +130,7 @@ class TestMgr():
def print_ut_files(self):
print("ut files:")
for ut_file in ut_files:
for ut_file in self.ut_files:
print(ut_file)
@@ -175,7 +180,7 @@ def exec_ut(ut_files):
return ret_status
if __name__ == "__main__":
def main():
cur_dir = os.path.abspath(os.path.dirname(__file__))
modify_files = os.path.join(cur_dir, 'modify_files.txt')
test_mgr = TestMgr()
@@ -187,4 +192,12 @@ if __name__ == "__main__":
test_mgr.print_ut_files()
ret = exec_ut(ut_files)
sys.exit(ret)
if ret and DEFAULT_UT_FILE not in ut_files:
print("***** start resnet18:")
os.chdir(cur_dir)
exec_ut([DEFAULT_UT_FILE])
sys.exit(ret)
if __name__ == "__main__":
main()
@@ -59,6 +59,10 @@ struct CAFFE2_API NPUHooksInterface {
TORCH_CHECK(false, "Cannot initialize NPU without building library with options USE_NPU = 1.", NPU_HELP);
}
virtual bool isPinnedPtr(void* data) const {
return false;
}
virtual Generator* getDefaultNPUGenerator(DeviceIndex device_index = -1) const {
TORCH_CHECK(false, "Cannot get default NPU generator without ATen_cuda library. ", NPU_HELP);
}
@@ -669,6 +669,8 @@
dispatch:
CPU: _bincount_cpu
CUDA: _bincount_cuda
npu_dispatch:
NPU: bincount_npu
- func: bitwise_not(Tensor self) -> Tensor
use_c10_dispatcher: full
@@ -1414,6 +1416,8 @@
NPU: _embedding_bag_npu
- func: _embedding_bag_backward(Tensor grad, Tensor indices, Tensor offsets, Tensor offset2bag, Tensor bag_size, Tensor maximum_indices, int num_weights, bool scale_grad_by_freq, int mode, bool sparse, Tensor? per_sample_weights) -> Tensor
npu_dispatch:
NPU: _embedding_bag_backward_npu
- func: _embedding_bag_sparse_backward(Tensor grad, Tensor indices, Tensor offsets, Tensor offset2bag, Tensor bag_size, int num_weights, bool scale_grad_by_freq, int mode, Tensor? per_sample_weights) -> Tensor
@@ -1773,11 +1777,15 @@
dispatch:
CPU: grid_sampler_2d_cpu
CUDA: grid_sampler_2d_cuda
npu_dispatch:
NPU: grid_sampler_2d_npu
- func: grid_sampler_2d_backward(Tensor grad_output, Tensor input, Tensor grid, int interpolation_mode, int padding_mode, bool align_corners) -> (Tensor, Tensor)
dispatch:
CPU: grid_sampler_2d_backward_cpu
CUDA: grid_sampler_2d_backward_cuda
npu_dispatch:
NPU: grid_sampler_2d_backward_npu
- func: grid_sampler_3d(Tensor input, Tensor grid, int interpolation_mode, int padding_mode, bool align_corners) -> Tensor
use_c10_dispatcher: full
@@ -2666,6 +2674,8 @@
- func: batch_norm_gather_stats_with_counts(Tensor input, Tensor mean, Tensor invstd, Tensor? running_mean, Tensor? running_var, float momentum, float eps, int[] counts) -> (Tensor, Tensor)
dispatch:
CUDA: batch_norm_gather_stats_with_counts_cuda
npu_dispatch:
NPU: batch_norm_gather_stats_with_counts_npu
- func: native_batch_norm_backward(Tensor grad_out, Tensor input, Tensor? weight, Tensor? running_mean, Tensor? running_var, Tensor? save_mean, Tensor? save_invstd, bool train, float eps, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
dispatch:
@@ -2683,6 +2693,8 @@
- func: batch_norm_backward_elemt(Tensor grad_out, Tensor input, Tensor mean, Tensor invstd, Tensor? weight, Tensor mean_dy, Tensor mean_dy_xmu) -> Tensor
dispatch:
CUDA: batch_norm_backward_elemt_cuda
npu_dispatch:
NPU: batch_norm_backward_elemt_npu
- func: batch_norm_update_stats(Tensor input, Tensor? running_mean, Tensor? running_var, float momentum) -> (Tensor, Tensor)
dispatch:
@@ -8417,6 +8429,11 @@
variants: function, method
npu_dispatch_only:
NPU: nms_v4_npu
- func: npu_nms_rotated(Tensor self, Tensor scores, float iou_threshold, float scores_threshold=0, int max_output_size=-1, int mode=0) -> (Tensor, Tensor)
variants: function, method
npu_dispatch_only:
NPU: nms_rotated_npu
- func: npu_lstm(Tensor input, Tensor weight, Tensor bias, Tensor seqMask, Tensor h, Tensor c, bool has_biases, int num_layers, float dropout, bool train, bool bidirectional, bool batch_first, bool flagSeq, bool direction) -> (Tensor, Tensor, Tensor, Tensor, Tensor, Tensor, Tensor, Tensor)
variants: function
@@ -8525,6 +8542,14 @@
npu_dispatch_only:
NPU: max_v1_npu
- func: npu_min.dim(Tensor self, int dim, bool keepdim=False) -> (Tensor values, Tensor indices)
npu_dispatch_only:
NPU: min_v1_npu
- func: npu_min.names_dim(Tensor self, Dimname dim, bool keepdim=False) -> (Tensor values, Tensor indices)
npu_dispatch_only:
NPU: min_v1_npu
- func: npu_scatter(Tensor self, Tensor indices, Tensor updates, int dim) -> Tensor
variants: function, method
npu_dispatch_only:
@@ -8534,10 +8559,22 @@
npu_dispatch_only:
NPU: max_backward_npu
- func: npu_apply_adam(Tensor(a!) var, Tensor(b!) m, Tensor(c!) v, Scalar beta1_power, Scalar beta2_power, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, bool? use_locking, bool? use_nesterov) -> (Tensor(a!), Tensor(b!), Tensor(c!))
- func: npu_min_backward(Tensor grad, int dim, Tensor indices, int[] sizes, bool keepdim=False) -> Tensor
npu_dispatch_only:
NPU: min_backward_npu
- func: npu_apply_adam.old(Tensor(a!) var, Tensor(b!) m, Tensor(c!) v, Scalar beta1_power, Scalar beta2_power, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, bool? use_locking, bool? use_nesterov) -> (Tensor(a!), Tensor(b!), Tensor(c!))
npu_dispatch_only:
NPU: apply_adam_npu
- func: npu_apply_adam(Scalar beta1_power, Scalar beta2_power, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, bool? use_locking, bool? use_nesterov) -> (Tensor var, Tensor m, Tensor v)
npu_dispatch_only:
NPU: npu_apply_adam
- func: npu_apply_adam.out(Scalar beta1_power, Scalar beta2_power, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, bool? use_locking, bool? use_nesterov, *, Tensor(a!) var, Tensor(b!) m, Tensor(c!) v) -> (Tensor(a!), Tensor(b!), Tensor(c!))
npu_dispatch_only:
NPU: apply_adam_out_npu
- func: npu_layer_norm_eval(Tensor input, int[] normalized_shape, Tensor? weight=None, Tensor? bias=None, float eps=1e-05) -> Tensor
npu_dispatch_only:
NPU: layer_norm_eval_npu
@@ -8608,6 +8645,16 @@
variants: function, method
npu_dispatch_only:
NPU: yolo_boxes_encode_npu
- func: npu_rotated_box_encode(Tensor self, Tensor gt_bboxes, Tensor weight) -> Tensor
variants: function
npu_dispatch_only:
NPU: rotated_box_encode_npu
- func: npu_rotated_box_decode(Tensor self, Tensor deltas, Tensor weight) -> Tensor
variants: function
npu_dispatch_only:
NPU: rotated_box_decode_npu
- func: npu_grid_assign_positive(Tensor self, Tensor overlaps, Tensor box_responsible_flags, Tensor max_overlaps, Tensor argmax_overlaps, Tensor gt_max_overlaps, Tensor gt_argmax_overlaps, int num_gts, float pos_iou_thr, float min_pos_iou, bool gt_max_assign_all) -> Tensor
variants: function, method
@@ -8636,10 +8683,18 @@
npu_dispatch_only:
NPU: linear_backward_npu
- func: npu_bert_apply_adam(Tensor(a!) var, Tensor(b!) m, Tensor(c!) v, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, Scalar max_grad_norm, Scalar global_grad_norm, Scalar weight_decay) -> (Tensor(a!), Tensor(b!), Tensor(c!))
- func: npu_bert_apply_adam.old(Tensor(a!) var, Tensor(b!) m, Tensor(c!) v, Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, Scalar max_grad_norm, Scalar global_grad_norm, Scalar weight_decay, Scalar? step_size=None, int adam_mode=0) -> (Tensor(a!), Tensor(b!), Tensor(c!))
npu_dispatch_only:
NPU: bert_apply_adam_npu
- func: npu_bert_apply_adam(Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, Scalar max_grad_norm, Scalar global_grad_norm, Scalar weight_decay, Scalar? step_size=None, int adam_mode=0) -> (Tensor var, Tensor m, Tensor v)
npu_dispatch_only:
NPU: npu_bert_apply_adam
- func: npu_bert_apply_adam.out(Scalar lr, Scalar beta1, Scalar beta2, Scalar epsilon, Tensor grad, Scalar max_grad_norm, Scalar global_grad_norm, Scalar weight_decay, Scalar? step_size=None, int adam_mode=0, *, Tensor(a!) var, Tensor(b!) m, Tensor(c!) v) -> (Tensor(a!), Tensor(b!), Tensor(c!))
npu_dispatch_only:
NPU: bert_apply_adam_out_npu
- func: npu_giou(Tensor self, Tensor gtboxes, bool trans=False, bool is_cross=False, int mode=0) -> Tensor
npu_dispatch_only:
NPU: giou_npu
@@ -8658,4 +8713,25 @@
- func: npu_silu_backward(Tensor grad_output, Tensor x0, Tensor x1) -> Tensor
npu_dispatch_only:
NPU: silu_backward_npu
NPU: silu_backward_npu
- func: npu_reshape(Tensor self, int[] shape, bool can_refresh=False) -> Tensor
variants: function, method
npu_dispatch_only:
NPU: reshape_npu
- func: npu_reshape.out(Tensor self, int[] shape, bool can_refresh=False, *, Tensor(a!) out) -> Tensor(a!)
npu_dispatch_only:
NPU: reshape_out_npu
- func: npu_rotated_overlaps(Tensor self, Tensor query_boxes, bool trans=False) -> Tensor
npu_dispatch_only:
NPU: rotated_overlaps_npu
- func: npu_rotated_iou(Tensor self, Tensor query_boxes, bool trans=False, int mode=0, bool is_cross=True, float v_threshold=0.0, float e_threshold=0.0) -> Tensor
npu_dispatch_only:
NPU: rotated_iou_npu
- func: npu_hcom_allreduce.out(Tensor self, str reduction, str group, int fusion, int fusion_id, float alpha, float beta, Tensor(a!) out) -> Tensor(a!)
npu_dispatch_only:
NPU: hcom_allreduce_npu
@@ -1,5 +1,5 @@
// Copyright (c) 2020 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
@@ -60,7 +60,7 @@ Tensor& adds_out_npu_nocheck(
cmd.Name("Add")
.Input(self)
.Input(value, self.scalar_type())
.Output(result, real_type)
.Output(result, "", nullopt, real_type)
.Run();
return result;
@@ -97,7 +97,7 @@ Tensor& add_out_npu_nocheck(
cmd.Name("Add")
.Input(self)
.Input(other)
.Output(result, real_type)
.Output(result, "", nullopt, real_type)
.Run();
} else {
if (c10::npu::OptionsManager::CheckDynamicOptimizer("ADD")) {
@@ -28,7 +28,7 @@ Tensor& addbmm_out_npu(
Tensor bmmResult = at::bmm(MulResult,batch2);
int64_t dim[2] = {batch1.size(1), batch2.size(2)};
Tensor sumResult = at::sum_to(bmmResult, dim);
//sumResult + self*beta
// sumResult + self*beta
at::add_out(result, sumResult, self, beta);
return result;
}
@@ -1,5 +1,5 @@
// Copyright (c) 2020 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
@@ -15,26 +15,51 @@
// limitations under the License.
#include "ATen/native/npu/utils/OpAdapter.h"
#include "ATen/native/npu/utils/CalcuOpUtil.h"
namespace at {
namespace native {
using namespace at::native::npu;
Tensor& addcdiv_npu_nocheck(
Tensor& result,
const Tensor& self,
const Tensor& tensor1,
const Tensor& tensor2,
Scalar value) {
bool isFp32 = self.scalar_type() == at::kFloat && tensor1.scalar_type() == at::kFloat && tensor2.scalar_type() == at::kFloat;
Tensor selfCp = isFp32 ? self : self.npu_dtype_cast(at::kFloat);
Tensor tensor1Cp = isFp32 ? tensor1 : tensor1.npu_dtype_cast(at::kFloat);
Tensor tensor2Cp = isFp32 ? tensor2 : tensor2.npu_dtype_cast(at::kFloat);
OpCommand cmd;
cmd.Name("Addcdiv")
.Input(selfCp)
.Input(tensor1Cp)
.Input(tensor2Cp)
.Input(value, selfCp.scalar_type())
.Output(result)
.Run();
return result;
}
Tensor& addcdiv_out_npu(
Tensor& result,
const Tensor& self,
const Tensor& tensor1,
const Tensor& tensor2,
Scalar value) {
OpCommand cmd;
cmd.Name("Addcdiv")
.Input(self)
.Input(tensor1)
.Input(tensor2)
.Input(value, self.scalar_type())
.Output(result)
.Run();
auto divOutputSize = broadcast_ops_npu_output_size(tensor1, tensor2);
auto outputSize = broadcast_ops_npu_output_size(self.sizes(), divOutputSize);
bool isFp32 = self.scalar_type() == at::kFloat && tensor1.scalar_type() == at::kFloat && tensor2.scalar_type() == at::kFloat;
Tensor temp = isFp32 ? OpPreparation::ApplyTensor(self, outputSize)
: OpPreparation::ApplyTensor(outputSize, self.options().dtype(at::kFloat), self);
addcdiv_npu_nocheck(temp, self, tensor1, tensor2, value);
temp = isFp32 ? temp : temp.npu_dtype_cast(self.scalar_type());
OpPreparation::CheckOut(
{temp},
result,
temp);
result.copy_(temp);
return result;
}
@@ -43,11 +68,14 @@ Tensor addcdiv_npu(
const Tensor& tensor1,
const Tensor& tensor2,
Scalar value) {
auto divOutputSize = broadcast_ops_npu_output_size(tensor1, tensor2);
auto outputSize = broadcast_ops_npu_output_size(self.sizes(), divOutputSize);
Tensor result = OpPreparation::ApplyTensor(self, outputSize);
addcdiv_out_npu(result, self, tensor1, tensor2, value);
bool isFp32 = self.scalar_type() == at::kFloat && tensor1.scalar_type() == at::kFloat && tensor2.scalar_type() == at::kFloat;
Tensor result = isFp32 ? OpPreparation::ApplyTensor(self, outputSize)
: OpPreparation::ApplyTensor(outputSize, self.options().dtype(at::kFloat), self);
addcdiv_npu_nocheck(result, self, tensor1, tensor2, value);
result = isFp32 ? result : result.npu_dtype_cast(self.scalar_type());
return result;
}
@@ -56,14 +84,7 @@ Tensor& addcdiv_npu_(
const Tensor& tensor1,
const Tensor& tensor2,
Scalar value) {
OpPreparation::CheckMemory({self, tensor1, tensor2}, {self});
if (!NpuUtils::check_match(&self)) {
Tensor contiguousSelf = NpuUtils::format_contiguous(self);
Tensor result = addcdiv_out_npu(contiguousSelf, contiguousSelf, tensor1, tensor2, value);
NpuUtils::format_fresh_view(self, result);
} else {
addcdiv_out_npu(self, self, tensor1, tensor2, value);
}
addcdiv_out_npu(self, self, tensor1, tensor2, value);
return self;
}
@@ -28,12 +28,12 @@ Tensor& addcmul_out_npu_nocheck(
const Scalar value) {
OpCommand cmd;
cmd.Name("Addcmul")
.Input(self)
.Input(tensor1)
.Input(tensor2)
.Input(value, self.scalar_type())
.Output(result)
.Run();
.Input(self)
.Input(tensor1)
.Input(tensor2)
.Input(value, self.scalar_type())
.Output(result)
.Run();
return result;
}
@@ -56,7 +56,7 @@ Tensor& affine_grid_generator_backward_nocheck(
return result;
}
}//namespace
} // namespace
Tensor affine_grid_generator_backward_npu(
const Tensor& grad,
@@ -81,7 +81,7 @@ Tensor& all_out_npu(
Tensor all_npu(const Tensor& self, int64_t dim, bool keepdim) {
TORCH_CHECK(self.scalar_type() == ScalarType::Bool || self.scalar_type() == ScalarType::Byte,
"all only supports torch.uint8 and torch.bool dtypes");
"all only supports torch.uint8 and torch.bool dtypes");
if (self.numel() == 0) {
Tensor res = at::empty_with_format({}, self.options().dtype(kInt), CalcuOpUtil::get_tensor_npu_format(self)).fill_(1).to(ScalarType::Bool);
return res;
@@ -103,12 +103,12 @@ Tensor all_npu(const Tensor& self, int64_t dim, bool keepdim) {
Tensor all_npu(const Tensor& self) {
TORCH_CHECK(self.scalar_type() == ScalarType::Bool || self.scalar_type() == ScalarType::Byte,
"all only supports torch.uint8 and torch.bool dtypes");
"all only supports torch.uint8 and torch.bool dtypes");
if (self.numel() == 0) {
Tensor res = at::empty_with_format(
{},
self.options().dtype(kInt),
CalcuOpUtil::get_tensor_npu_format(self)).fill_(1).to(ScalarType::Bool);
{},
self.options().dtype(kInt),
CalcuOpUtil::get_tensor_npu_format(self)).fill_(1).to(ScalarType::Bool);
return res;
}
@@ -20,7 +20,7 @@
namespace at {
namespace native {
using namespace at::native::npu;
std::tuple<Tensor, Tensor, Tensor> apply_adam_out_npu(
std::tuple<Tensor, Tensor, Tensor> apply_adam_out_npu_nocheck(
Tensor& var_out,
Tensor& m_out,
Tensor& v_out,
@@ -57,6 +57,49 @@ std::tuple<Tensor, Tensor, Tensor> apply_adam_out_npu(
return std::tie(var_out, m_out, v_out);
}
std::tuple<Tensor, Tensor, Tensor> npu_apply_adam(
Scalar beta1_power,
Scalar beta2_power,
Scalar lr,
Scalar beta1,
Scalar beta2,
Scalar epsilon,
const Tensor& grad,
c10::optional<bool> use_locking,
c10::optional<bool> use_nesterov) {
AT_ERROR("npu_apply_adam is not implemented for Tensor");
}
std::tuple<Tensor&, Tensor&, Tensor&> apply_adam_out_npu(
Tensor& var,
Tensor& m,
Tensor& v,
Scalar beta1_power,
Scalar beta2_power,
Scalar lr,
Scalar beta1,
Scalar beta2,
Scalar epsilon,
const Tensor& grad,
c10::optional<bool> use_locking,
c10::optional<bool> use_nesterov) {
apply_adam_npu(
var,
m,
v,
beta1_power,
beta2_power,
lr,
beta1,
beta2,
epsilon,
grad,
use_locking,
use_nesterov);
return std::tie(var, m, v);
}
std::tuple<Tensor, Tensor, Tensor> apply_adam_npu(
Tensor& var,
Tensor& m,
@@ -77,7 +120,7 @@ std::tuple<Tensor, Tensor, Tensor> apply_adam_npu(
Tensor contiguous_var = var_match ? var : NpuUtils::format_contiguous(var);
Tensor contiguous_m = m_match ? m : NpuUtils::format_contiguous(m);
Tensor contiguous_v = v_match ? v : NpuUtils::format_contiguous(v);
apply_adam_out_npu(
apply_adam_out_npu_nocheck(
contiguous_var,
contiguous_m,
contiguous_v,
@@ -100,7 +143,7 @@ std::tuple<Tensor, Tensor, Tensor> apply_adam_npu(
NpuUtils::format_fresh_view(v, contiguous_v);
}
} else {
apply_adam_out_npu(
apply_adam_out_npu_nocheck(
var,
m,
v,
@@ -117,4 +160,4 @@ std::tuple<Tensor, Tensor, Tensor> apply_adam_npu(
return std::tie(var, m, v);
}
} // namespace native
} // namespace at
} // namespace at
@@ -40,9 +40,9 @@ Tensor& arange_out_npu_nocheck(
Scalar step) {
OpCommand cmd;
cmd.Name("Range")
.Input(start, result.scalar_type()) //start
.Input(end, result.scalar_type()) //limit
.Input(step, result.scalar_type()) //delta
.Input(start, result.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Input(end, result.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Input(step, result.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Output(result)
.Run();
@@ -50,11 +50,11 @@ Tensor& arange_out_npu_nocheck(
}
Tensor arange_npu(Scalar end, const TensorOptions& options) {
return arange_npu(/*start=*/0, end, options);
return arange_npu(0, end, options); // start = 0
}
Tensor arange_npu(Scalar start, Scalar end, const TensorOptions& options) {
return arange_npu(start, end, /*step=*/1, options);
return arange_npu(start, end, 1, options);
}
Tensor arange_npu(
@@ -66,7 +66,7 @@ Tensor arange_npu(
float end_value = CalcuOpUtil::get_scalar_float_value(end);
float step_value = CalcuOpUtil::get_scalar_float_value(step);
//Check step start end
// Check step start end
TORCH_CHECK(step_value > 0 || step_value < 0, "step must be nonzero");
TORCH_CHECK(((step_value > 0) && (end_value >= start_value)) || ((step_value < 0) && (end_value <= start_value)),
"upper bound and larger bound inconsistent with step sign");
@@ -74,10 +74,9 @@ Tensor arange_npu(
bool set_to_integral_dtype =
!options.has_dtype() && allIntegral({start, end, step});
//check start == end
// check start == end
Tensor result_check = set_to_integral_dtype
? at::empty_with_format(
{0}, options.dtype(at::ScalarType::Int), ACL_FORMAT_ND)
? at::empty_with_format({0}, options.dtype(at::ScalarType::Int), ACL_FORMAT_ND)
: at::empty_with_format({0}, options, ACL_FORMAT_ND);
if (start_value == end_value) {
return result_check;
@@ -90,8 +89,7 @@ Tensor arange_npu(
SmallVector<int64_t, SIZE> outputSize = {size_value};
Tensor result = set_to_integral_dtype
? at::empty_with_format(
outputSize, options.dtype(at::ScalarType::Int), ACL_FORMAT_ND)
? at::empty_with_format(outputSize, options.dtype(at::ScalarType::Int), ACL_FORMAT_ND)
: at::empty_with_format(outputSize, options, ACL_FORMAT_ND);
if(options.dtype() == at::kHalf) {
@@ -108,11 +106,11 @@ Tensor arange_npu(
}
Tensor& arange_out_npu(Tensor& result, Scalar end) {
return arange_out_npu(result, /*start=*/0, end);
return arange_out_npu(result, 0, end);
}
Tensor& arange_out_npu(Tensor& result, Scalar start, Scalar end) {
return arange_out_npu(result, start, end, /*step=*/1);
return arange_out_npu(result, start, end, 1);
}
Tensor& arange_out_npu(
@@ -124,7 +122,7 @@ Tensor& arange_out_npu(
float end_value = CalcuOpUtil::get_scalar_float_value(end);
float step_value = CalcuOpUtil::get_scalar_float_value(step);
//Check step start end
// Check step start end
TORCH_CHECK(step_value > 0 || step_value < 0, "step must be nonzero");
TORCH_CHECK(((step_value > 0) && (end_value >= start_value)) || ((step_value < 0) && (end_value <= start_value)),
"upper bound and larger bound inconsistent with step sign");
@@ -68,7 +68,7 @@ Tensor& argsort_out_npu_nocheck(
at::npu_transpose_out(indices, transposeIndices, perm);
//indices dtype transform to Int64
// indices dtype transform to Int64
indices = indices.to(at::kLong);
return indices;
@@ -32,7 +32,7 @@ Tensor& atan_out_npu(Tensor& result, const Tensor& self) {
Tensor atan_npu(const Tensor& self) {
Tensor result = OpPreparation::ApplyTensor(self);
//calculate the output result of the NPU
// calculate the output result of the NPU
atan_out_npu(result, self);
return result;
}
@@ -15,29 +15,42 @@
// limitations under the License.
#include "ATen/native/npu/utils/OpAdapter.h"
#include "c10/npu/SecondaryStreamGuard.h"
#include "c10/npu/NPUCachingAllocator.h"
namespace at {
namespace native {
using namespace at::native::npu;
Tensor& bernoulli_out_npu(Tensor& result, const Tensor& self, double p) {
OpCommand cmd;
cmd.Name("Bernoulli")
.Input(self)
.Input(p, ScalarType::Float)
.Output(result)
.Run();
Tensor& bernoulli_npu_nocheck(Tensor& result, const Tensor& self, double p) {
auto original_stream = c10::npu::getCurrentNPUStream();
{
c10::npu::SecondaryStreamGuard guard(c10::npu::getCurrentSecondaryStream());
OpCommand cmd;
cmd.Name("Bernoulli")
.Input(self)
.Input(p, ScalarType::Float)
.Output(result)
.Run();
}
c10::npu::NPUCachingAllocator::recordStream(self.storage().data_ptr(), original_stream);
return result;
}
Tensor& bernoulli_out_npu(Tensor& result, const Tensor& self, const Tensor& p) {
OpCommand cmd;
cmd.Name("Bernoulli")
.Input(self)
.Input(p)
.Output(result)
.Run();
Tensor& bernoulli_npu_nocheck(Tensor& result, const Tensor& self, const Tensor& p) {
auto original_stream = c10::npu::getCurrentNPUStream();
{
c10::npu::SecondaryStreamGuard guard(c10::npu::getCurrentSecondaryStream());
OpCommand cmd;
cmd.Name("Bernoulli")
.Input(self)
.Input(p)
.Output(result)
.Run();
}
c10::npu::NPUCachingAllocator::recordStream(self.storage().data_ptr(), original_stream);
c10::npu::NPUCachingAllocator::recordStream(p.storage().data_ptr(), original_stream);
return result;
}
@@ -52,10 +65,10 @@ Tensor& bernoulli_npu_(Tensor& self, double p, Generator* gen) {
if (!NpuUtils::check_match(&self)) {
Tensor contiguousSelf = NpuUtils::format_contiguous(selfFp32);
Tensor result = bernoulli_out_npu(contiguousSelf, contiguousSelf, p);
Tensor result = bernoulli_npu_nocheck(contiguousSelf, contiguousSelf, p);
NpuUtils::format_fresh_view(self, result);
} else {
bernoulli_out_npu(selfFp32, selfFp32, p);
bernoulli_npu_nocheck(selfFp32, selfFp32, p);
self.copy_(selfFp32);
}
@@ -69,7 +82,7 @@ Tensor& bernoulli_npu_(Tensor& self, const Tensor& p, Generator* gen) {
OpPreparation::CheckMemory({self}, {self});
ScalarType selfType = self.scalar_type();
Tensor selfFp32 = self;
Tensor pFp32 = OpPreparation::CastBackToOriFormat(p);;
Tensor pFp32 = OpPreparation::CastBackToOriFormat(p);
if (self.scalar_type() == ScalarType::Half) {
selfFp32 = self.to(ScalarType::Float);
pFp32 = p.to(ScalarType::Float);
@@ -77,10 +90,10 @@ Tensor& bernoulli_npu_(Tensor& self, const Tensor& p, Generator* gen) {
if (!NpuUtils::check_match(&self)) {
Tensor contiguousSelf = NpuUtils::format_contiguous(selfFp32);
Tensor result = bernoulli_out_npu(contiguousSelf, contiguousSelf, pFp32);
Tensor result = bernoulli_npu_nocheck(contiguousSelf, contiguousSelf, pFp32);
NpuUtils::format_fresh_view(self, result);
} else {
bernoulli_out_npu(selfFp32, selfFp32, pFp32);
bernoulli_npu_nocheck(selfFp32, selfFp32, pFp32);
self.copy_(selfFp32);
}
@@ -1,5 +1,5 @@
// Copyright (c) 2020 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
@@ -34,7 +34,10 @@ tuple<Tensor, Tensor, Tensor> bert_apply_adam_out_npu_nocheck(
const Tensor& grad,
Scalar max_grad_norm,
Scalar global_grad_norm,
Scalar weight_decay) {
Scalar weight_decay,
optional<Scalar> step_size,
int64_t adam_mode) {
std::string adamMode = adam_mode == 0 ? "adam" : "mbart_adam";
OpCommand cmd;
cmd.Name("ApplyAdamV2")
.Input(var)
@@ -47,21 +50,19 @@ tuple<Tensor, Tensor, Tensor> bert_apply_adam_out_npu_nocheck(
.Input(grad)
.Input(max_grad_norm, var.scalar_type())
.Input(global_grad_norm, var.scalar_type())
.Input(weight_decay, var.scalar_type())
.Output(var_out)
.Input(weight_decay, var.scalar_type());
if (step_size.has_value()) {
cmd.Input(step_size.value(), var.scalar_type());
}
cmd.Output(var_out)
.Output(m_out)
.Output(v_out)
.Attr("adam_mode", adamMode)
.Run();
return std::tie(var_out, m_out, v_out);
}
tuple<Tensor, Tensor, Tensor> bert_apply_adam_out_npu(
Tensor& var_out,
Tensor& m_out,
Tensor& v_out,
const Tensor& var,
const Tensor& m,
const Tensor& v,
std::tuple<Tensor, Tensor, Tensor> npu_bert_apply_adam(
Scalar lr,
Scalar beta1,
Scalar beta2,
@@ -69,21 +70,30 @@ tuple<Tensor, Tensor, Tensor> bert_apply_adam_out_npu(
const Tensor& grad,
Scalar max_grad_norm,
Scalar global_grad_norm,
Scalar weight_decay) {
OpPipeWithDefinedOut check;
check.CheckMemory({var, m, v, grad}, {var_out, m_out, v_out});
Scalar weight_decay,
optional<Scalar> step_size,
int64_t adam_mode) {
AT_ERROR("npu_bert_apply_adam is not implemented for Tensor");
}
auto func = [&var, &m, &v, &lr, &beta1, &beta2, &epsilon, &grad, &max_grad_norm, &global_grad_norm, &weight_decay] (
Tensor& var_out,
Tensor& m_out,
Tensor& v_out) {
bert_apply_adam_out_npu_nocheck(var_out, m_out, v_out, var, m, v,
lr, beta1, beta2, epsilon, grad, max_grad_norm, global_grad_norm, weight_decay);
};
OpPipeWithMultiOut<Tensor&, Tensor&, Tensor&> pipe(var_out, m_out, v_out);
return pipe.Call(func)
.ReturnRef<Tensor&, Tensor&, Tensor&>();
tuple<Tensor&, Tensor&, Tensor&> bert_apply_adam_out_npu(
Tensor& var,
Tensor& m,
Tensor& v,
Scalar lr,
Scalar beta1,
Scalar beta2,
Scalar epsilon,
const Tensor& grad,
Scalar max_grad_norm,
Scalar global_grad_norm,
Scalar weight_decay,
optional<Scalar> step_size,
int64_t adam_mode) {
bert_apply_adam_npu(
var, m, v,
lr, beta1, beta2, epsilon, grad, max_grad_norm, global_grad_norm, weight_decay, step_size, adam_mode);
return std::tie(var, m, v);
}
tuple<Tensor, Tensor, Tensor> bert_apply_adam_npu(
@@ -97,12 +107,13 @@ tuple<Tensor, Tensor, Tensor> bert_apply_adam_npu(
const Tensor& grad,
Scalar max_grad_norm,
Scalar global_grad_norm,
Scalar weight_decay) {
bert_apply_adam_out_npu(
Scalar weight_decay,
optional<Scalar> step_size,
int64_t adam_mode) {
bert_apply_adam_out_npu_nocheck(
var, m, v, var, m, v,
lr, beta1, beta2, epsilon, grad, max_grad_norm, global_grad_norm, weight_decay);
lr, beta1, beta2, epsilon, grad, max_grad_norm, global_grad_norm, weight_decay, step_size, adam_mode);
return std::tie(var, m, v);
}
} // namespace native
} // namespace at
@@ -0,0 +1,76 @@
// Copyright (c) 2020 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ATen/native/npu/utils/OpAdapter.h"
#include "ATen/native/npu/utils/CalcuOpUtil.h"
namespace at {
namespace native {
using namespace at::native::npu;
Tensor& bincount_npu_nocheck(
const Tensor& self,
const Tensor& weights,
int64_t sizes,
Tensor& result) {
OpCommand cmd;
cmd.Name("Bincount")
.Input(self)
.Input(sizes, ScalarType::Int)
.Input(weights)
.Output(result)
.Run();
return result;
}
Tensor bincount_npu(
const Tensor& self,
const Tensor& weights,
int64_t minlength) {
if (self.sizes()[0] == 0) {
auto result = OpPreparation::ApplyTensorWithSizes(
{0},
self.options().dtype(at::ScalarType::Long));
return result;
}
// calculate output size
auto sizes = static_cast<int64_t>(
CalcuOpUtil::get_scalar_float_value(max_npu(self).item()));
sizes = (sizes < minlength) ? minlength : (sizes + 1);
// input convert to int32
if (self.dtype() == at::ScalarType::Long) {
TORCH_WARN_ONCE("CANN: Bincount cann't support dtype int64.");
}
auto input = self.npu_dtype_cast(at::ScalarType::Int);
// weight convert dtype as same as output defined by torch
auto weight = weights;
if (!weights.defined()) {
TensorOptions options = input.options();
weight = ones_npu(input.sizes(), options.dtype(at::ScalarType::Long));
} else if (!(weights.dtype() == at::ScalarType::Float)) {
weight = weights.npu_dtype_cast(at::ScalarType::Double);
}
auto result = OpPreparation::ApplyTensor(weight, {sizes});
bincount_npu_nocheck(input, weight, sizes, result);
return result;
}
} // namespace native
} // namespace at
@@ -73,8 +73,10 @@ Tensor bmm_npu(const Tensor& self, const Tensor& mat2) {
if ((self.scalar_type() == ScalarType::Half) && !c10::npu::OptionsManager::CheckSwitchMMOutputEnable()) {
// check is 16-algined with high-performance
auto isAligin = [&]() {
return (!(self.size(1) & 0x0000000F)) && (!(self.size(2) & 0x0000000F)) &&
(!(mat2.size(1) & 0x0000000F)) && (!(mat2.size(2) & 0x0000000F));
return (!(static_cast<uint64_t>(self.size(1)) & 0x0000000F)) &&
(!(static_cast<uint64_t>(self.size(2)) & 0x0000000F)) &&
(!(static_cast<uint64_t>(mat2.size(1)) & 0x0000000F)) &&
(!(static_cast<uint64_t>(mat2.size(2)) & 0x0000000F));
};
// There is a data trampling problem in non-aligned scenes. For the time being, only aligned scenes are supported.
if (env::CheckMmBmmNDEnable() && FormatHelper::IsBaseFormatType(self) &&
@@ -32,7 +32,7 @@ Tensor& cast_nocheck(Tensor& result, const Tensor& self) {
.Run();
return result;
}
}//namespace
} // namespace
Tensor dtype_cast_npu(const Tensor& self, ScalarType dtype) {
if (self.dtype() == dtype) {
@@ -17,10 +17,21 @@
#include "c10/npu/OptionsManager.h"
#include "ATen/native/npu/utils/OpAdapter.h"
#include "ATen/native/npu/utils/CalcuOpUtil.h"
#include "third_party/acl/inc/op_proto/split_combination_ops.h"
namespace at {
namespace native {
using namespace at::native::npu;
namespace {
template <typename ge_op_type>
at::native::npu::DynamicInputRegFunc concat_func =
[](DyNumAndIndex num_and_index,
std::string op_name) -> ge::OperatorPtr {
auto ge_op = std::make_shared<ge_op_type>(op_name.c_str());
ge_op->create_dynamic_input_byindex_x(
num_and_index.front().first, num_and_index.front().second);
return ge_op;
};
}
SmallVector<Tensor, N> cat_dest_tensor_list(TensorList tensors) {
SmallVector<Tensor, N> dstTensorList;
@@ -102,52 +113,66 @@ Tensor& _cat_out_npu(Tensor& result, TensorList tensors, int64_t dim) {
// executing the NPU operator
int64_t input_number = 0;
if (!c10::npu::OptionsManager::CheckDynamicEnable()) {
OpCommand cmd;
cmd.Name("ConcatD");
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() == 0) {
continue;
}
string inputName = "x" + to_string(input_number++);
cmd.Input(inputTensors[i], inputName);
}
cmd.Output(result)
.Attr("N", input_number)
.Attr("concat_dim", dim)
.Run();
} else {
OpDynamicCommand cmd;
cmd.Name("ConcatD");
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() == 0) {
continue;
}
string inputName = "x" + to_string(input_number++);
cmd.Input(inputTensors[i], inputName);
}
cmd.Output(result)
.Attr("N", input_number)
.Attr("concat_dim", dim);
// DYNAMIC
SmallVector<int64_t, N> dimVec = {dim};
OpCommand cmd;
cmd.Name("ConcatD");
cmd.DynamicName("Concat")
.DynamicInput(dimVec, at::kLong, at::kInt, "", true, FIXED_CONST_VALUE);
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() == 0) {
continue;
// In graph mode, if all of input tensors are null numel,
// these null tensors should be passed to ConcatD as inputs.
// Otherwise, an error will be reported when infershape.
bool tensors_empty_in_graph_mode = false;
if (c10::npu::NpuRunMode::IsGraphMode()) {
tensors_empty_in_graph_mode = true;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() != 0) {
tensors_empty_in_graph_mode = false;
break;
}
}
}
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() != 0 || tensors_empty_in_graph_mode) {
string inputName = "x" + to_string(input_number++);
cmd.DynamicInput(inputTensors[i], inputName);
}
cmd.Input(inputTensors[i], inputName);
}
}
cmd.DynamicInputReg(concat_func<ge::op::ConcatD>, {{input_number, 0}})
.Output(result)
.Attr("N", input_number)
.Attr("concat_dim", dim)
.Run();
} else {
OpDynamicCommand cmd;
cmd.Name("ConcatD");
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() == 0) {
continue;
}
string inputName = "x" + to_string(input_number++);
cmd.Input(inputTensors[i], inputName);
}
cmd.Output(result)
.Attr("N", input_number)
.Attr("concat_dim", dim);
// DYNAMIC
SmallVector<int64_t, N> dimVec = {dim};
cmd.DynamicName("Concat")
.DynamicInput(dimVec, at::kLong, at::kInt, "", true, FIXED_CONST_VALUE);
input_number = 0;
for (int i = 0; i < inputTensors.size(); i++) {
if (inputTensors[i].numel() == 0) {
continue;
}
string inputName = "x" + to_string(input_number++);
cmd.DynamicInput(inputTensors[i], inputName);
}
cmd.DynamicOutput(result)
.DynamicAttr("N", input_number)
.DynamicOpRun();
cmd.DynamicOutput(result)
.DynamicAttr("N", input_number)
.DynamicOpRun();
}
return result;
@@ -163,11 +188,11 @@ Tensor& cat_out_npu(Tensor& result, TensorList tensors, int64_t dim) {
dim = CalcuOpUtil::make_wrap_dim(dim, dim_post_expr);
auto outputSize = cat_npu_output_size(inputTensors, dim);
OpPreparation::CheckOut(
{tensors[0]},
result,
ACL_FORMAT_ND,
tensors[0].scalar_type(),
outputSize);
{tensors[0]},
result,
ACL_FORMAT_ND,
tensors[0].scalar_type(),
outputSize);
return at::_cat_out(result, tensors, dim);
}
@@ -50,7 +50,7 @@ Tensor _cdist_backward_npu(
p_float = std::numeric_limits<float>::infinity();
}
else {
p_float = (float) p;
p_float = static_cast<float>(p);
}
// Broadcast
@@ -76,7 +76,7 @@ Tensor _cdist_backward_npu(
Tensor grad_broadcast = grad.view(grad_expand_size).expand(tensor_broadcast_size).contiguous();
Tensor cdist_broadcast = cdist.view(cdist_expand_size).expand(tensor_broadcast_size).contiguous();
//Executing the NPU operator.
// Executing the NPU operator.
auto outputSize = input_same_output_size(x1);
Tensor result = OpPreparation::ApplyTensor(tensor1_broadcast, outputSize);
OpCommand cmd;
@@ -79,7 +79,7 @@ Tensor _cdist_forward_npu(
}
else {
TORCH_CHECK(p <= std::numeric_limits<float>::max(), "npu dose not support float64" );
p_float = (float) p;
p_float = static_cast<float>(p);
}
int64_t mode = compute_mode.value_or(0);
@@ -115,7 +115,7 @@ Tensor _cdist_forward_npu(
Tensor tensor1_broadcast = tensor1_expanded.expand(tensor_broadcast_size).contiguous();
Tensor tensor2_broadcast = tensor2_expanded.expand(tensor_broadcast_size).contiguous();
//Executing the NPU operator.
// Executing the NPU operator.
auto output_size = cdist_npu_output_size(x1, x2);
Tensor result = at::empty_with_format(
@@ -21,14 +21,11 @@ namespace native {
using namespace at::native::npu;
Tensor celu_out_npu_nocheck(Tensor& result, const Tensor& self, Scalar alpha) {
float alpha3 = 1.0;
OpCommand cmd;
cmd.Name("Celu")
.Input(self)
.Output(result)
.Attr("alpha1", alpha)
.Attr("alpha2", alpha)
.Attr("alpha3", alpha3)
.Attr("alpha", alpha)
.Run();
return result;
}
@@ -60,8 +60,7 @@ bool is_backward(IntArrayRef pad) {
}
Tensor constant_pad_nd_npu(const Tensor& self, IntArrayRef pad, Scalar value){
TORCH_CHECK(pad.size() % 2 == 0, "Length of pad must be even but instead it equals ",
pad.size());
TORCH_CHECK(pad.size() % 2 == 0, "Length of pad must be even but instead it equals ", pad.size());
auto input_sizes = self.sizes();
auto l_inp = self.dim();
@@ -69,8 +68,8 @@ Tensor constant_pad_nd_npu(const Tensor& self, IntArrayRef pad, Scalar value){
auto l_pad = pad.size() / 2;
auto l_diff = l_inp - l_pad;
TORCH_CHECK(l_inp >= (int64_t)l_pad, "Length of pad should be no more than twice the number of "
"dimensions of the input. Pad length is ", pad.size(), "while the input has ",
l_inp, "dimensions.");
"dimensions of the input. Pad length is ", pad.size(), "while the input has ",
l_inp, "dimensions.");
std::vector<int64_t> new_shape;
for (size_t i = 0; i < (size_t)l_diff; i++) {
@@ -81,12 +80,12 @@ Tensor constant_pad_nd_npu(const Tensor& self, IntArrayRef pad, Scalar value){
auto pad_idx = pad.size() - ((i + 1) * 2);
auto new_dim = input_sizes[l_diff + i] + pad[pad_idx] + pad[pad_idx + 1];
TORCH_CHECK(new_dim > 0, "The input size ", input_sizes[l_diff + i], ", plus negative padding ",
pad[pad_idx], " and ", pad[pad_idx + 1], "resulted in a negative output size, "
"which is invalid. Check dimension ", l_diff + i, "of your input.");
pad[pad_idx], " and ", pad[pad_idx + 1], "resulted in a negative output size, "
"which is invalid. Check dimension ", l_diff + i, "of your input.");
new_shape.emplace_back(new_dim);
}
if (is_backward(pad)) {
if (is_backward(pad)) {
TORCH_CHECK(pad.size() % 2 == 0,
"Length of pad must be even but instead it equals ", pad.size());
@@ -96,18 +95,31 @@ Tensor constant_pad_nd_npu(const Tensor& self, IntArrayRef pad, Scalar value){
for (int64_t i = 0; i < max_pad_size - pad.size(); i++) {
pad_vec.emplace_back(0);
}
}
}
SmallVector<int64_t, SIZE> begin_list = {};
SmallVector<int64_t, SIZE> end_list = {};
SmallVector<int64_t, SIZE> strides = {};
SmallVector<int64_t, SIZE> begin_list(self.dim(), 0);
SmallVector<int64_t, SIZE> end_list;
for(auto i: self.sizes())
{
end_list.push_back(i);
}
SmallVector<int64_t, SIZE> strides(self.dim(), 1);
Tensor result = self;
for (int64_t i = 0; i < self.dim(); i++) {
begin_list.emplace_back(-pad_vec[max_pad_size - 2 * (i + 1)]);
end_list.emplace_back(self.size(i) + pad_vec[max_pad_size - 1 - 2 * i]);
strides.emplace_back(1);
if(pad_vec[max_pad_size - 2 * (i + 1)] == 0 && pad_vec[max_pad_size - 1 - 2 * i] == 0)
{
continue;
}
begin_list[i] = begin_list[i] + (-pad_vec[max_pad_size - 2 * (i + 1)]);
end_list[i] = end_list[i] + pad_vec[max_pad_size - 1 - 2 * i];
result = at::npu_indexing(result, begin_list, end_list, strides);
begin_list[i] = 0;
end_list[i] = result.size(i);
}
return at::npu_indexing(self, begin_list, end_list, strides);
return result;
}
// construct the output tensor of the NPU
@@ -30,10 +30,10 @@ int64_t cross_real_dim(optional<int64_t> dim) {
}
Tensor& cross_out_npu(
Tensor& result,
const Tensor& self,
const Tensor& other,
optional<int64_t> dim) {
Tensor& result,
const Tensor& self,
const Tensor& other,
optional<int64_t> dim) {
int64_t realDim = cross_real_dim(dim);
OpCommand cmd;
cmd.Name("Cross")
@@ -46,15 +46,15 @@ Tensor& cross_out_npu(
}
Tensor cross_npu(
const Tensor& self,
const Tensor& other,
optional<int64_t> dim) {
const Tensor& self,
const Tensor& other,
optional<int64_t> dim) {
auto outputSize = broadcast_ops_npu_output_size(self, other);
Tensor outputTensor = cross_dest_output(self, other);
Tensor result = at::empty_with_format(
outputSize,
self.options(),
CalcuOpUtil::get_tensor_npu_format(outputTensor));
outputSize,
self.options(),
CalcuOpUtil::get_tensor_npu_format(outputTensor));
cross_out_npu(result, self, other, dim);
return result;
}
@@ -33,7 +33,7 @@ std::tuple<Tensor, Tensor> ctc_loss_npu(
logProbsNeed = logProbsNeed.to(ScalarType::Float);
}
//Aicore supports only the int type
// Aicore supports only the int type
Tensor targetsCast = targets;
if(targets.scalar_type() == ScalarType::Long){
targetsCast = targetsCast.to(ScalarType::Int);
@@ -96,9 +96,9 @@ Tensor ctc_loss_npu(
if (zeroInfinity) {
res = at::where(
res == Scalar(std::numeric_limits<double>::infinity()),
at::zeros({}, res.options()),
res);
res == Scalar(std::numeric_limits<double>::infinity()),
at::zeros({}, res.options()),
res);
}
if (reduction == at::Reduction::Mean) {
@@ -125,8 +125,8 @@ Tensor ctc_loss_npu(
int64_t blank,
int64_t reduction,
bool zeroInfinity) {
TORCH_CHECK(isIntegralType(inputLengths.scalar_type(), /*includeBool=*/false), "input_lengths must be integral");
TORCH_CHECK(isIntegralType(targetLengths.scalar_type(), /*includeBool=*/false), "target_lengths must be integral");
TORCH_CHECK(isIntegralType(inputLengths.scalar_type(), false), "input_lengths must be integral");
TORCH_CHECK(isIntegralType(targetLengths.scalar_type(), false), "target_lengths must be integral");
Tensor inputLengthsTensor = inputLengths.to(Device(at::kCPU), at::kLong).contiguous();
Tensor targetLengthsTensor = targetLengths.to(Device(at::kCPU), at::kLong).contiguous();
@@ -22,10 +22,10 @@ namespace native {
using namespace at::native::npu;
void cummin_out_npu_nocheck (
Tensor& values,
Tensor& indices,
const Tensor& self,
int64_t dim) {
Tensor& values,
Tensor& indices,
const Tensor& self,
int64_t dim) {
OpCommand cmd;
cmd.Name("Cummin")
.Input(self)
@@ -36,7 +36,7 @@ void cummin_out_npu_nocheck (
}
void cummin_helper_npu(const Tensor& self, Tensor& values, Tensor& indices, int64_t dim) {
//process aicpu
// process aicpu
if(self.scalar_type() == ScalarType::Long){
Tensor valuesTemp = OpPreparation::ApplyTensor(self);
Tensor indicesTemp = OpPreparation::ApplyTensor(self, self.options().dtype(kLong));
@@ -44,7 +44,7 @@ void cummin_helper_npu(const Tensor& self, Tensor& values, Tensor& indices, int6
values.copy_(valuesTemp);
indices.copy_(indicesTemp);
} else {
//process aicore
// process aicore
int64_t firstDim = CalcuOpUtil::make_wrap_dim(0, self.dim());
if (dim != firstDim) {
SmallVector<int64_t, SHAPE_SIZE> perm;
@@ -59,7 +59,7 @@ void cummin_helper_npu(const Tensor& self, Tensor& values, Tensor& indices, int6
Tensor transposeIndices = OpPreparation::ApplyTensor(outputSize, self.options().dtype(kInt), self);
cummin_out_npu_nocheck(transposeValue, transposeIndices, transposeSelf, firstDim);
//Indices must to be long
// Indices must to be long
transposeIndices = transposeIndices.to(kLong);
at::npu_transpose_out(values, transposeValue, perm);
at::npu_transpose_out(indices, transposeIndices, perm);
@@ -28,9 +28,9 @@ Tensor& _cumsum_out_npu(Tensor& result, const Tensor& self, int64_t dim) {
cmd.Name("Cumsum")
.Input(self);
if (dim == 0 || dim > INT32_MAX) {
cmd.Input(dimScalar, at::kLong, MemoryType::MEMORY_HOST);
cmd.Input(dimScalar, at::kLong, CompileType::MEMORY_HOST_COMPILE_DEPENDENT);
} else {
cmd.Input(dimScalar, at::kInt, MemoryType::MEMORY_HOST);
cmd.Input(dimScalar, at::kInt, CompileType::MEMORY_HOST_COMPILE_DEPENDENT);
}
cmd.Output(result)
.Run();
@@ -60,7 +60,7 @@ Tensor det_npu(const Tensor& self) {
// construct the output tensor of the NPU
Tensor result = at::empty_with_format(
outputSize, self.options(), CalcuOpUtil::get_tensor_npu_format(self));
outputSize, self.options(), CalcuOpUtil::get_tensor_npu_format(self));
// calculate the output result of the NPU
det_out_npu(result, self);
return result;
@@ -24,12 +24,12 @@ using namespace at::native::npu;
Tensor& div_out_npu(Tensor& result, const Tensor& self, const Scalar other) {
auto unified_result = OpPreparation::binary_op_check(result, self, other, true);
OpCommand cmd;
cmd.Name("Div")
.Expect(unified_result)
.Input(self)
.Input(other, self.scalar_type())
.Output(result)
.Run();
cmd.Name("RealDiv")
.Expect(unified_result)
.Input(self)
.Input(other, self.scalar_type())
.Output(result)
.Run();
return result;
}
@@ -37,17 +37,17 @@ Tensor& div_out_npu(Tensor& result, const Tensor& self, const Scalar other) {
Tensor& div_out_npu_nocheck(Tensor& result, const Tensor& self, const Tensor& other) {
// executing the NPU operator
if (other.dim() == 0) {
if (other.dim() == 0 && !other.is_npu()) {
div_out_npu(result, self, other.item());
} else {
auto unified_result = OpPreparation::binary_op_check(result, self, other, true);
OpCommand cmd;
cmd.Name("Div")
cmd.Name("RealDiv")
.Expect(unified_result)
.Input(self)
.Input(other)
.Output(result)
.Run();
.Run();
}
return result;
@@ -58,11 +58,11 @@ Tensor& div_out_npu(Tensor& result, const Tensor& self, const Tensor& other) {
Tensor outputTensor = CalcuOpUtil::is_scalar_wrapped_to_tensor(self) ? other : self;
auto outputSize = broadcast_ops_npu_output_size(self, other);
OpPreparation::CheckOut(
{self},
result,
CalcuOpUtil::get_tensor_npu_format(outputTensor),
self.scalar_type(),
outputSize);
{self},
result,
CalcuOpUtil::get_tensor_npu_format(outputTensor),
self.scalar_type(),
outputSize);
div_out_npu_nocheck(result, self, other);
return result;
@@ -93,8 +93,8 @@ Tensor div_npu(const Tensor& self, Scalar other) {
// construct the output tensor of the NPU
Tensor result = at::empty_with_format(
outputSize,
self.options(),
outputSize,
self.options(),
CalcuOpUtil::get_tensor_npu_format(self));
// calculate the output result of the NPU
@@ -32,14 +32,12 @@ Tensor dropout_backward_npu(
"mask should be torch.uint8 dtype");
double retain = 1. - scale;
Tensor result = OpPreparation::ApplyTensor(grad_output);
Tensor prob =
CalcuOpUtil::CopyScalarToDevice(retain, grad_output.scalar_type());
OpCommand cmd;
cmd.Name("DropOutDoMask")
.Input(grad_output)
.Input(mask)
.Input(prob)
.Input(retain, grad_output.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Output(result)
.Run();
@@ -27,19 +27,19 @@ Tensor dropout_do_mask(
Tensor& result,
const Tensor& self,
const Tensor& mask,
const Tensor& prob) {
Scalar prob) {
OpCommand cmd;
cmd.Name("DropOutDoMask")
.Input(self)
.Input(mask)
.Input(prob)
.Input(prob, self.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Output(result)
.Run();
return result;
}
Tensor dropout_gen_mask(const Tensor& self, const Tensor& prob) {
Tensor dropout_gen_mask(const Tensor& self, Scalar prob) {
uint32_t length = (self.numel() + 128 - 1) / 128 * 128;
Tensor mask = at::empty_with_format(
{length / 8},
@@ -55,7 +55,7 @@ Tensor dropout_gen_mask(const Tensor& self, const Tensor& prob) {
int64_t seed2 = 0;
cmd.Name("DropOutGenMask")
.Input(selfShape)
.Input(prob)
.Input(prob, self.scalar_type(), CompileType::MEMORY_HOST_COMPILE_DEPENDENT)
.Output(mask)
.Attr("seed", seed)
.Attr("seed2", seed2)
@@ -76,7 +76,7 @@ std::tuple<Tensor, Tensor> dropout_v1_npu_impl(
"dropout only supports floating-point dtypes");
double retain = 1. - p;
Tensor prob;
Scalar prob = Scalar(retain);
Tensor mask;
auto original_stream = c10::npu::getCurrentNPUStream();
{
@@ -85,12 +85,10 @@ std::tuple<Tensor, Tensor> dropout_v1_npu_impl(
// same time, according to the one-stream-one-pool principle, memory is also
// alloced from the pool of the secondary stream.
c10::npu::SecondaryStreamGuard guard(c10::npu::getCurrentSecondaryStream());
prob = scalar_to_tensor(retain).to(self.scalar_type());
mask = dropout_gen_mask(self, prob);
}
// When tasks on multiple streams read and write the same block of memory,
// recordStream needs to be called to ensure the correctness of memory reuse.
c10::npu::NPUCachingAllocator::recordStream(prob.storage().data_ptr(), original_stream);
c10::npu::NPUCachingAllocator::recordStream(mask.storage().data_ptr(), original_stream);
dropout_do_mask(result, self, mask, prob);
@@ -109,7 +107,7 @@ std::tuple<Tensor, Tensor> _dropout_npu_inplace(
return dropout_v1_npu_impl(self, self, p);
}
Tensor dropout_npu(const Tensor& self, double p, bool train) {
Tensor dropout_npu(const Tensor& self, double p, bool train) {
if (p == 0 || !train || self.numel() == 0) {
return self;
}
@@ -44,7 +44,7 @@ Tensor dropout_v2_backward_npu(const Tensor& grad_output, const Tensor& mask, do
mask.scalar_type() == ScalarType::Float ||
mask.scalar_type() == ScalarType::Char ||
mask.scalar_type() == ScalarType::Byte,
"mask's dtype should be float32, float16, or int8 and uint8" );
"mask's dtype should be float32, float16, or int8 and uint8" );
TORCH_CHECK(grad_output.sizes() == mask.sizes(),
"grad_output must be the same shape with mask");
@@ -0,0 +1,58 @@
// Copyright (c) 2021 Huawei Technologies Co., Ltd
// Copyright (c) 2019, Facebook CORPORATION.
// All rights reserved.
//
// Licensed under the BSD 3-Clause License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/BSD-3-Clause
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ATen/native/npu/utils/OpAdapter.h"
namespace at {
namespace native {
using namespace at::native::npu;
Tensor _embedding_bag_backward_npu(
const Tensor& grad,
const Tensor& indices,
const Tensor& offsets,
const Tensor& offset2bag,
const Tensor& bag_size,
const Tensor& maximum_indices,
int64_t num_weights,
bool scale_grad_by_freq,
int64_t mode,
bool sparse,
const Tensor& per_sample_weights) {
Tensor grad_cpu = grad.to("cpu");
Tensor indices_cpu = indices.to("cpu");
Tensor offsets_cpu = offsets.to("cpu");
Tensor offset2bag_cpu = offset2bag.to("cpu");
Tensor bag_size_cpu = bag_size.to("cpu");
Tensor maximum_indices_cpu = maximum_indices.to("cpu");
Tensor per_sample_weights_cpu = per_sample_weights;
if (per_sample_weights_cpu.defined()) {
Tensor per_sample_weights_cpu = per_sample_weights_cpu.to("cpu");
}
Tensor result = at::_embedding_bag_backward(
grad_cpu, indices_cpu, offsets_cpu, offset2bag_cpu, bag_size_cpu,
maximum_indices_cpu, num_weights, scale_grad_by_freq, mode, sparse, per_sample_weights_cpu);
result = at::native::sparse_to_dense(result);
result = result.to(indices.device());
return result;
}
} // namespace native
} // namespace at
@@ -57,39 +57,22 @@ tuple<Tensor, Tensor, Tensor, Tensor> _embedding_bag_npu(
bool sparse,
const Tensor& per_sample_weights,
bool include_last_offset) {
auto outputSize = _embedding_bag_npu_output_size(weight, indices, offsets);
Tensor output = OpPreparation::ApplyTensorWithFormat(outputSize, weight.options(), ACL_FORMAT_ND);
Tensor indicesCopy = indices;
if (!(indices.dtype() == at::kInt)) {
indicesCopy = indicesCopy.to(at::kInt);
Tensor weight_cpu = weight.to("cpu").requires_grad_();
Tensor indices_cpu = indices.to("cpu");
Tensor offsets_cpu = offsets.to("cpu");
Tensor per_sample_weights_cpu = per_sample_weights;
if (per_sample_weights_cpu.defined()) {
Tensor per_sample_weights_cpu = per_sample_weights_cpu.to("cpu");
}
string modeStr = get_mode_str(mode);
OpCommand cmd;
cmd.Name("EmbeddingBag")
.Input(weight)
.Input(indicesCopy);
if (offsets.defined()) {
Tensor offsetsCopy = offsets;
if (!(offsets.dtype() == at::kInt)) {
offsetsCopy = offsetsCopy.to(at::kInt);
}
cmd.Input(offsetsCopy);
}
if (per_sample_weights.defined()) {
cmd.Input(per_sample_weights);
}
cmd.Output(output)
.Attr("mode", modeStr)
.Attr("scale_grad_by_freq", scale_grad_by_freq)
.Attr("sparse", sparse)
.Attr("include_last_offset", include_last_offset)
.Run();
return std::tie(output, output, output, output);
auto result = _embedding_bag_cpu(weight_cpu, indices_cpu, offsets_cpu, scale_grad_by_freq, mode, sparse, per_sample_weights_cpu, include_last_offset);
Tensor output = std::get<0>(result).to(weight.device());
Tensor offset2bag = std::get<1>(result).to(weight.device());
Tensor bag_size = std::get<2>(result).to(weight.device());
Tensor max_indices = std::get<3>(result).to(weight.device());
return std::tie(output, offset2bag, bag_size, max_indices);
}
} // namespace native
@@ -72,7 +72,7 @@ Tensor& embedding_renorm_out_npu(
double max_norm,
double norm_type){
//get the outSize of GatherV2 , the middle tensor
// get the outSize of GatherV2 , the middle tensor
SmallVector<int64_t, SIZE> midSize = {indices.size(0), self.size(1)};
Tensor mid_input = OpPreparation::ApplyTensor(self, midSize);
Tensor mid_output = OpPreparation::ApplyTensor(self, midSize);
@@ -80,10 +80,10 @@ Tensor& embedding_renorm_out_npu(
// execute the NPU operate GatherV2D, generate new tensor by indices
embedding_renorm_gather2d_out_npu(mid_input,self,indices);
//execute the NPU operate Renorm
// execute the NPU operate Renorm
embedding_renorm_execute_out_npu(mid_output, mid_input, max_norm, norm_type);
//execute the NPU operate ZerosLike or RangeD, generate new tensor by indices.numel()
// execute the NPU operate ZerosLike or RangeD, generate new tensor by indices.numel()
Tensor mid_output_copy = mid_output.clone();
auto num_indices = indices.numel();
Tensor input_indices;
@@ -95,7 +95,7 @@ Tensor& embedding_renorm_out_npu(
input_indices = at::range(0, num_indices-1, self.options()).to(at::kLong);
}
//execute the NPU operate MUL, generate change result
// execute the NPU operate MUL, generate change result
auto num_mid_output = mid_output.numel();
resize_npu_(mid_output_copy, num_mid_output);
Tensor scalar_out = OpPreparation::ApplyTensor(self, {num_indices, 1});
@@ -114,13 +114,13 @@ Tensor& embedding_renorm_npu_(
double max_norm,
double norm_type) {
//check dim and type
// check dim and type
auto self_arg = TensorArg(self, "self", 1);
auto indices_arg = TensorArg(indices, "indices", 2);
checkDim("embedding_renorm_", self_arg, 2);
checkScalarType("embedding_renorm_", indices_arg, kLong);
//resize indices to 1D
// resize indices to 1D
Tensor indices_copy = indices.clone();
auto num_indices = indices.numel();
resize_npu_(indices_copy, num_indices);

Some files were not shown because too many files have changed in this diff Show More