Compare commits

...
140 Commits
Author SHA1 Message Date
yinzijun 4146762193 !68 update docs/zh/RELEASENOTE/RELEASENOTE.md.
Merge pull request !68 from liuquan/N/A
2021-10-09 08:42:49 +00:00
刘全 c24a2a26f2 update docs/zh/RELEASENOTE/RELEASENOTE.md. 2021-10-09 07:10:10 +00:00
yinzijun 99baa47bac !66 add releasenote
Merge pull request !66 from yinzijun/2.0.3.tr5
2021-10-09 07:03:02 +00:00
ZijunYin 3aad7226de add RELEASENOTE.md 2021-10-09 09:54:56 +08:00
weili10 2c1766a041 update README.zh.md. 2021-10-08 02:46:19 +00:00
yinzijun 58402d67d2 !64 update docs 2.0.3.B090
Merge pull request !64 from yinzijun/2.0.3.tr5
2021-09-30 07:26:33 +00:00
ZijunYin 22a5bf8eba update docs 2.0.3.B090 2021-09-30 15:14:19 +08:00
AtlasAccount 7ec3a5a42a 同步1.5.0 2c2f79aaccfa455fb24553f77cca62d838b75bdf
!2559 【BugFix】修复输入shape不一致,算子侧未broadcast,导致不支持
    Merge pull request !2559 from 姚斌/2.0.3.tr5
--
    !2558 modify:del test_cases of 1 dim and NZ format in UT files
    Merge pull request !2558 from 郭夏/2.0.3.tr5
--
    !2556 修复IOU输出数据类型转换
    Merge pull request !2556 from 李攀/2.0.3.tr5
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-28 22:05:02 +08:00
AtlasAccount 8611e0e3d5 同步1.5.0 a3c3eef54ba99da98fcfb1f47315ab0aaecb6f54
!2553 修复load模式时conv2d反向dump结果ir_name被覆盖的问题,合入商发
    Merge pull request !2553 from gaokai21/2.0.3.tr5
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-27 21:00:32 +08:00
AtlasAccount a2ed4eb074 同步1.5.0 55e1c5be4b9ce8cf007fdf7848d3e933c7dba800
!2548 [contrib/npu/optimized_lib/] merge master to 2.0.3.tr5
    Merge pull request !2548 from 王姜奔/2.0.3.tr5
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-27 14:33:37 +08:00
AtlasAccount c6d5d99656 同步1.5.0 210593a373ef600735b60946c7edeccefa97e5eb
!2546 修复maxunpool2dbackward执行报错
    Merge pull request !2546 from 李攀/bugfix
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
2021-09-27 11:01:57 +08:00
AtlasAccount c927f4d52e 同步1.5.0 f0be9e9f84b731b59baf432510a25b601e2ba1b3
!2538 修改norm精度问题
    Merge pull request !2538 from 李攀/bugfix
--
    !2534 添加gpu和npu映射接口
    Merge pull request !2534 from gaokai21/master
--
    !2541 【bugfix】修复输入维度不一致时,算子不支持场景
    Merge pull request !2541 from 陈庆/lshift
同步1.8.1 7afd57f35ebc3b81dd4c3f642e3f8ba81c1f07f0
    !2542 build.sh二次编译问题
    Merge pull request !2542 from 周司南/pytorch1.8.1
2021-09-26 18:06:10 +08:00
AtlasAccount a52a2a7582 同步1.5.0 b8c5f967d3793315893507c8bb0e8ef9d5f8ad5b
!2540 修改batchnormstats接口精度(静态)
    Merge pull request !2540 from 吴贤坤/bnstats
--
    !2535 [cube] bmmv2 delete expand
    Merge pull request !2535 from 丁世浩/master
同步1.8.1 bcb12248e9ba9e72b6852c05b06c80b7ca395169
2021-09-26 12:01:03 +08:00
AtlasAccount 28b81ba784 同步1.5.0 c22928e1702155adb6f17d45277269f90f0b6e43
!2533 Ptiou整改
    Merge pull request !2533 from 李攀/bugfix
同步1.8.1 bcb12248e9ba9e72b6852c05b06c80b7ca395169
2021-09-25 12:00:46 +08:00
AtlasAccount 118cead9db 同步1.5.0 67d1906d95b9ff3658f65b5e955b983950045425
!2531 PT整改scatterAdd
    Merge pull request !2531 from 李攀/bugfix
同步1.8.1 bcb12248e9ba9e72b6852c05b06c80b7ca395169
2021-09-24 12:00:46 +08:00
AtlasAccount 37983612eb 同步1.5.0 4951d13206bcd73597b7449b40ca7cf6cb846840
!2526 mm、bmm支持对齐shape的nd适配开关
    Merge pull request !2526 from 詹隽/mm_nd_dev
--
    !2484 [dump utils] support NPU dump and gpu load
    Merge pull request !2484 from lijing/master
--
    !2523 清理冗余代码
    Merge pull request !2523 from weili10/master
--
    !2518 修改 codex 问题
    Merge pull request !2518 from 周司南/master
同步1.8.1 bcb12248e9ba9e72b6852c05b06c80b7ca395169
    !2519 编译问题已修复,脚本还原
    Merge pull request !2519 from shibo/update_build
2021-09-23 12:01:05 +08:00
AtlasAccount a0d5f0413a 同步1.5.0 860b52e16d12312680f057183820b849682f701f
!2521 【问题清理】pad3问题修改
    Merge pull request !2521 from 吴贤坤/bugclear
--
    !2528 修复BatchNormElemt精度问题
    Merge pull request !2528 from 李攀/bugfix
--
    !2516 PT整改-UpsampleBilinear2D
    Merge pull request !2516 from 李攀/bugfix
同步1.8.1 0eab0ff8a6b96eb6053b87d428c18cdc0556ec8e
2021-09-22 12:00:46 +08:00
AtlasAccount 3f7654bb90 同步1.5.0 a515d5fc8cf79e7f998e72f7f358476a6f071d5b
同步1.8.1 0eab0ff8a6b96eb6053b87d428c18cdc0556ec8e
2021-09-21 12:00:58 +08:00
AtlasAccount 6f3c3f8c93 同步1.5.0 a515d5fc8cf79e7f998e72f7f358476a6f071d5b
同步1.8.1 0eab0ff8a6b96eb6053b87d428c18cdc0556ec8e
2021-09-20 12:01:04 +08:00
yinzijun 663e48a628 !62 update docs API支持清单
Merge pull request !62 from yinzijun/master
2021-09-19 13:53:30 +00:00
AtlasAccount 4c0b1766ab 同步1.5.0 a515d5fc8cf79e7f998e72f7f358476a6f071d5b
同步1.8.1 0eab0ff8a6b96eb6053b87d428c18cdc0556ec8e
2021-09-19 12:00:45 +08:00
ZijunYin 69547a0826 update docs/zh/PyTorch API支持清单/PyTorch API支持清单.md 2021-09-19 11:05:41 +08:00
ZijunYin 5b9b7041b2 update docs/zh/PyTorch API支持清单/PyTorch API支持清单.md 2021-09-19 11:02:34 +08:00
AtlasAccount bc0fbdcac9 同步1.5.0 a515d5fc8cf79e7f998e72f7f358476a6f071d5b
!2520 删除OpcommandBase的拷贝和赋值构造函数,不应出现UpSample**算子适配中的这种用法
    Merge pull request !2520 from 宇世康/master
--
    !2515 Bugfix: fix codemars warnings and add path check
    Merge pull request !2515 from 赵光灿/master
同步1.8.1 0eab0ff8a6b96eb6053b87d428c18cdc0556ec8e
    !2513 适配"elu, hardsigmoid, nllloss2d, multilabel_margin_loss"
Merge: d767dccb7 bbfa373d9
    !2517 1.8适配“softshrink, softplus, adaptiveavgpool3d, adaptivemaxpool2d”
    Merge pull request !2517 from 李攀/do_1.8.1_3
2021-09-18 12:03:11 +08:00
i-robot ea561b97c9 !57 Add py38 package building method
Merge pull request !57 from 李超/master
2021-09-17 05:50:33 +00:00
AtlasAccount f431153967 同步1.5.0 888d06f1b261e49f6329a2a72358792bab258c94
同步1.8.1 d767dccb71ea1043a0fbe0d7a814f6bde2232923
2021-09-17 12:01:01 +08:00
AtlasAccount e82066018d 同步1.5.0 888d06f1b261e49f6329a2a72358792bab258c94
!2510 路径检查
    Merge pull request !2510 from shibo/path_check
同步1.8.1 d767dccb71ea1043a0fbe0d7a814f6bde2232923
    !2512 bugfix 编译错误
    Merge pull request !2512 from 周司南/pytorch1.8.1
--
    !2508 pytorch 1.5.0 同步 1.8.1
    Merge pull request !2508 from 周司南/pytorch1.8.1
--
    !2511 1.8"hardtanh, leakyrelu, logsigmoid"
    Merge pull request !2511 from 李攀/do_1.8.1_3
--
    !2494 diag 1.8.1适配
    Merge pull request !2494 from 王晓/1.8_diag
2021-09-17 09:25:03 +08:00
yinzijun a4fdc51ac9 !61 2.0.3.B060版本资料更新
Merge pull request !61 from yinzijun/master
2021-09-16 12:09:19 +00:00
ZijunYin 42badebbad 2.0.3.B060资料转测 2021-09-16 19:48:58 +08:00
yinzijun 9d43973a43 !60 update docs with all-in-one
Merge pull request !60 from yinzijun/master
2021-09-16 08:11:50 +00:00
ZijunYin 9d4224f9a5 update all-in-one docs/zh/PyTorch安装指南/PyTorch安装指南.md 2021-09-16 15:54:01 +08:00
AtlasAccount c2a7dc3f17 同步1.5.0 faf66d48f5856b0b9c16a07aec78f76bee01e675
!2487 泛化:norm算子适配修改
    Merge pull request !2487 from 姚斌/master
--
    !2509 performance optimization
    Merge pull request !2509 from 蒋荣强/optimize1
--
    !2507 【Adapter Task】batch_norm_backward_reduce 适配
    Merge pull request !2507 from 吴贤坤/bn_bw_rd
同步1.8.1 09f155356e3f4323d88c7181e8b2915ba04e6033
    !2462 1.8版本:更新readme文件
    Merge pull request !2462 from shibo/add_readme_181
2021-09-16 12:01:54 +08:00
i-robot be21b4c339 !58 docs更新:增加编译选项说明
Merge pull request !58 from shibo/update_idp
2021-09-15 08:32:30 +00:00
i-robot 851cc9e42e !56 更新readme
Merge pull request !56 from shibo/read_me
2021-09-15 08:30:35 +00:00
AtlasAccount 6963a9c6f5 同步1.5.0 0fc7ffde0cfcfb82e1bee4ab124136433a54dee0
!2502 [fixbug]  Fill, avgpool2d修复
    Merge pull request !2502 from 吴贤坤/fixbug
--
    !2500 batchnormelemt添加参数检查
    Merge pull request !2500 from 李攀/bugfix
同步1.8.1 fd81d36aac30c9ea0c1cb91f1e36c146d549711e
2021-09-15 12:00:49 +08:00
shibo19 f38ae2d871 add compile option note 2021-09-14 20:24:09 +08:00
AtlasAccount cc3ebabbca 同步1.5.0 6ce19779227f5b627f6aa39eb5c8db32d3fd91ea
!2501 修复ndexing不支持动态shape问题
    Merge pull request !2501 from 李攀/bugfix_2
--
    !2485 path路径强校验
    Merge pull request !2485 from 周司南/master
同步1.8.1 fd81d36aac30c9ea0c1cb91f1e36c146d549711e
    !2499 移除CPU上NPU的依赖, 支持USE_NPU=0编译
    Merge pull request !2499 from 周司南/pytorch1.8.1
2021-09-14 12:00:45 +08:00
AtlasAccount d70ae50d78 同步1.5.0 aff14c6dd491ed6b2ddebb15c64a366bfb231188
同步1.8.1 135d70c6d0d16b381e35a39747659e7f3d6cda96
2021-09-13 12:00:45 +08:00
李超 f99298b02b Add py38 package building method 2021-09-13 10:54:06 +08:00
AtlasAccount 8d64c91316 同步1.5.0 aff14c6dd491ed6b2ddebb15c64a366bfb231188
!2489 修复双向lstm参数传入数量不对问题
    Merge pull request !2489 from zhusiyi/master
同步1.8.1 135d70c6d0d16b381e35a39747659e7f3d6cda96
2021-09-12 12:00:54 +08:00
AtlasAccount a40e37d953 同步1.5.0 0cfee0d7ea81c78b852cadfadf8e64021b167307
同步1.8.1 135d70c6d0d16b381e35a39747659e7f3d6cda96
2021-09-11 12:00:46 +08:00
AtlasAccount 5996fed7b1 同步1.5.0 0cfee0d7ea81c78b852cadfadf8e64021b167307
同步1.8.1 135d70c6d0d16b381e35a39747659e7f3d6cda96
    !2498 fixBug conv2d_out_npu
    Merge pull request !2498 from 周司南/pytorch1.8.1
2021-09-10 15:50:07 +08:00
AtlasAccount 3be7bcf63d 同步1.5.0 0cfee0d7ea81c78b852cadfadf8e64021b167307
同步1.8.1 88795ab0435ba8144a5b419d0144698c6dc7c7b3
    !2491 【pytorch1.8算子适配】neg reciprocal sin sinh tan tanh
    Merge pull request !2491 from 姚斌/pytorch1.8.1
2021-09-10 13:56:49 +08:00
AtlasAccount 6fc30ad19f 同步1.5.0 0cfee0d7ea81c78b852cadfadf8e64021b167307
同步1.8.1 a69145e398ceaa35226f3c5d977a07f041448939
2021-09-10 12:00:48 +08:00
AtlasAccount 81a39d545f 同步1.5.0 0cfee0d7ea81c78b852cadfadf8e64021b167307
!2496 [bugfix] BinaryCrossEntroy反向适配代码修改
    Merge pull request !2496 from 吴贤坤/bugfix
同步1.8.1 a69145e398ceaa35226f3c5d977a07f041448939
2021-09-09 16:08:52 +08:00
AtlasAccount 75a9089e09 同步1.5.0 45372575e229cb5261582ebd322a30805f68ebb3
!2493 修复ndexing不支持动态shape问题
    Merge pull request !2493 from 李攀/bugfix
--
    !2492 适配batch_norm_elemt
    Merge pull request !2492 from 李攀/master
同步1.8.1 a69145e398ceaa35226f3c5d977a07f041448939
    !2474 convolution
    Merge pull request !2474 from 周司南/pytorch1.8.1
2021-09-09 12:00:45 +08:00
weili10 b256f3cfcd update README.zh.md. 2021-09-09 02:55:55 +00:00
AtlasAccount a03b990d2f 同步1.5.0 0bebd44de43cda65ac171865c966d0f050740d04
!2471 【ut修复】GE增加对tensor的shape校验,导致部分UT不过
    Merge pull request !2471 from TD_lihan/utMod
--
    !2476 【FixBug】修复prod精度问题
    Merge pull request !2476 from 王晓/prod
同步1.8.1 493306e5d89167be4d0e81258af2cbddafc07364
2021-09-08 12:01:03 +08:00
shibo19 b1de459aab update readme 2021-09-07 20:16:00 +08:00
i-robot 78bb23dcfc !55 更新readme文件
Merge pull request !55 from shibo/master
2021-09-07 05:54:37 +00:00
AtlasAccount 358e163e2b 同步1.5.0 a82d3d1c73af57ba35e1e468b406140f13b34b51
!2481 更新环境变量设置HCCL
    Merge pull request !2481 from shibo/add_env
--
    !2479 【适配】ReflectionPad2D支持fp32输入
    Merge pull request !2479 from 陈庆/master
同步1.8.1 493306e5d89167be4d0e81258af2cbddafc07364
    !2475 1.8版本:更新编译报错信息
    Merge pull request !2475 from shibo/update_build
2021-09-07 12:00:55 +08:00
shibo19 e3cacd1240 update read me 2021-09-06 16:34:48 +08:00
AtlasAccount 5a675a23c2 同步1.5.0 766d7155090aaefb27fff8934d644d2741922d15
!2470 Feature: add load with acl dump function
    Merge pull request !2470 from 赵光灿/master
同步1.8.1 c28fda19acb944bc0859c243c889137491da831d
2021-09-06 12:00:55 +08:00
yinzijun 62e6edd1be update docs/zh/PyTorch网络模型移植&训练指南/PyTorch网络模型移植&训练指南.md.
修改表格样式问题
2021-09-05 09:38:58 +00:00
AtlasAccount 8b0bb12ed2 同步1.5.0 488d65cf1f2832a605272d7ed32678bc9286828e
!2473 适配: roi_align&roi_align_backward算子适配重构与修改
    Merge pull request !2473 from 姚斌/master
--
    !2467 泛化:logical_not_out算子增加outshape_resize
    Merge pull request !2467 from 姚斌/master
--
    !2472 适配replicationPad2dBackward
    Merge pull request !2472 from 李攀/replication_backward
--
    !2466 【适配】ReflectionPad2D反向适配
    Merge pull request !2466 from 陈庆/padv3grad
--
    !2461 "修改适配replicationPad2d, reflectionPad2d"
    Merge pull request !2461 from 李攀/master
--
    !2459 [Requirement] batchnormstats adapter
    Merge pull request !2459 from 吴贤坤/bnstats
--
    !2463 [bugfix] span-axis indexing should execute ptcopy
    Merge pull request !2463 from 李超/master
--
    !2457 bugfix: const节点性能优化
    Merge pull request !2457 from 郭鹏/master
--
    !2464 max_unpool3d正反向添加输入校验
    Merge pull request !2464 from 王晓/max_unpool3d
--
    !2460 【迭代四需求】max_unpool3d正反向适配
    Merge pull request !2460 from 王晓/max_unpool3d
--
    !2454 泛化:inverse支持入参fp16
    Merge pull request !2454 from 姚斌/master
--
    !2446 【迭代四需求】修改constant_pad_nd反向适配,支持更多场景
    Merge pull request !2446 from 王晓/constant_pad_nd
--
    !2447 "MaxUnpool2d"适配
    Merge pull request !2447 from 李攀/master
--
    !2445 [optimize]  optimize mm adapter and refresh storage desc
    Merge pull request !2445 from 李超/master
--
    !2453 [dump utils] fix bug: creating Int blob with Long data
    Merge pull request !2453 from lijing/master
--
    !2439 [contrib/npu/optimized_lib/] add npu_bbox_coder_encode_xyxy2xywh and npu_bbox_coder_decode_xywh2xyxy
    Merge pull request !2439 from 王姜奔/bounding_box_decode
--
    !2451 Feature: support detect_anomaly when check overflow is on
    Merge pull request !2451 from 赵光灿/master
--
    !2452 【客户现场问题】softmax_backward支持动态nz场景
    Merge pull request !2452 from 王晓/softmax_backward_nz
--
    !2437  [contrib/npu/optimized_lib/] add 双向lstm
    Merge pull request !2437 from zhusiyi/master
--
    !2449 const节点创建host tensor使用memcpy优化性能
    Merge pull request !2449 from 郭鹏/master
--
    !2450 performance optimization
    Merge pull request !2450 from 蒋荣强/optimize
--
    !2448 [Optim] 优化AvgPoolv2性能
    Merge pull request !2448 from 吴贤坤/avgpoolv2
--
    !2443 cumsum性能优化
    Merge pull request !2443 from 陈庆/cumsum
--
    !2429 softmax_backward添加nz分支
    Merge pull request !2429 from 王晓/softmax_backward_nz
--
    !2442 requirement文件修改:pytorch1.5版本仅支持torchvision0.6版本
    Merge pull request !2442 from shibo/fix_readme
--
    !2427 performance optimization
    Merge pull request !2427 from 蒋荣强/optimize
--
    !2433 mm及bmm适配代码优化
    Merge pull request !2433 from 郭鹏/master
--
    !2436 [Bugfix] avgpoolv2问题修复
    Merge pull request !2436 from 吴贤坤/avgpolv2
--
    !2438 [Bugfix] con3dBackward 特殊shape问题修复
    Merge pull request !2438 from 吴贤坤/conv3dbackwardissue
--
    !2423 适配acl Prof api,支持cann profiling
    Merge pull request !2423 from 李攀/master
--
    !2428 算子适配:conv_transpose3d_backward
    Merge pull request !2428 from 姚斌/master
--
    !2432 [contrib/npu/optimized_lib/] add Mish
    Merge pull request !2432 from 王姜奔/master
--
    !2426 【适配】增加cummin aicpu算子适配,支持int64输入
    Merge pull request !2426 from 陈庆/cummin
--
    !2431 修改NPUClearFloatStatus算子适配
    Merge pull request !2431 from 詹隽/master
--
    !2430  [optimize] 支持py37和py38 torch包编译
    Merge pull request !2430 from 李超/master
--
    !2414 change TBE-OP for select contiguous opt
    Merge pull request !2414 from 王强/master
--
    !2425 泛化:logspace_out算子增加outshape_resize
    Merge pull request !2425 from 姚斌/master
--
    !2406 Feature: add overflow detection function
    Merge pull request !2406 from 赵光灿/master
--
    !2408 DDP: fix bug. when using DDP, the grad format is different from variable results in an error.
    Merge pull request !2408 from 袁舰/master
--
    !2419 LayerNorm正反向下发性能优化
    Merge pull request !2419 from 郭鹏/master
--
    !2407 [contrib/npu/optimized_lib/] add npu_fast_condition_index_put
    Merge pull request !2407 from 王姜奔/master
--
    !2422 泛化:torch.lt(xx, out=output)场景限制output_dtype为Bool
    Merge pull request !2422 from 姚斌/master
--
    !2420 【算子适配】适配shift系列算子
    Merge pull request !2420 from TD_lihan/bsd
--
    !2416 DUMP:fix bug. when cloning a tensor from gpu to cpu, the stride of the tensor still keeps invariable.
    Merge pull request !2416 from 袁舰/tmp
--
    !2421 [bugfix] 修改padv3执行时传参错误
    Merge pull request !2421 from 吴贤坤/padv2_issue
--
    !2411 泛化:topk算子增加outshape_resize场景
    Merge pull request !2411 from 姚斌/master
--
    !2415 【bugfix】修复`fill` 当dim=0 bug
    Merge pull request !2415 from 吴贤坤/fill_issue
--
    !2403 放开layernorm_backward适配层format限制
    Merge pull request !2403 from 王晓/layernorm_backward
--
    !2412 [issue] 模型场景问题修改
    Merge pull request !2412 from 吴贤坤/issue_3
--
    !2410 performance optimization
    Merge pull request !2410 from 蒋荣强/optimize
--
    !2405 泛化:argmin算子输出format为ND
    Merge pull request !2405 from 姚斌/master
--
    !2409  aoe功能使用多线程调优加速
    Merge pull request !2409 from shibo/aoe_thread
同步1.8.1 c28fda19acb944bc0859c243c889137491da831d
    !2469 1.8版本arm编译失败临时修复
    Merge pull request !2469 from shibo/update_build
--
    !2468 1.8.1移除动态shape能力
    Merge pull request !2468 from 周司南/pytorch1.8.1
--
    !2458 1.8版本:reducer中hook更新,与开源版本保持一致
    Merge pull request !2458 from shibo/ddp_181_hook
--
    !2455 add new adaper for 1.8.1
    Merge pull request !2455 from 周司南/pytorch1.8.1
--
    !2441 pytorch1.8.1: 支持DDP训练
    Merge pull request !2441 from shibo/test_181_ddp
2021-09-03 17:51:40 +08:00
weili10 08895e3452 !53 更新1.8.1:增加1.8.1的版本
Merge pull request !53 from shibo/pt1.8.1_test
2021-09-03 09:44:40 +00:00
shibo19 eb19e5be07 update sh 2021-09-03 15:42:23 +08:00
shibo19 dbbb5b935b 同步1.5.0 ce8e47ddddc42aa66b88188f25be654e3baf1739
同步1.8.1 e4cc08b6ff7a4dcf246e669f0d2d424e2742a7cc
2021-09-02 20:06:56 +08:00
shibo19 27b2513f2f 同步1.5.0 ce8e47ddddc42aa66b88188f25be654e3baf1739 同步1.8.1 e4cc08b6ff7a4 2021-09-02 20:05:45 +08:00
shibo19 18cee26cfb update UT control 2021-09-02 19:47:40 +08:00
shibo19 d9c203af66 rename 2021-09-02 19:26:29 +08:00
shibo19 a96f349728 同步1.5.0 ce8e47ddddc42aa66b88188f25be654e3baf1739 同步1.8.1 e4cc08b6ff7a4dcf246e669f0d2d424e2742a7cc 2021-09-02 16:58:09 +08:00
weili10 08d67bb93b 删除文件 pt_sync.log 2021-09-02 06:41:21 +00:00
AtlasAccount 9d1f8c2062 同步 86fcbb8e91b16e2437c36fc6ca3a8d224e95bfb9
泛化:logical_not_out算子增加outshape_resize
2021-09-02 12:00:33 +08:00
yinzijun e56d176f63 !50 2.0.3.B050资料转测
Merge pull request !50 from yinzijun/master
2021-09-02 02:02:26 +00:00
AtlasAccount 46d2c88c76 同步 c023657b36fc647854d45a12b9833e2409cbf6e7
适配replicationPad2dBackward
 【适配】ReflectionPad2D反向适配
 "修改适配replicationPad2d, reflectionPad2d"
 [Requirement] batchnormstats adapter
2021-09-01 23:00:36 +08:00
ZijunYin 16c6efb99c 2.0.3.B050资料刷新 2021-09-01 17:27:12 +08:00
AtlasAccount 3deb4f4041 同步 16fcae50a1131194038eec02a1fccd28387424e5
[bugfix] span-axis indexing should execute ptcopy
 bugfix: const节点性能优化
 max_unpool3d正反向添加输入校验
 【迭代四需求】max_unpool3d正反向适配
2021-08-31 23:00:36 +08:00
AtlasAccount 63f22cf38d 同步 9ba6d751ab1207d32114588c43d1d366d9581783
泛化:inverse支持入参fp16
 【迭代四需求】修改constant_pad_nd反向适配,支持更多场景
 "MaxUnpool2d"适配
2021-08-30 23:00:35 +08:00
AtlasAccount 95bc96954a 同步 9fb28f8d7e69fa020ebe4b5bb91727b80c8b676b
[optimize] optimize mm adapter and refresh storage desc
2021-08-28 23:00:41 +08:00
AtlasAccount a323bfb26d 同步 51620ab6aa9631e02aff3c893c4a98b3441be1d7
[dump utils] fix bug: creating Int blob with Long data
 [contrib/npu/optimized_lib/] add npu_bbox_coder_encode_xyxy2xywh and npu_bbox_coder_decode_xywh2xyxy
 Feature: support detect_anomaly when check overflow is on
2021-08-28 12:00:36 +08:00
AtlasAccount 4c28fae7ff 同步 a50381c14de1fe552161254749e980f6993d4074
【客户现场问题】softmax_backward支持动态nz场景
 [contrib/npu/optimized_lib/] add 双向lstm
2021-08-27 23:00:33 +08:00
AtlasAccount d73f7d15d1 同步 84bf1f2f6e1e5bcd2515f4504587527371b56413
const节点创建host tensor使用memcpy优化性能
2021-08-27 12:00:37 +08:00
AtlasAccount 64142762fb 同步 57eb858d9a5188f7ccbd3fa2ef99d4467589a086
performance optimization
2021-08-26 23:00:34 +08:00
yinzijun 2671012415 !47 2.0.3.B030版本资料更新
Merge pull request !47 from yinzijun/master
2021-08-26 04:25:21 +00:00
ZijunYin 9cb88c4ae8 add img pth 2021-08-26 11:41:58 +08:00
ZijunYin 3015977115 delete img pth 2021-08-26 11:40:56 +08:00
ZijunYin 25e1415cb4 renew . 2021-08-26 11:31:36 +08:00
AtlasAccount 9276d4c441 同步 15422a9ff9ee2bb3c906de5f068297fe98c61cee
[Optim] 优化AvgPoolv2性能
2021-08-25 23:00:37 +08:00
yinzijun 3ab4642abd Remove docs/en 2021-08-25 09:32:18 +00:00
AtlasAccount aa1466742a 同步 02aa66378171f6b55cbe50ae3a6067de937af8d0
cumsum性能优化
 softmax_backward添加nz分支
 requirement文件修改:pytorch1.5版本仅支持torchvision0.6版本
2021-08-24 23:00:37 +08:00
AtlasAccount 9bfd72d468 同步 ead0163f4e42079e08e018f89b7d4b1caa7a5b27
performance optimization
 mm及bmm适配代码优化
2021-08-24 12:00:41 +08:00
AtlasAccount 0fa13028d3 同步 8468e3b692abe1e24a2576c1c3db71e76105fd3b
[Bugfix] avgpoolv2问题修复
 [Bugfix] con3dBackward 特殊shape问题修复
 适配acl Prof api,支持cann profiling
2021-08-23 23:00:37 +08:00
AtlasAccount 358cba8b6d 同步 a479199b1693507a24d1df875f6844a2665d9306
算子适配:conv_transpose3d_backward
 [contrib/npu/optimized_lib/] add Mish
 【适配】增加cummin aicpu算子适配,支持int64输入
 修改NPUClearFloatStatus算子适配
2021-08-23 12:00:32 +08:00
AtlasAccount c684b7c74a 同步 c6cc6fae2f5bb369d7b166fa1900f6e75723cad8
[optimize] 支持py37和py38 torch包编译
2021-08-21 23:00:38 +08:00
AtlasAccount d836a9cb3c 同步 b6418a68885f2731c65d5d860d37b0ab866367c5
change TBE-OP for select contiguous opt
2021-08-20 23:00:34 +08:00
AtlasAccount 369ebefd2e 同步 f50f0921fd20ee29f1d82784ec88c1be6ef18820
泛化:logspace_out算子增加outshape_resize
 Feature: add overflow detection function
2021-08-19 23:00:34 +08:00
AtlasAccount e1b754a902 同步 a7b60a03303b40169cbab3829fcc57f2ce72faf2
DDP: fix bug. when using DDP, the grad format is different from variable results in an error.
 LayerNorm正反向下发性能优化
2021-08-18 12:00:40 +08:00
AtlasAccount c6ad5c5cc5 同步 082c70d8d31797c00fb0e00cfb0a84c1cc11651d
[contrib/npu/optimized_lib/] add npu_fast_condition_index_put
 泛化:torch.lt(xx, out=output)场景限制output_dtype为Bool
 【算子适配】适配shift系列算子
 DUMP:fix bug. when cloning a tensor from gpu to cpu, the stride of the tensor still keeps invariable.
 [bugfix] 修改padv3执行时传参错误
 泛化:topk算子增加outshape_resize场景
2021-08-17 23:00:33 +08:00
AtlasAccount 54af470c20 同步 3d1cd19f02b15fb9699e73594416f28187a96990
【bugfix】修复`fill` 当dim=0 bug
 放开layernorm_backward适配层format限制
 [issue] 模型场景问题修改
 performance optimization
2021-08-16 23:00:32 +08:00
AtlasAccount c56e5299d5 同步 77355b7650e725d5db500750c0215000598f3e29
泛化:argmin算子输出format为ND
2021-08-16 12:00:34 +08:00
AtlasAccount edfe8b0306 同步 7485a1162efb716e0ab3b6c214098246f62f4fd5
aoe功能使用多线程调优加速
2021-08-14 23:00:33 +08:00
AtlasAccount 0143c1c06e 同步 ce8e47ddddc42aa66b88188f25be654e3baf1739
新增适配reflection_pad2d
 DDP: fix bug of set broadcast_buffers true
 泛化:index_select_out算子增加outshape_resize
 [contrib/npu/optimized_lib/] add npu_yolo_bbox_coder
 【PT整改】PTTriu算子整改
 【算子适配】cummax算子适配
 泛化:stack输出format修改为ND
 开源申明修改
 [bugfix] 修复scatter操作报错当dtype为int32
 Feature: add some debug logs for accuracy comparison
 算子cumsum 在dim=0时走aicpu分支
 算子适配整改:masked_select重构、增加outshape_resize
 算子适配:slow_conv3d、slow_conv3d_forward
 搬运:修改env中拼写错误
2021-08-13 18:32:50 +08:00
weili10 fe09035482 update OWNERS. 2021-08-10 09:00:24 +00:00
yinzijun e8f0e0055c Create en 2021-08-10 03:17:53 +00:00
weili10 255e1b94f6 update scripts/mkdirs.sh. 2021-08-09 07:57:30 +00:00
weili10 b184e1c1d3 update scripts/gen.sh. 2021-08-09 07:57:18 +00:00
weili10 a85cb62301 update LICENSE. 2021-08-09 07:55:30 +00:00
weili10 1500208c7f update LICENSE. 2021-08-09 07:55:03 +00:00
weili10 073ad70cc4 update LICENSE. 2021-08-09 07:54:46 +00:00
weili10 6741696481 调整安装python依赖库位置 2021-08-09 03:23:45 +00:00
i-robot 48dd2489e0 !39 在README中增加版本配套信息
Merge pull request !39 from yinzijun/master
2021-08-06 09:09:23 +00:00
AtlasAccount 7e0b4081ac 同步 43d1f773fd5478ce787360f3c9ced77ae075fbee
修复triangular_solve out报错
 [contrib/npu/optimized_lib/] add npu_single_level_responsible_flags
2021-08-06 16:45:30 +08:00
i-robot 88d5c2c545 !38 env.sh拼写错误
Merge pull request !38 from luweizheng/master
2021-08-05 09:55:22 +00:00
ZijunYin c39847cbba 在README中增加版本配套关系 2021-08-05 17:52:16 +08:00
Lu Weizheng 8fa79690b2 fix env.sh ASCEND typo 2021-08-04 09:46:25 +08:00
AtlasAccount b6464ff2b2 同步 99861473ecf33d695ac1b85a43b5e71b3ac6b6d0
修改deformable_conv2d ut
 scatter算子修改适配到ScatterElements
2021-08-03 21:45:37 +08:00
i-robot a12b0dd319 !37 同步 fb8fc52370bce643091b8572fae8fd151d233bde
Merge pull request !37 from weili10/master
2021-08-03 08:37:20 +00:00
i-robot b9c513ed2d !35 更新算子文档
Merge pull request !35 from yinzijun/master
2021-08-03 08:35:22 +00:00
weili10 e7218aaf60 同步 fb8fc52370bce643091b8572fae8fd151d233bde
[Issue] 模型问题修复
 [contrib/npu/optimized_lib/] add DCNv2
 [bugfix] 规避aicpu fp16不支持场景
 修改pytorch版本到post3
 dump: fix bug of uncontiguous
 “回退scatter_add,性能不达标”
2021-08-03 16:07:57 +08:00
weili10 5de5ce6d04 update OWNERS. 2021-07-31 08:00:23 +00:00
ZijunYin 62992d4000 更新算子开发指南和适配算子清单 2021-07-31 10:25:57 +08:00
weili10 34f84c6ca4 !34 同步 b55753edf56f77307aa77d9034d581430892dff8
Merge pull request !34 from weili10/master
2021-07-29 12:33:33 +00:00
weili10 4ebeb1fd6a 同步 b55753edf56f77307aa77d9034d581430892dff8
【泛化】NllLoss2d & NllLoss2dBackward only support Target Int32/Long
 放开dropout适配层format限制
 PT整改,回退“PTTriu”
 增加算子编译选项:使用高精度/高性能模式算子
 【泛化】torch.lt( )计算支持bool类型入参
 _svd_helper算子适配
2021-07-29 20:15:47 +08:00
i-robot c4c5da1ed0 !26 文档修改命名格式归档
Merge pull request !26 from yinzijun/master
2021-07-29 09:17:03 +00:00
张昱杰 4ad96e17f4 update scripts/mkdirs.sh. 2021-07-29 09:13:17 +00:00
ZijunYin f6bd4ea357 change name of releasenote 2021-07-29 16:46:11 +08:00
i-robot 6c52cd2a5d !29 增加开源软件使用说明
Merge pull request !29 from weili10/master
2021-07-29 01:15:03 +00:00
weili10 11ee398a57 增加开源软件使用说明 2021-07-28 21:59:09 +08:00
ZijunYin c4c9340104 update docs, add releasenote 2021-07-28 20:55:49 +08:00
ZijunYin 931f3c3878 add docs with new name and icon 2021-07-27 16:50:44 +08:00
ZijunYin a48b4fd558 update doc with new file name and icon 2021-07-27 16:42:59 +08:00
i-robot d44bc70aae !25 同步 2e109bb3201b0dab4d8445c7c431c2edf5868ccc
Merge pull request !25 from weili10/master
2021-07-26 13:55:24 +00:00
weili10 021efdf1da 同步 2e109bb3201b0dab4d8445c7c431c2edf5868ccc
【Task】Erfc适配
 算子适配:conv_transpose3d
 _triangular_solve_helper算子适配
 API兼容性整改:编译接口AclopSetCompileFlag
2021-07-26 21:32:26 +08:00
i-robot 1d607dcf4f !24 同步 99ba430b04031e42d0284436f13584a845d82b53
Merge pull request !24 from weili10/master
2021-07-23 10:54:34 +00:00
weili10 b2afdd7871 同步 99ba430b04031e42d0284436f13584a845d82b53
Symeig算子适配
 rrelu_with_noise适配
2021-07-23 18:20:45 +08:00
i-robot 37fc10168a !23 同步 8ec7266c6bdd8119c253919567c2870a3f5aae0c
Merge pull request !23 from weili10/master
2021-07-22 12:40:49 +00:00
weili10 6432bc6349 同步 8ec7266c6bdd8119c253919567c2870a3f5aae0c
泛化:smooth_l1_loss算子支持 0 Shape输入
 【算子适配】tril_indices/triu_indices算子适配
2021-07-22 20:24:36 +08:00
weili10 4160ab8ab6 !22 同步 384a3c920d51a9e7538b7f99737d8acd0f8bd63e
Merge pull request !22 from weili10/master
2021-07-22 01:14:11 +00:00
weili10 afaa4d4e88 同步 384a3c920d51a9e7538b7f99737d8acd0f8bd63e
PT整改
 泛化:torch.max(input, dim, keppdim)支持input为DT_BOOL或DT_INT32入参
 modify the method of query event status
2021-07-21 17:15:46 +08:00
weili10 91014cd3b8 !21 同步 7ea28538822d890b75b190fbd8a1e1f984e4e9e2
Merge pull request !21 from weili10/master
2021-07-20 11:42:49 +00:00
weili10 798f0c3b16 同步7ea28538822d890b75b190fbd8a1e1f984e4e9e2 2021-07-20 19:11:41 +08:00
weili10 c28c47c9cd update LICENSE. 2021-07-16 13:42:44 +00:00
weili10 bda914c574 !17 同步b98f7ec21ee0d6c14be8b0bd09301d9f6e686816
Merge pull request !17 from weili10/master
2021-07-16 13:42:01 +00:00
weili10 edb5c70443 同步b98f7ec21ee0d6c14be8b0bd09301d9f6e686816 2021-07-16 18:19:48 +08:00
weili10 4689a0514b !13 [Task]新版本文档归档
Merge pull request !13 from fenghaolin/master
2021-07-14 13:53:10 +00:00
fenghaolin 63950d1412 新版本资料归档 2021-07-14 21:27:33 +08:00
weili10 16fb2692c6 update LICENSE. 2021-07-14 05:52:06 +00:00
weili10 193cd1f80d update LICENSE. 2021-07-14 04:08:58 +00:00
weili10 6b5302218a update LICENSE. 2021-07-14 03:54:29 +00:00
2147 changed files with 201090 additions and 16555 deletions
+2 -1
View File
@@ -1,6 +1,7 @@
BSD 3-Clause License
Copyright (c) 2021, 张昱杰
Copyright (c) 2020, Huawei Technologies Co., Ltd
Copyright (c) 2019, Facebook CORPORATION.
All rights reserved.
Redistribution and use in source and binary forms, with or without
+4 -1
View File
@@ -13,4 +13,7 @@ reviewers:
- wangyu0516
- yskhhh
- lvpeiyuan
- xchu42
- xchu42
- weili10
- goodjobwubai
- fairwarning
+54 -12
View File
@@ -10,7 +10,7 @@ gcc版本: 7.3.0(只在编译场景要求)
cmake版本:3.12.0以上版本(只在编译场景要求)
python版本:3.7.x
python版本:3.7.5 和 3.8.x(编译方法有差别,详见脚本编译章节)
# 系统依赖库
@@ -24,24 +24,25 @@ yum install -y cmake zlib-devel libffi-devel openssl-devel libjpeg-turbo-devel g
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
# python依赖库
# Ascend配套软件
依赖库安装:
```python3
pip3 install -r requirements.txt
```
| AscendPyTorch版本 | CANN版本 |
| :------------ | :----------- |
| 2.0.2 | CANN 5.0.2 |
| 2.0.3 | CANN 5.0.3 |
# 使用方式 --生成全量代码并编译
## 获取原生PyTorch源代码和third_party代码
在当前仓库根目录pytorch/下获取原生PyTorch的源代码
当前支持pytorch 1.5.0和1.8.1的版本。根据需求,在当前仓库根目录pytorch/下获取原生PyTorch的源代码
```sh
// 1.5.0 版本
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
// 1.8.1 版本
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
```
进入到pytorch/pytorch/目录下, 获取PyTorch被动依赖代码(获取时间较长,请耐心等待)。
@@ -55,26 +56,47 @@ git submodule update --init --recursive
## 生成适配昇腾AI处理器的PyTorch代码。
进入到pytorch/scripts目录,执行
进入到pytorch/scripts目录,根据选择的版本执行,执行脚本(注意:下载原生Pytorch源代码和下面版本要对应,否则可能出错)
```sh
// 默认为1.5.0版本
bash gen.sh
// 对于1.8.1版本,则通过-v 参数指定
bash gen.sh -v 1.8.1
```
会在pytorch/pytorch/目录中生成npu适配全量代码
## python依赖库
进入到pytorch/pytorch/目录,依赖库安装:
```python3
pip3 install -r requirements.txt
```
## 编译torch的二进制包
进入到pytorch/pytorch/目录,执行
```sh
# python3.7版本
bash build.sh
或者
bash build.sh --python=3.7(推荐)
# python3.8版本
bash build.sh --python=3.8
```
生成的二进制包在pytorch/pytorch/dist/目录下
# 安装
### (以1.5.0版本为例,1.8.1版本同理)
**x86_64:**
torch-1.5.0+ascend-cp37-cp37m-linux_x86_64.whl (实际可能附带小版本号例如torch-1.5.0.post2+ascend-cp37-cp37m-linux_x86_64.whl)
@@ -102,7 +124,7 @@ pip3 install --upgrade torch-1.5.0+ascend-cp37-cp37m-linux_aarch64.whl
在当前仓库根目录中执行设置环境变量脚本
```
source src/env.sh
source pytorch/env.sh
```
@@ -131,7 +153,10 @@ export DYNAMIC_OP="ADD#MUL" # 算子实现,ADD和MUL算子在不同场景下
验证运行, 输出结果OK
```python
python3 test/test_npu/test_div.py
// 根据前述版本,选择对应的测试脚本,以下为1.5.0版本
python3 pytorch1.5.0/test/test_npu/test_div.py
// 以下为1.8.1版本
python3 pytorch1.8.1/test/test_npu/test_div.py
```
# 路标
@@ -158,6 +183,23 @@ python3 test/test_npu/test_div.py
热忱希望各位在用户社区加入讨论,并贡献您的建议。
# 分支维护策略
Ascend PyTorch的版本分支有以下几种维护阶段:
| **状态** | **持续时间** | **说明** |
|-------------|---------------|--------------------------------------------------|
| Planning | 1 - 3 months | 特性规划。 |
| Development | 3 months | 特性开发。 |
| Maintained | 6 - 12 months | 允许所有问题修复的合入,并发布版本。 |
| Unmaintained| 0 - 3 months | 允许所有问题修复的合入,无专人维护,不再发布版本。 |
| End Of Life (EOL) | N/A | 不再接受修改合入该分支。 |
# 现有分支维护状态
| **分支名** | **当前状态** | **上线时间** | **后续状态** | **EOL 日期**|
|------------|--------------|----------------------|----------------------------------------|------------|
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
# FAQ
+85
View File
@@ -0,0 +1,85 @@
OPEN SOURCE SOFTWARE NOTICE
Please note we provide an open source software notice along with this product and/or this product firmware (in the following just “this product”). The open source software licenses are granted by the respective right holders. And the open source licenses prevail all other license information with regard to the respective open source software contained in the product, including but not limited to End User Software Licensing Agreement. This notice is provided on behalf of Huawei Technologies Co. Ltd. and any of its local subsidiaries which may have provided this product to you in your local country.
Warranty Disclaimer
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
Copyright Notice and License Texts
Software: pytorch 1.5.0
Copyright notice:
Copyright (c) 2016-present, Facebook, Inc.
Copyright (c) Facebook, Inc. and its affiliates.
Copyright 2006, Google Inc.
Copyright (c) 2015-2016 Advanced Micro Devices, Inc. All rights reserved.
2017-2018 Advanced Micro Devices, Inc. and Facebook Inc. All rights reserved.
Copyright 2004-present Facebook. All Rights Reserved.
Copyright (c) 2018 MathInf GmbH, Thomas Viehmann
Copyright (c) 2014 Indiana University
Copyright (c) 2016, NVIDIA CORPORATION, All rights reserved
Copyright (C) 2012 Giovanni Garberoglio
Copyright 2015 Google Inc. All Rights Reserved.
Copyright (c) Facebook Inc. and Microsoft Corporation.
Copyright © 2001-2014 Python Software Foundation
All Rights Reserved
Copyright (c) 2014-2015 The Khronos Group Inc.
Copyright (c) 2006, Laurent Montel, montel@kde.org
Copyright 2013 Conrad Steenberg conrad.steenberg@gmail.com
Copyright (C) 2017 The Android Open Source Project
Copyright (c) 2010-2017 Benjamin Peterson
Copyright 2013-2014 RAD Game Tools and Valve Software
Copyright 2010-2014 Rich Geldreich and Tenacious Software LLC
Copyright (c) 2008 - 2009 NVIDIA Corporation. All rights reserved.
Copyright (c) 2007-2009 Scientific Computing and Imaging Institute, University of Utah
(c) Facebook, Inc. and its affiliates. Confidential and proprietary.
Copyright (c) 2017 by Contributors
Copyright 2016 Facebook
Copyright (C) 2018 Marat Dukhan
Copyright (c) 2017-2018 Facebook Inc.
Copyright (c) 2017 Georgia Institute of Technology
Copyright (c) 2016 Microsoft
Copyright (c) 2014, 2015, The Regents of the University of California
Copyright (c) 2014, 2015, the respective contributors
Copyright (c) 2011-2014 Idiap Research Institute (Ronan Collobert)
Copyright (c) 2011-2012 NEC Laboratories America (Koray Kavukcuoglu)
Copyright (c) 2011-2013 NYU (Clement Farabet)
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert,Leon Bottou, Iain Melvin, Jason Weston)
Copyright (c) 2006 Idiap Research Institute (Samy Bengio)
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert,Samy Bengio, Johnny Mariethoz)
Copyright (c) 2016-2017, ARM Limited and Contributors
Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
Copyright (C) 2007-2017 Free Software Foundation, Inc.
Copyright Malte Skarupke 2017.
Copyright (C) 2011 - 2012 Andrzej Krzemienski.
Copyright (C) 2001-2019 Free Software Foundation, Inc.
Copyright (c) 1994 Hewlett-Packard Company
Copyright (c) 1996-1998 Silicon Graphics Computer Systems, Inc.
Copyright Michael Park, 2015-2017
Copyright (c) 2008 - 2012 The Khronos Group Inc.
Copyright (c) 2008-2013 The Khronos Group Inc.
Copyright (c) 2008-2012 The Khronos Group Inc.
Copyright (C) 2006 The Android Open Source Project
Copyright (c) 2016- Facebook, Inc (Adam Paszke)
Copyright (c) 2014- Facebook, Inc (Soumith Chintala)
Copyright (c) 2012-2014 Deepmind Technologies (Koray Kavukcuoglu)
Copyright (c) 2011-2013 NYU (Clement Farabet)
Copyright (c) 2006-2010 NEC Laboratories America (Ronan Collobert, Leon Bottou, Iain Melvin, Jason Weston)
Copyright (c) 2001-2004 Idiap Research Institute (Ronan Collobert, Samy Bengio, Johnny Mariethoz)
Copyright (c) 2016-present, Facebook Inc. All rights reserved.
Copyright (c) 2016 Facebook Inc.
Copyright (c) 2015 Google Inc.
Copyright (c) 2015 Yangqing Jia
Copyright(c) 2013, 2014, 2015, the respective contributors
Copyright(c) 2015, 2016 the respective contributors
Copyright (c) 2014, The Regents of the University of California (Regents)
Copyright (c) 2014, the respective contributors
Copyright (c) 2008-2015 The Khronos Group Inc.
Copyright (c) 2014-2017 The Regents of the University of California (Regents)
Copyright (c) 2014-2017, the respective contributors
Copyright (c) 2017 Microsoft
Copyright (c) 2017-present, Facebook, Inc.
Copyright (c) 2018-present, Facebook, Inc.
License: BSD 3-Clause License
Please see above.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 580 B

After

Width:  |  Height:  |  Size: 580 B

Before

Width:  |  Height:  |  Size: 394 B

After

Width:  |  Height:  |  Size: 394 B

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 406 B

Before

Width:  |  Height:  |  Size: 253 B

After

Width:  |  Height:  |  Size: 253 B

@@ -1,74 +1,59 @@
# PyTorch在线推理指南
- [使用场景](#使用场景.md)
- [基本使用流程](#基本使用流程.md)
- [前提条件](#前提条件.md)
- [在线推理流程](#在线推理流程.md)
- [环境变量配置](#环境变量配置.md)
- [样例参考](#样例参考.md)
- [专题](#专题.md)
- [混合精度](#混合精度.md)
- [权重更新](#权重更新.md)
- [FAQ](#FAQ.md)
- [pip3.7 install Pillow==5.3.0安装失败](#pip3-7-install-Pillow-5-3-0安装失败.md)
- [安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md)
- [安装7.3.0版本gcc](#安装7-3-0版本gcc.md)
<h2 id="使用场景.md">使用场景</h2>
- [使用场景](#使用场景md)
- [基本使用流程](#基本使用流程md)
- [前提条件](#前提条件md)
- [在线推理流程](#在线推理流程md)
- [环境变量配置](#环境变量配置md)
- [样例参考](#样例参考md)
- [专题](#专题md)
- [混合精度](#混合精度md)
- [安装7.3.0版本gcc](#安装7-3-0版本gccmd)
<h2 id="使用场景md">使用场景</h2>
在线推理是在AI框架内执行推理的场景,例如在PyTorch框架上,加载模型后,通过model.eval\(\)执行推理。
在线推理是在AI框架内执行推理的场景,例如在PyTorch框架上,加载模型后,通过“model.eval\(\)“将模型切换为推理模式。
相比于离线推理场景,使用在线推理可以方便将原来基于PyTorch框架做推理的应用快速迁移到昇腾AI处理器,适用于数据中心推理场景。
## 支持的芯片型号<a name="section15598658104219"></a>
### 支持的芯片型号<a name="section15598658104219"></a>
昇腾910 AI处理器
昇腾710 AI处理器
<h2 id="基本使用流程.md">基本使用流程</h2>
<h2 id="基本使用流程md">基本使用流程</h2>
- **[前提条件](#前提条件.md)**
- **[前提条件](#前提条件md)**
- **[在线推理流程](#在线推理流程.md)**
- **[在线推理流程](#在线推理流程md)**
- **[环境变量配置](#环境变量配置.md)**
- **[环境变量配置](#环境变量配置md)**
- **[样例参考](#样例参考.md)**
- **[样例参考](#样例参考md)**
<h2 id="前提条件.md">前提条件</h2>
<h3 id="前提条件md">前提条件</h3>
已完成PyTorch框架及混合精度模块的安装,详情请参考《PyTorch网络模型移植&训练指南》的"环境准备"章节。
已完成PyTorch框架及混合精度模块的安装,详情请参见《PyTorch安装指南》进行PyTorch相关运行环境搭建。
<h2 id="在线推理流程.md">在线推理流程</h2>
<h3 id="在线推理流程md">在线推理流程</h3>
在线推理流程如[图1](#fig13802941161818)所示:
在线推理流程如[图1](#fig13802941161818)所示。
**图 1** 在线推理流程图<a name="fig13802941161818"></a>
![](figures/在线推理流程图.png "在线推理流程图")
<h2 id="环境变量配置.md">环境变量配置</h2>
<h3 id="环境变量配置md">环境变量配置</h3>
Pytorch在线推理进程启动所依赖的环境变量:
根据环境实际安装的软件包(toolkit或nnae),在下列场景中选择一个并运行对应的环境变量配置脚本。
PyTorch在线推理进程启动所依赖的环境变量:
```
# 场景一:昇腾设备安装部署开发套件包Ascend-cann-toolkit(此时开发环境可进行推理任务),可根据不同安装用户执行相应脚本。
# 以root用户安装toolkit包
. /usr/local/Ascend/ascend-toolkit/set_env.sh
# 以非root用户安装toolkit包
. ${HOME}/Ascend/ascend-toolkit/set_env.sh
# 场景二:昇腾设备安装部署软件包Ascend-cann-nnae,可根据不同安装用户执行相应脚本。
# 以root用户安装nnae包
. /usr/local/Ascend/nnae/set_env.sh
# 以非root用户安装nnae包
. ${HOME}/Ascend/nnae/set_env.sh
```
# 请依据实际在下列场景中选择其一,进行在线推理依赖包安装路径的环境变量设置。具体如下(以HwHiAiUser用户安装,安装路径为默认路径为例):
# 场景一:昇腾设备安装部署开发套件包Ascend-cann-toolkit(此时开发环境可进行推理任务)。
. /home/HwHiAiUser/Ascend/ascend-toolkit/set_env.sh
# 场景二:昇腾设备安装部署软件包Ascend-cann-nnae。
. /home/HwHiAiUser/Ascend/nnae/set_env.sh
其他环境变量配置。
```
# 若参见《PyTorch网络模型移植&训练指南》的"环境准备"章节进行环境搭建时安装python3.7.5,或存在多个python3版本时,需要在环境变量中配置python3.7.5的安装路径。
# 若运行环境中存在多个python3版本时,需要在环境变量中配置python3.7.5的安装路径。
export PATH=/usr/local/python3.7.5/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/python3.7.5/lib:$LD_LIBRARY_PATH
@@ -78,63 +63,65 @@ export ASCEND_DEVICE_ID=0
# 输出日志信息,可根据实际修改
export ASCEND_SLOG_PRINT_TO_STDOUT=1
export ASCEND_GLOBAL_LOG_LEVEL=0
# TASK多线程下发
export TASK_QUEUE_ENABLE=0
```
**表 1**
**表 1** 环境变量说明
<a name="table2072027194819"></a>
<table><thead align="left"><tr id="row1173527114812"><th class="cellrowborder" valign="top" width="46.75467546754676%" id="mcps1.2.4.1.1"><p id="p073027114816"><a name="p073027114816"></a><a name="p073027114816"></a>配置项</p>
<table><thead align="left"><tr id="row1173527114812"><th class="cellrowborder" valign="top" width="35.51355135513551%" id="mcps1.2.4.1.1"><p id="p073027114816"><a name="p073027114816"></a><a name="p073027114816"></a>配置项</p>
</th>
<th class="cellrowborder" valign="top" width="43.18431843184319%" id="mcps1.2.4.1.2"><p id="p157362712480"><a name="p157362712480"></a><a name="p157362712480"></a>说明</p>
<th class="cellrowborder" valign="top" width="54.42544254425443%" id="mcps1.2.4.1.2"><p id="p157362712480"><a name="p157362712480"></a><a name="p157362712480"></a>说明</p>
</th>
<th class="cellrowborder" valign="top" width="10.061006100610062%" id="mcps1.2.4.1.3"><p id="p187392714485"><a name="p187392714485"></a><a name="p187392714485"></a>必选/可选</p>
</th>
</tr>
</thead>
<tbody><tr id="row2732273481"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p57382719481"><a name="p57382719481"></a><a name="p57382719481"></a>LD_LIBRARY_PATH</p>
<tbody><tr id="row2732273481"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p57382719481"><a name="p57382719481"></a><a name="p57382719481"></a>LD_LIBRARY_PATH</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p07319271480"><a name="p07319271480"></a><a name="p07319271480"></a>动态库的查找路径,参考上述举例配置。</p>
<div class="note" id="note119943144912"><a name="note119943144912"></a><a name="note119943144912"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="p49933104915"><a name="p49933104915"></a><a name="p49933104915"></a>若系统环境升级了gcc版本(例如Centos、Debian和BClinux系统),需要配置gcc相关环境变量,详情请参见<a href="#安装7-3-0版本gcc.md#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l5e5c9395407d46439788b12f0e6342bc">5</a>。</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p07319271480"><a name="p07319271480"></a><a name="p07319271480"></a>动态库的查找路径,参考上述举例配置。</p>
<div class="note" id="note119943144912"><a name="note119943144912"></a><a name="note119943144912"></a><span class="notetitle"> 说明: </span><div class="notebody"><p id="p49933104915"><a name="p49933104915"></a><a name="p49933104915"></a>若系统环境安装了gcc7.3.0(例如CentOS7.6、Debian和BClinux系统),需要配置gcc相关环境变量,详情请参见<a href="#安装7-3-0版本gccmd#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l5e5c9395407d46439788b12f0e6342bc">5</a>。</p>
</div></div>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p187352744817"><a name="p187352744817"></a><a name="p187352744817"></a>必选</p>
</td>
</tr>
<tr id="row17342744812"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p4731227184818"><a name="p4731227184818"></a><a name="p4731227184818"></a>PATH</p>
<tr id="row17342744812"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p4731227184818"><a name="p4731227184818"></a><a name="p4731227184818"></a>PATH</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p97310276484"><a name="p97310276484"></a><a name="p97310276484"></a>可执行程序的查找路径,参考上述举例配置。</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p97310276484"><a name="p97310276484"></a><a name="p97310276484"></a>可执行程序的查找路径,参考上述举例配置。</p>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p1573142711483"><a name="p1573142711483"></a><a name="p1573142711483"></a>必选</p>
</td>
</tr>
<tr id="row95241840165613"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p15242404566"><a name="p15242404566"></a><a name="p15242404566"></a>ASCEND_DEVICE_ID</p>
<tr id="row95241840165613"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p15242404566"><a name="p15242404566"></a><a name="p15242404566"></a>ASCEND_DEVICE_ID</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p688447526"><a name="p688447526"></a><a name="p688447526"></a>指定芯片的逻辑ID。</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p688447526"><a name="p688447526"></a><a name="p688447526"></a>指定芯片的逻辑ID。</p>
<p id="p178824712212"><a name="p178824712212"></a><a name="p178824712212"></a>取值范围[0,N-1],默认为0。其中N为当前物理机/虚拟机/容器内的设备总数。</p>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p105245400562"><a name="p105245400562"></a><a name="p105245400562"></a>可选</p>
</td>
</tr>
<tr id="row203705529819"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p53705522810"><a name="p53705522810"></a><a name="p53705522810"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
<tr id="row203705529819"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p53705522810"><a name="p53705522810"></a><a name="p53705522810"></a>ASCEND_SLOG_PRINT_TO_STDOUT</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073203258_p763102116322"><a name="zh-cn_topic_0000001073203258_p763102116322"></a><a name="zh-cn_topic_0000001073203258_p763102116322"></a>是否开启日志打屏。取值:</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073203258_p763102116322"><a name="zh-cn_topic_0000001073203258_p763102116322"></a><a name="zh-cn_topic_0000001073203258_p763102116322"></a>是否开启日志打屏。取值:</p>
<a name="zh-cn_topic_0000001073203258_ul95291245104113"></a><a name="zh-cn_topic_0000001073203258_ul95291245104113"></a><ul id="zh-cn_topic_0000001073203258_ul95291245104113"><li>0或不配置:关闭日志打屏</li><li>1:开启日志打屏</li></ul>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p6370125217818"><a name="p6370125217818"></a><a name="p6370125217818"></a>可选</p>
</td>
</tr>
<tr id="row188405280914"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p5840928594"><a name="p5840928594"></a><a name="p5840928594"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
<tr id="row188405280914"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p5840928594"><a name="p5840928594"></a><a name="p5840928594"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073521184_p763102116322"><a name="zh-cn_topic_0000001073521184_p763102116322"></a><a name="zh-cn_topic_0000001073521184_p763102116322"></a>设置日志的全局日志级别。取值:</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="zh-cn_topic_0000001073521184_p763102116322"><a name="zh-cn_topic_0000001073521184_p763102116322"></a><a name="zh-cn_topic_0000001073521184_p763102116322"></a>设置日志的全局日志级别。取值:</p>
<a name="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"></a><a name="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"></a><ul id="zh-cn_topic_0000001073521184_u4d735da6e0494e55abbf5eb6aefe988d"><li>0:对应DEBUG级别。</li><li>1:对应INFO级别。</li><li>2:对应WARNING级别。</li><li>3:对应ERROR级别。</li><li>4:对应NULL级别,不输出日志。</li><li>其他值为非法值。</li></ul>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p6841928598"><a name="p6841928598"></a><a name="p6841928598"></a>可选</p>
</td>
</tr>
<tr id="row17638114219104"><td class="cellrowborder" valign="top" width="46.75467546754676%" headers="mcps1.2.4.1.1 "><p id="p20638342191018"><a name="p20638342191018"></a><a name="p20638342191018"></a>TASK_QUEUE_ENABLE</p>
<tr id="row17638114219104"><td class="cellrowborder" valign="top" width="35.51355135513551%" headers="mcps1.2.4.1.1 "><p id="p20638342191018"><a name="p20638342191018"></a><a name="p20638342191018"></a>TASK_QUEUE_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="43.18431843184319%" headers="mcps1.2.4.1.2 "><p id="p126381842151019"><a name="p126381842151019"></a><a name="p126381842151019"></a>s是否开启TASK多线程下发,绝大多数情况下,打开该功能会进一步提升整网训练性能。取值:</p>
<td class="cellrowborder" valign="top" width="54.42544254425443%" headers="mcps1.2.4.1.2 "><p id="p126381842151019"><a name="p126381842151019"></a><a name="p126381842151019"></a>是否开启TASK多线程下发,绝大多数情况下,打开该功能会进一步提升整网训练性能。取值:</p>
<a name="ul6194152711118"></a><a name="ul6194152711118"></a><ul id="ul6194152711118"><li>0或不配置:关闭TASK多线程下发。</li><li>1:开启TASK多线程下发。</li></ul>
</td>
<td class="cellrowborder" valign="top" width="10.061006100610062%" headers="mcps1.2.4.1.3 "><p id="p86386423103"><a name="p86386423103"></a><a name="p86386423103"></a>可选</p>
@@ -146,11 +133,13 @@ export TASK_QUEUE_ENABLE=0
>![](public_sys-resources/icon-note.gif) **说明:**
>更多日志信息,请参见《CANN 日志参考》。
<h2 id="样例参考.md">样例参考</h2>
<h3 id="样例参考md">样例参考</h3>
## 样例代码<a name="section2017032418274"></a>
#### 样例代码<a name="section2017032418274"></a>
在进行推理应用时,应尽量保证应用在生命周期内不频繁初始化。推理模式通过模型model.eval\(\)进行设置,并且推理过程要在“with torch.no\_grad\(\):”代码分支下运行。本例中,我们将使用Resnet50网络的python代码进行说明。
在进行推理应用时,应尽量保证应用在生命周期内不频繁初始化。推理模式通过模型model.eval\(\)进行设置,并且推理过程要在“with torch.no\_grad\(\):”代码分支下运行。
本例中,我们将使用Resnet50网络的python代码进行说明。
样例代码 resnet50\_infer\_for\_pytorch.py:
@@ -246,7 +235,7 @@ def main_worker(npu, args):
print("=> creating model '{}'".format(args.arch))
model = models.__dict__[args.arch](zero_init_residual=True)
# 将模型数据置于昇腾AI处理器中
# 将模型数据复制到昇腾AI处理器中
model = model.to(CALCULATE_DEVICE)
optimizer = torch.optim.SGD([
@@ -256,12 +245,12 @@ def main_worker(npu, args):
args.lr)
# =========================================================================
# 初始化混合精度模型,使用后可加速运算,但推理结果的准确率可能会轻微降低。可根据实际场景选择使用
# 初始化混合精度模型,使用后可加速运算,但结果的准确率可能会轻微降低。可根据实际场景选择使用
# =========================================================================
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
# =========================================================================
# 加载训练好的模型参数:通过命令行参数“--resume checkpoint文件”
# 加载训练好的模型参数
# =========================================================================
# 从模型文件中恢复模型参数
if os.path.isfile(args.resume):
@@ -278,7 +267,7 @@ def main_worker(npu, args):
print("=> no checkpoint found at '{}'".format(args.resume))
# =========================================================================
# 初始化推理数据集
# 初始化数据集
# =========================================================================
# 图像数据加载与预处理
valdir = os.path.join(args.data, 'val')
@@ -296,7 +285,7 @@ def main_worker(npu, args):
num_workers=args.workers, pin_memory=True)
# =========================================================================
# 进入在线推理模式
# 运行validate
# =========================================================================
validate(val_loader, model, args)
@@ -332,7 +321,7 @@ def validate(val_loader, model, args):
# 计算输出
output = model(images)
# 测量结果精度
# 统计结果精度
acc1, acc5 = accuracy(output, target, topk=(1, 5))
top1.update(acc1[0], images.size(0))
top5.update(acc5[0], images.size(0))
@@ -344,7 +333,6 @@ def validate(val_loader, model, args):
# 打印推理运算过程日志
progress.display(i)
# TODO: this should also be done with the ProgressMeter
print(' * Acc@1 {top1.avg:.3f} Acc@5 {top5.avg:.3f}'.format(top1=top1, top5=top5))
return top1.avg
@@ -380,7 +368,7 @@ class AverageMeter(object):
class ProgressMeter(object):
"""记录模型运算过程"""
"""记录模型运算过程信息"""
def __init__(self, num_batches, meters, prefix=""):
self.batch_fmtstr = self._get_batch_fmtstr(num_batches)
self.meters = meters
@@ -418,13 +406,13 @@ if __name__ == '__main__':
main()
```
## 样例执行<a name="section340764716270"></a>
#### 样例执行<a name="section340764716270"></a>
以ResNet50模型为例,执行在线推理样例。
1. 下载预训练模型。
打开ModelZoo中[ResNet50详情页](https://ascend.huawei.com/zh/#/software/modelzoo/detail/C/cf20ab8b8bea4032a6b056ab503112e4),点击该页面的“下载模型“下载已训练好的模型文件。
打开ModelZoo中[ResNet50详情页](https://ascend.huawei.com/zh/#/software/modelzoo/detail/C/cf20ab8b8bea4032a6b056ab503112e4),单击该页面的“下载模型“下载已训练好的模型文件。
2. 编辑推理脚本。
@@ -432,41 +420,39 @@ if __name__ == '__main__':
3. 执行推理。
参考[环境变量配置](#环境变量配置.md)设置环境变量,并执行命令:
参考[环境变量配置](#环境变量配置md)设置环境变量,并执行命令:
```
python3.7 pytorch-resnet50-apex.py --data /data/imagenet --npu 7 --epochs 90 --resume checkpoint_npu7_epoch53.pth.tar
# 参数'--resume'加载训练好的权重参数文件,用户可根据实际模型名称修改
python3 pytorch-resnet50-apex.py --data /data/imagenet \
--npu 7 \
--epochs 90 \
--resume ./checkpoint.pth.tar # ./checkpoint.pth.tar为示例预训练模型文件路径
```
>![](public_sys-resources/icon-note.gif) **说明:**
>上述为样例输入,用户可根据实际修改传入参数。
<h2 id="专题.md">专题</h2>
<h2 id="专题md">专题</h2>
- **[混合精度](#混合精度.md)**
- **[权重更新](#权重更新.md)**
- **[混合精度](#混合精度md)**
<h2 id="混合精度.md">混合精度</h2>
<h3 id="混合精度md">混合精度</h3>
## 概述<a name="section14734122962615"></a>
#### 概述<a name="section14734122962615"></a>
基于NPU芯片的架构特性,模型运算会涉及到混合精度,即混合使用float16和float32数据类型的应用场景。使用float16代替float32有如下好处:
●对于中间变量的内存占用更少,节省内存的使用。
●因内存使用会减少,所以数据传出的时间也会减半。
●float16的计算单元可以提供更快的计算性能。
- 对于中间变量的内存占用更少,节省内存的使用。
- 因内存使用会减少,所以数据传出的时间也会相应减少。
- float16的计算单元可以提供更快的计算性能。
但是,混合精度训练受限于float16表达的精度范围,单纯将float32转换成float16会影响训练收敛情况,为了保证部分计算使用float16来进行加速的同时能保证训练收敛,这里采用混合精度模块Apex来达到以上效果。混合精度模块Apex是一个集优化性能、精度收敛于一身的综合优化库。
## 特性支持<a name="section175201458521"></a>
#### 特性支持<a name="section175201458521"></a>
混合精度模块功能和优化描述如[表1](#zh-cn_topic_0278765773_table10717173813332)所示:
混合精度模块功能和优化描述如[表1](#zh-cn_topic_0278765773_table10717173813332)所示。
**表 1** 混合精度模块功能
@@ -479,12 +465,12 @@ if __name__ == '__main__':
</thead>
<tbody><tr id="zh-cn_topic_0278765773_row1571763813334"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p4502732153412"><a name="zh-cn_topic_0278765773_p4502732153412"></a><a name="zh-cn_topic_0278765773_p4502732153412"></a>O1配置模式</p>
</td>
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p640053920348"><a name="zh-cn_topic_0278765773_p640053920348"></a><a name="zh-cn_topic_0278765773_p640053920348"></a>Conv, Matmal等使用<span>float16</span>计算,其他如Softmax、BN使用<span>float32</span>。</p>
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p640053920348"><a name="zh-cn_topic_0278765773_p640053920348"></a><a name="zh-cn_topic_0278765773_p640053920348"></a>Conv, Matmul等使用float16计算,其他如Softmax、BN使用float32。</p>
</td>
</tr>
<tr id="zh-cn_topic_0278765773_row3717173817336"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p11503103210344"><a name="zh-cn_topic_0278765773_p11503103210344"></a><a name="zh-cn_topic_0278765773_p11503103210344"></a>O2配置</p>
<tr id="zh-cn_topic_0278765773_row3717173817336"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p11503103210344"><a name="zh-cn_topic_0278765773_p11503103210344"></a><a name="zh-cn_topic_0278765773_p11503103210344"></a>O2配置模式</p>
</td>
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p164001639143419"><a name="zh-cn_topic_0278765773_p164001639143419"></a><a name="zh-cn_topic_0278765773_p164001639143419"></a>除了BN使用<span>float32</span>外,其他绝大部分使用<span>float16</span>。</p>
<td class="cellrowborder" valign="top" width="67.73%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0278765773_p164001639143419"><a name="zh-cn_topic_0278765773_p164001639143419"></a><a name="zh-cn_topic_0278765773_p164001639143419"></a>BN使用float32,其他绝大部分使用float16。</p>
</td>
</tr>
<tr id="zh-cn_topic_0278765773_row14717193815334"><td class="cellrowborder" valign="top" width="32.269999999999996%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0278765773_p1950318328349"><a name="zh-cn_topic_0278765773_p1950318328349"></a><a name="zh-cn_topic_0278765773_p1950318328349"></a>静态Loss Scale功能</p>
@@ -503,7 +489,7 @@ if __name__ == '__main__':
>![](public_sys-resources/icon-note.gif) **说明:**
>当前版本的实现方式主要为python实现,不支持AscendCL或者CUDA优化。
## 混合精度模型初始化<a name="section18178125518268"></a>
#### 混合精度模型初始化<a name="section18178125518268"></a>
1. 使用apex混合精度模块需要首先从apex库中导入amp,代码如下:
@@ -517,114 +503,42 @@ if __name__ == '__main__':
model, optimizer = amp.initialize(model, optimizer)
```
- 可参考[样例代码](#样例参考.md)中的“初始化混合精度模型”:
也可参考[样例代码](#样例参考md)中的“初始化混合精度模型”:
```
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
```
```
model, optimizer = amp.initialize(model, optimizer, opt_level="O2", loss_scale=1024, verbosity=1)
```
## 混合精度推理<a name="section818071513288"></a>
#### 混合精度推理<a name="section818071513288"></a>
按混合精度模型初始化后,正常执行模型正向计算即可。
参考代码:可参考[样例代码](#样例参考.md)实现。
参考代码:可参考[样例代码](#样例参考md)实现。
<h2 id="权重更新.md">权重更新</h2>
## 背景<a name="section67167596290"></a>
推理进行的同时,训练服务器不断训练得到新的权重。
如果希望使用最新的权重进行推理,可以采用在线推理方式,直接更新权重。
## 整体流程<a name="section83461954103018"></a>
**图 1** 权重更新流程示意图<a name="fig6243201383"></a>
![](figures/权重更新流程示意图.png "权重更新流程示意图")
如[图1](#fig6243201383)所示,支持循环地更新权重与执行推理。主要流程:
1. 模型初始化;
2. 权重加载/更新:获取在线推理模型和权重信息,例如从ckpt文件中加载,实际更新用的权重则来自于外部的key-value;
3. 加载数据;
4. 执行推理图模型。
## 样例参考<a name="section95391544013"></a>
请参考[样例参考](#样例参考.md)。
<h2 id="FAQ.md">FAQ</h2>
- **[pip3.7 install Pillow==5.3.0安装失败](#pip3-7-install-Pillow-5-3-0安装失败.md)**
- **[安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md)**
<h2 id="pip3-7-install-Pillow-5-3-0安装失败.md">pip3.7 install Pillow==5.3.0安装失败</h2>
## 现象描述<a name="zh-cn_topic_0277124533_zh-cn_topic_0175549220_section197270431505"></a>
pip3.7 install pillow==5.3.0安装失败。
## 可能原因<a name="zh-cn_topic_0277124533_zh-cn_topic_0175549220_section169499490501"></a>
缺少必要的依赖,如:libjpeg、python-devel、 zlib-devel 、libjpeg-turbo-devel等等。
## 处理方法<a name="zh-cn_topic_0277124533_section108142031907"></a>
安装相关依赖,通过如下命令安装:
- CentOS/EulerOS/Tlinux/BClinux/Suse
**yum install libjpeg python-devel zlib-devel libjpeg-turbo-devel**
- Ubuntu/Debian/UOS
**apt-get install libjpeg python-devel zlib-devel libjpeg-turbo-devel**
<h2 id="安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配.md">安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配</h2>
## 现象描述<a name="zh-cn_topic_0277124535_zh-cn_topic_0175549220_section197270431505"></a>
安装“torch-\*.whl”时,提示"ERROR:torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible"。
![](figures/zh-cn_image_0000001152776305.png)
## 可能原因<a name="zh-cn_topic_0277124535_zh-cn_topic_0175549220_section169499490501"></a>
安装torch时,会自动触发torchvision进行依赖版本检查,环境中安装的torchvision版本为0.6.0,检查时发现我们安装的torch-\*.whl的版本号与要求的1.5.0不一致,所以提示报错,但实际安装成功。
## 处理方法<a name="zh-cn_topic_0277124535_section108142031907"></a>
对实际结果无影响,无需处理。
<h2 id="安装7-3-0版本gcc.md">安装7.3.0版本gcc</h2>
<h2 id="安装7-3-0版本gccmd">安装7.3.0版本gcc</h2>
以下步骤请在root用户下执行。
1. 下载gcc-7.3.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz)。
2. 安装gcc时候会占用大量临时空间,所以先执行下面的命令清空/tmp目录:
2. 安装gcc时候会占用大量临时空间,请先执行下面的命令清空/tmp目录:
```
sudo rm -rf /tmp/*
```
3. 安装依赖。
3. 安装依赖(以CentOS和Ubuntu系统为例)。
- CentOS执行如下命令安装。
centos/bclinux执行如下命令安装。
```
yum install bzip2
```
```
yum install bzip2
```
- Ubuntu执行如下命令安装。
ubuntu/debian执行如下命令安装。
```
apt-get install bzip2
```
```
apt-get install bzip2
```
4. 编译安装gcc。
1. 进入gcc-7.3.0.tar.gz源码包所在目录,解压源码包,命令为:
@@ -665,7 +579,7 @@ pip3.7 install pillow==5.3.0安装失败。
make install
```
>![](public_sys-resources/icon-caution.gif) **注意:**
>![](public_sys-resources/icon-notice.gif) **须知:**
>其中“--prefix“参数用于指定linux\_gcc7.3.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.3.0“。
@@ -677,7 +591,7 @@ pip3.7 install pillow==5.3.0安装失败。
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
```
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l75d31a2874534a2092e80a5f865b46f0)中配置的gcc7.3.0安装路径,本示例为“/usr/local/gcc7.3.0/“。
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001146754749_zh-cn_topic_0000001072593337_l75d31a2874534a2092e80a5f865b46f0)中配置的gcc7.3.0安装路径,本示例为“/usr/local/linux\_gcc7.3.0/“。
>![](public_sys-resources/icon-note.gif) **说明:**
>本步骤为用户在需要用到gcc升级后的编译环境时才配置环境变量。
Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

@@ -0,0 +1,555 @@
# PyTorch安装指南
- [简介](#简介md)
- [手动编译安装](#手动编译安装md)
- [前提条件](#前提条件md)
- [安装PyTorch框架](#安装PyTorch框架md)
- [配置环境变量](#配置环境变量md)
- [安装混合精度模块](#安装混合精度模块md)
- [参考信息](#参考信息md)
- [CMake安装方法](#CMake安装方法md)
- [安装7.3.0版本gcc](#安装7-3-0版本gccmd)
- [安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md)
<h2 id="简介md">简介</h2>
用户在准备相关环境进行基于PyTorch框架模型的开发、运行时,可以选择在服务器中手动编译安装PyTorch框架相关模块。
**图 1** 环境准备流程图<a name="zh-cn_topic_0000001119176876_fig1938918396117"></a>
![](figures/210926103326800.png)
<h2 id="手动编译安装md">手动编译安装</h2>
- **[前提条件](#前提条件md)**
- **[安装PyTorch框架](#安装PyTorch框架md)**
- **[配置环境变量](#配置环境变量md)**
- **[安装混合精度模块](#安装混合精度模块md)**
<h3 id="前提条件md">前提条件</h3>
#### 前提条件<a name="zh-cn_topic_0000001105856382_zh-cn_topic_0275872734_section108914373254"></a>
- 需完成CANN开发或运行环境的安装,具体操作请参考《CANN 软件安装指南》。
- 需安装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。
- 需确保环境中已安装patch、git工具,以Ubuntu和CentOS系统为例,命令如下:
- Ubuntu系统
```
apt-get install patch
apt-get install git
```
- CentOS系统
```
yum install patch
yum install git
```
<h3 id="安装PyTorch框架md">安装PyTorch框架</h3>
#### 安装流程<a name="zh-cn_topic_0000001152776301_section1611810384557"></a>
1. 以root或非root用户登录服务器。
2. 依次执行如下命令安装PyTorch依赖环境。
如果使用非root用户安装Python及其依赖,用户需要在本步骤中的每句命令结尾加上**--user**,命令示例为:**pip3.7 install pyyaml --user**
```
pip3 install pyyaml
pip3 install wheel
```
3. 获取PyTorch源代码。
1. 运行如下命令,获取适配昇腾AI处理器的PyTorch源代码。
```
git clone https://gitee.com/ascend/pytorch.git
```
下载的源码主要目录结构如下所示:
```
├── patch # 昇腾AI处理器适配补丁目录
│ ├── pytorch1.5.0_npu.patch # pytorch1.5.0版本补丁
│ └── pytorch1.8.1_npu.patch # pytorch1.8.1版本补丁
├── pytorch1.5.0 # pytorch1.5.0源码及测试目录
│ ├── access_control_test.py
│ ├── src # 源码目录
│ └── test # 测试用例存放目录
├── pytorch1.8.1 # pytorch1.8.1源码及测试目录
│ ├── access_control_test.py
│ ├── src # 源码目录
│ └── test # 测试用例存放目录
└── scripts # 编译构建目录
```
2. 在当前仓根目录“/pytorch“下获取原生PyTorch源代码。
- 若安装pytorch1.5.0版本,执行如下命令。
```
git clone -b v1.5.0 --depth=1 https://github.com/pytorch/pytorch.git
```
- 若安装pytorch1.8.1版本,执行如下命令。
```
git clone -b v1.8.1 --depth=1 https://github.com/pytorch/pytorch.git
```
3. 运行如下命令,进入原生pytorch代码目录“pytorch“,并获取PyTorch被动依赖代码。
```
cd pytorch
git submodule sync
git submodule update --init --recursive
```
>![](public_sys-resources/icon-note.gif) **说明:**
>受网络波动影响,源码获取时间可能较长,下载过程中请耐心等待。 下载完成之后若没有报错,即生成了PyTorch及其依赖的第三方代码。
4. 编译生成适配昇腾AI处理器的PyTorch安装包。
1. 进入“pytorch/scripts“文件夹,执行转换脚本,生成适配昇腾AI处理器的全量代码。
```
cd ../scripts
# 若安装1.5.0版本
bash gen.sh
# 若安装1.8.1版本
bash gen.sh -v 1.8.1
```
将在"pytorch/pytorch"目录中生成适配昇腾AI处理器的全量代码。
2. 进入到“pytorch/pytorch/“目录,依赖库安装。
```
cd ../pytorch
pip3 install -r requirements.txt
```
3. 编译生成pytorch的二进制安装包。
```
bash build.sh --python=3.7
或
bash build.sh --python=3.8
```
请指定环境中python版本进行编译。生成的二进制包在当前的dist目录下,即“pytorch/pytorch/dist”文件夹目录下。
5. <a name="zh-cn_topic_0000001152776301_li49671667141"></a>安装PyTorch。
进入“pytorch/pytorch/dist“文件夹目录,执行如下命令安装。
```
pip3 install --upgrade torch-1.5.0+ascend.post3-cp37-cp37m-linux_{arch}.whl
```
**\{arch\}**表示架构信息,为aarch64或x86\_64。
>![](public_sys-resources/icon-note.gif) **说明:**
>若对环境中的PyTorch进行升级时,需要先卸载环境中已安装的PyTorch软件包再执行[5. 安装PyTorch。](#zh-cn_topic_0000001152776301_li49671667141)可以通过执行如下命令查询环境上是否已安装PyTorch。
>**pip3 list | grep torch**
<h3 id="配置环境变量md">配置环境变量</h3>
安装完软件包后,需要配置环境变量才能正常使用昇腾PyTorch。相关环境变量介绍参见[表1](#zh-cn_topic_0000001152616261_table42017516135)。
1. 配置运行环境变量,在适配昇腾AI处理器的PyTorch源代码根目录中运行如下命令。
```
source pytorch/env.sh
```
2. 请依据实际场景,选择合适的HCCL初始化方式,并配置相应环境变量。
```
# 场景一:单机场景
export HCCL_WHITELIST_DISABLE=1 # 关闭HCCL通信白名单
# 场景二:多机场景。
export HCCL_WHITELIST_DISABLE=1 # 关闭HCCL通信白名单
export HCCL_IF_IP="1.1.1.1" # “1.1.1.1”为示例使用的host网卡IP,请根据实际修改。需要保证使用的网卡IP在集群内是互通的。
```
3. (可选)NPU场景下配置功能或性能环境变量。默认为不开启。
```
export DYNAMIC_COMPILE_ENABLE=1 # 动态shape特性功能,针对shape变化场景,可选,开启设置为1(PyTorch1.8.1不支持该环境变量)
export COMBINED_ENABLE=1 # 非连续两个算子组合类场景优化,可选,开启设置为1
export TRI_COMBINED_ENABLE=1 # 非连续三个算子组合类场景优化,可选,开启设置为1
export ACL_DUMP_DATA=1 # 算子数据dump功能,调试时使用,可选,开启设置为1
export DYNAMIC_OP="ADD#MUL" # 算子实现,ADD和MUL算子在不同场景下有不同的性能表现。可选
```
4. (可选)当系统为openEuler及其继承操作系统时,如UOS,需设置此命令,取消CPU绑核。
```
# unset GOMP_CPU_AFFINITY
```
**表 1** 环境变量说明
<a name="zh-cn_topic_0000001152616261_table42017516135"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001152616261_row16198951191317"><th class="cellrowborder" valign="top" width="55.48%" id="mcps1.2.3.1.1"><p id="zh-cn_topic_0000001152616261_p51981251161315"><a name="zh-cn_topic_0000001152616261_p51981251161315"></a><a name="zh-cn_topic_0000001152616261_p51981251161315"></a>配置项</p>
</th>
<th class="cellrowborder" valign="top" width="44.519999999999996%" id="mcps1.2.3.1.2"><p id="zh-cn_topic_0000001152616261_p9198135114133"><a name="zh-cn_topic_0000001152616261_p9198135114133"></a><a name="zh-cn_topic_0000001152616261_p9198135114133"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001152616261_row6882121917329"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p688241953218"><a name="zh-cn_topic_0000001152616261_p688241953218"></a><a name="zh-cn_topic_0000001152616261_p688241953218"></a>LD_LIBRARY_PATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1888291915322"><a name="zh-cn_topic_0000001152616261_p1888291915322"></a><a name="zh-cn_topic_0000001152616261_p1888291915322"></a>动态库的查找路径,参考上述举例配置。</p>
<p id="p1292181892120"><a name="p1292181892120"></a><a name="p1292181892120"></a>若训练所在系统环境需要升级gcc(例如CentOS、Debian和BClinux系统),则<span class="parmname" id="parmname795020446318"><a name="parmname795020446318"></a><a name="parmname795020446318"></a>“LD_LIBRARY_PATH”</span>配置项处动态库查找路径需要添加<span class="filepath" id="zh-cn_topic_0256062644_filepath115819811512"><a name="zh-cn_topic_0256062644_filepath115819811512"></a><a name="zh-cn_topic_0256062644_filepath115819811512"></a>“${install_path}/lib64”</span>,其中<span class="filepath" id="zh-cn_topic_0256062644_filepath195951574421"><a name="zh-cn_topic_0256062644_filepath195951574421"></a><a name="zh-cn_topic_0256062644_filepath195951574421"></a>“{install_path}”</span>为gcc升级安装路径。请参见<a href="#安装7-3-0版本gccmd#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li9745165315131">5</a>。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row16194175523010"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p16195185523019"><a name="zh-cn_topic_0000001152616261_p16195185523019"></a><a name="zh-cn_topic_0000001152616261_p16195185523019"></a>PYTHONPATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p19637083322"><a name="zh-cn_topic_0000001152616261_p19637083322"></a><a name="zh-cn_topic_0000001152616261_p19637083322"></a>Python搜索路径,参考上述举例配置。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row2954102119329"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p195452113218"><a name="zh-cn_topic_0000001152616261_p195452113218"></a><a name="zh-cn_topic_0000001152616261_p195452113218"></a>PATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p964914893211"><a name="zh-cn_topic_0000001152616261_p964914893211"></a><a name="zh-cn_topic_0000001152616261_p964914893211"></a>可执行程序的查找路径,参考上述举例配置。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row58592816294"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p1886016892913"><a name="zh-cn_topic_0000001152616261_p1886016892913"></a><a name="zh-cn_topic_0000001152616261_p1886016892913"></a>ASCEND_OPP_PATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p28608892915"><a name="zh-cn_topic_0000001152616261_p28608892915"></a><a name="zh-cn_topic_0000001152616261_p28608892915"></a>算子根目录,参考上述举例配置。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row144592037903"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p104601373014"><a name="zh-cn_topic_0000001152616261_p104601373014"></a><a name="zh-cn_topic_0000001152616261_p104601373014"></a>OPTION_EXEC_EXTERN_PLUGIN_PATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1046013716017"><a name="zh-cn_topic_0000001152616261_p1046013716017"></a><a name="zh-cn_topic_0000001152616261_p1046013716017"></a>算子信息库路径。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row16184379493"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p131851873492"><a name="zh-cn_topic_0000001152616261_p131851873492"></a><a name="zh-cn_topic_0000001152616261_p131851873492"></a>ASCEND_AICPU_PATH</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p181851575497"><a name="zh-cn_topic_0000001152616261_p181851575497"></a><a name="zh-cn_topic_0000001152616261_p181851575497"></a>aicpu算子包路径。</p>
</td>
</tr>
<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>TASK_QUEUE_ENABLE</p>
</td>
<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>使用异步任务下发,异步调用acl接口。建议开启,开启设置为1。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row1680820246202"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p4809112415207"><a name="zh-cn_topic_0000001152616261_p4809112415207"></a><a name="zh-cn_topic_0000001152616261_p4809112415207"></a>HCCL_WHITELIST_DISABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p952814428206"><a name="zh-cn_topic_0000001152616261_p952814428206"></a><a name="zh-cn_topic_0000001152616261_p952814428206"></a>配置在使用HCCL时是否开启通信白名单。</p>
<a name="ul928845132310"></a><a name="ul928845132310"></a><ul id="ul928845132310"><li>0:开启白名单,无需校验HCCL通信白名单。</li><li>1:关闭白名单,需校验HCCL通信白名单。</li></ul>
<p id="zh-cn_topic_0000001152616261_p5809162416201"><a name="zh-cn_topic_0000001152616261_p5809162416201"></a><a name="zh-cn_topic_0000001152616261_p5809162416201"></a>缺省值为0,默认开启白名单。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001152616261_row0671137162115"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p4671203792114"><a name="zh-cn_topic_0000001152616261_p4671203792114"></a><a name="zh-cn_topic_0000001152616261_p4671203792114"></a>HCCL_IF_IP</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p1822165982114"><a name="zh-cn_topic_0000001152616261_p1822165982114"></a><a name="zh-cn_topic_0000001152616261_p1822165982114"></a>配置HCCL的初始化通信网卡IP。</p>
<a name="ul2676102292415"></a><a name="ul2676102292415"></a><ul id="ul2676102292415"><li>ip格式为点分十进制。</li><li>暂只支持host网卡。</li></ul>
<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>
</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>
</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>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p6433151393018"><a name="p6433151393018"></a><a name="p6433151393018"></a>(可选)设置是否开启日志打屏。</p>
<a name="ul760201917473"></a><a name="ul760201917473"></a><ul id="ul760201917473"><li>0:表示采用日志的默认输出方式。</li><li>1:表示日志打屏显示。</li><li>其他值为非法值。</li></ul>
</td>
</tr>
<tr id="row19237171814300"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p14238161893019"><a name="p14238161893019"></a><a name="p14238161893019"></a>ASCEND_GLOBAL_LOG_LEVEL</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p223841810303"><a name="p223841810303"></a><a name="p223841810303"></a>设置应用类日志的全局日志级别。</p>
<a name="ul175714586453"></a><a name="ul175714586453"></a><ul id="ul175714586453"><li>0:对应DEBUG级别。</li><li>1:对应INFO级别。</li><li>2:对应WARNING级别。</li><li>3:对应ERROR级别。</li><li>4:对应NULL级别,不输出日志。</li><li>其他值为非法值。</li></ul>
</td>
</tr>
<tr id="row1348192313303"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1734815235305"><a name="p1734815235305"></a><a name="p1734815235305"></a>ASCEND_GLOBAL_EVENT_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p12348202373018"><a name="p12348202373018"></a><a name="p12348202373018"></a>设置应用类日志是否开启Event日志。</p>
<a name="ul416352114610"></a><a name="ul416352114610"></a><ul id="ul416352114610"><li>0:不开启Event日志。</li><li>1:开启Event日志。</li><li>其他值为非法值。</li></ul>
</td>
</tr>
<tr id="row17878184693015"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1878194683016"><a name="p1878194683016"></a><a name="p1878194683016"></a>DYNAMIC_COMPILE_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p1887894620304"><a name="p1887894620304"></a><a name="p1887894620304"></a>(可选)动态shape特性功能,针对shape变化场景,开启设置为1(PyTorch1.8.1不支持该环境变量)。</p>
</td>
</tr>
<tr id="row78312162301"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p1832171673019"><a name="p1832171673019"></a><a name="p1832171673019"></a>COMBINED_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p583261643014"><a name="p583261643014"></a><a name="p583261643014"></a>(可选)非连续两个算子组合类场景优化,开启设置为1。</p>
</td>
</tr>
<tr id="row17630155212342"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p66309527341"><a name="p66309527341"></a><a name="p66309527341"></a>RI_COMBINED_ENABLE</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p19630185220345"><a name="p19630185220345"></a><a name="p19630185220345"></a>(可选)非连续三个算子组合类场景优化,开启设置为1。</p>
</td>
</tr>
<tr id="row183041355123411"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p730435533415"><a name="p730435533415"></a><a name="p730435533415"></a>ACL_DUMP_DATA</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p16304105533412"><a name="p16304105533412"></a><a name="p16304105533412"></a>(可选)算子数据dump功能,调试时使用,开启设置为1。</p>
</td>
</tr>
<tr id="row27481914203518"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="p674813144357"><a name="p674813144357"></a><a name="p674813144357"></a>DYNAMIC_OP</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="p974891414353"><a name="p974891414353"></a><a name="p974891414353"></a>(可选)算子实现,ADD和MUL算子在不同场景下有不同的性能表现。默认不设置。</p>
</td>
</tr>
<tr id="row19173161510309"><td class="cellrowborder" valign="top" width="55.48%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001152616261_p16711563237"><a name="zh-cn_topic_0000001152616261_p16711563237"></a><a name="zh-cn_topic_0000001152616261_p16711563237"></a>unset GOMP_CPU_AFFINITY</p>
</td>
<td class="cellrowborder" valign="top" width="44.519999999999996%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001152616261_p0711356152317"><a name="zh-cn_topic_0000001152616261_p0711356152317"></a><a name="zh-cn_topic_0000001152616261_p0711356152317"></a>(可选)当系统为openEuler及其继承操作系统时,如UOS,需设置此命令,取消CPU绑核。</p>
</td>
</tr>
</tbody>
</table>
<h3 id="安装混合精度模块md">安装混合精度模块</h3>
#### 前提条件<a name="zh-cn_topic_0000001106176190_section3225481020"></a>
1. 请确保运行环境中适配昇腾AI处理器的PyTorch框架能正常使用。
2. 编译安装Apex前,需参见[配置环境变量](#配置环境变量md)配置好编译过程依赖的环境变量。
#### 安装流程<a name="zh-cn_topic_0000001106176190_section11880164819567"></a>
1. 以root或非root用户登录服务器。
2. 获取apex源代码。
1. 运行如下命令,获取适配昇腾AI处理器的apex源代码。
```
git clone https://gitee.com/ascend/apex.git
```
下载的源码主要目录结构如下所示:
```
apex
│ ├─patch # 昇腾AI处理器适配补丁目录
│ ├─npu.patch
│ ├─scripts # 编译构建目录
│ ├─gen.sh
│ ├─src # 源码目录
│ ├─tests # 测试用例存放目录
```
2. 运行如下命令,进入“apex“目录,并获取原生apex源代码。
```
cd apex
git clone https://github.com/NVIDIA/apex.git
```
下载原生apex源码后,代码主要目录结构如下所示:
```
apex
│ ├─apex # 原生apex代码目录
│ ├─patch # 昇腾AI处理器适配补丁目录
│ ├─npu.patch
│ ├─scripts # 编译构建目录
│ ├─gen.sh
│ ├─src # 源码目录
│ ├─tests # 测试用例存放目录
```
3. 进入原生apex代码目录,即“apex/apex“目录。切换至commitid为4ef930c1c884fdca5f472ab2ce7cb9b505d26c1a的代码分支。
```
cd apex
git checkout 4ef930c1c884fdca5f472ab2ce7cb9b505d26c1a
```
>![](public_sys-resources/icon-note.gif) **说明:**
>受网络波动影响,源码获取时间可能较长,下载过程中请耐心等待。
3. 编译生成适配昇腾AI处理器的apex安装包。
1. 进入“apex/scripts“文件夹,执行转换脚本,生成适配昇腾AI处理器的全量代码。
```
cd ../scripts
bash gen.sh
```
将在"apex/apex"目录中生成适配昇腾AI处理器的全量代码。
2. 进入适配后的全量代码目录,即“apex/apex“目录,编译生成apex的二进制安装包。
```
cd ../apex
python3 setup.py --cpp_ext --npu_float_status bdist_wheel
```
Python版本需与PyTorch使用的Python一致,生成的二进制包在当前的dist目录下,即“apex/apex/dist”文件夹目录下。
4. <a name="zh-cn_topic_0000001106176190_li425495374416"></a>安装apex。
进入“apex/apex/dist“文件夹目录,执行如下命令安装。
```
pip3 install --upgrade apex-0.1+ascend-cp37-cp37m-linux_{arch}.whl
```
**\{arch\}**表示架构信息,为aarch64或x86\_64。
>![](public_sys-resources/icon-note.gif) **说明:**
>若对环境中的Apex进行升级时,需要先卸载环境中已安装的PyTorch软件包再执行[4. 安装apex。](#zh-cn_topic_0000001106176190_li425495374416)可以通过执行如下命令查询环境上是否已安装PyTorch。
>**pip3 list | grep apex**
<h2 id="参考信息md">参考信息</h2>
- **[CMake安装方法](#CMake安装方法md)**
- **[安装7.3.0版本gcc](#安装7-3-0版本gccmd)**
- **[安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配](#安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md)**
<h3 id="CMake安装方法md">CMake安装方法</h3>
CMake版本升级为3.12.1的方法
1. 获取Cmake软件包。
```
wget https://cmake.org/files/v3.12/cmake-3.12.1.tar.gz --no-check-certificate
```
2. 解压并进入软件包目录。
```
tar -xf cmake-3.12.1.tar.gz
cd cmake-3.12.1/
```
3. 执行配置、编译和安装命令。
```
./configure --prefix=/usr/local/cmake
make && make install
```
4. 设置软连接。
```
ln -s /usr/local/cmake/bin/cmake /usr/bin/cmake
```
5. 执行如下命令验证是否安装成功。
```
cmake --version
```
如显示“cmake version 3.12.1”则表示安装成功。
<h3 id="安装7-3-0版本gccmd">安装7.3.0版本gcc</h3>
以下步骤请在root用户下执行。
1. 下载gcc-7.3.0.tar.gz,下载地址为[https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz](https://mirrors.tuna.tsinghua.edu.cn/gnu/gcc/gcc-7.3.0/gcc-7.3.0.tar.gz)。
2. 安装gcc时候会占用大量临时空间,所以先执行下面的命令清空/tmp目录:
```
sudo rm -rf /tmp/*
```
3. 安装依赖(以CentOS和Ubuntu系统为例)。
- CentOS执行如下命令安装。
```
yum install bzip2
```
- Ubuntu执行如下命令安装。
```
apt-get install bzip2
```
4. 编译安装gcc。
1. 进入gcc-7.3.0.tar.gz源码包所在目录,解压源码包,命令为:
```
tar -zxvf gcc-7.3.0.tar.gz
```
2. 进入解压后的文件夹,执行如下命令下载gcc依赖包:
```
cd gcc-7.3.0
./contrib/download_prerequisites
```
如果执行上述命令报错,需要执行如下命令在“gcc-7.3.0/“文件夹下下载依赖包:
```
wget http://gcc.gnu.org/pub/gcc/infrastructure/gmp-6.1.0.tar.bz2
wget http://gcc.gnu.org/pub/gcc/infrastructure/mpfr-3.1.4.tar.bz2
wget http://gcc.gnu.org/pub/gcc/infrastructure/mpc-1.0.3.tar.gz
wget http://gcc.gnu.org/pub/gcc/infrastructure/isl-0.16.1.tar.bz2
```
下载好上述依赖包后,重新执行以下命令:
```
./contrib/download_prerequisites
```
如果上述命令校验失败,需要确保依赖包为一次性下载成功,无重复下载现象。
3. <a name="zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310"></a>执行配置、编译和安装命令:
```
./configure --enable-languages=c,c++ --disable-multilib --with-system-zlib --prefix=/usr/local/linux_gcc7.3.0
make -j15 # 通过grep -w processor /proc/cpuinfo|wc -l查看cpu数,示例为15,用户可自行设置相应参数。
make install
```
>![](public_sys-resources/icon-notice.gif) **须知:**
>其中“--prefix“参数用于指定linux\_gcc7.3.0安装路径,用户可自行配置,但注意不要配置为“/usr/local“及“/usr“,因为会与系统使用软件源默认安装的gcc相冲突,导致系统原始gcc编译环境被破坏。示例指定为“/usr/local/linux\_gcc7.3.0“。
5. 配置环境变量。
当用户执行训练时,需要用到gcc升级后的编译环境,因此要在训练脚本中配置环境变量,通过如下命令配置。
```
export LD_LIBRARY_PATH=${install_path}/lib64:${LD_LIBRARY_PATH}
```
其中$\{install\_path\}为[3.](#zh-cn_topic_0000001135347812_zh-cn_topic_0000001173199577_zh-cn_topic_0000001172534867_zh-cn_topic_0276688294_li1649343041310)中配置的gcc7.3.0安装路径,本示例为“/usr/local/gcc7.3.0/“。
>![](public_sys-resources/icon-note.gif) **说明:**
>本步骤为用户在需要用到gcc升级后的编译环境时才配置环境变量。
<h3 id="安装-torch--whl-提示-torch-1-5-0xxxx-与-torchvision-所依赖的版本不匹配md">安装“torch-\*.whl ”提示“torch 1.5.0xxxx”与“torchvision”所依赖的版本不匹配</h3>
#### 现象描述<a name="zh-cn_topic_0000001105856364_zh-cn_topic_0175549220_section197270431505"></a>
安装“torch-\*.whl”时,提示"ERROR:torchvision 0.6.0 has requirement torch==1.5.0, but you'll have torch 1.5.0a0+1977093 which is incompatible"。
![](figures/zh-cn_image_0000001190081735.png)
#### 可能原因<a name="zh-cn_topic_0000001105856364_zh-cn_topic_0175549220_section169499490501"></a>
安装torch时,会自动触发torchvision进行依赖版本检查,环境中安装的torchvision版本为0.6.0,检查时发现我们安装的torch-\*.whl的版本号与要求的1.5.0不一致,所以提示报错,但实际安装成功 。
#### 处理方法<a name="zh-cn_topic_0000001105856364_section108142031907"></a>
对实际结果无影响,无需处理。
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

+242
View File
@@ -0,0 +1,242 @@
# FrameworkPTAdapter 2.0.3 版本说明书
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
- [特性修改](#特性修改md)
- [已修复问题](#已修复问题md)
- [已知问题](#已知问题md)
- [兼容性](#兼容性md)
<h2 id='用户须知md'>用户须知</h2>
本框架基于Facebook主导的开源PyTorch1.5.0进行修改,延续原生的PyTorch特性,使用NPU进行动态图训练;以算子粒度进行模型适配,代码重用性好,支持现有的网络只修改设备类型或数据类型,即可迁移到NPU上使用。
从此版本开始,PyTorch1.8.1版本提供支持,此版本延续PyTorch1.5.0特性,功能保持一致(profiling工具除外)。除此之外,对后端算子适配提供较好开发体验。当期1.8.1版本仅支持Resent50网络模型。
<h2 id='新增特性md'>新增特性</h2>
**表 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="5" valign="top" width="10.459999999999999%" headers="mcps1.2.4.1.1 "><p id="p69836331553"><a name="p69836331553"></a><a name="p69836331553"></a>适配NPU的PyTorch特性</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>支持PyTorch1.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>增加PyTorch1.8.1版本, 当前仅支持resnet50网络,包括其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>支持python3.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>支持python3.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>提供算子溢出检测工具</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p109832331055"><a name="p109832331055"></a><a name="p109832331055"></a>支持框架IR级别算子溢出检测,在发生AICORE算子溢出时,提示溢出的IR信息。</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兼容性</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p13538203153618"><a name="p13538203153618"></a><a name="p13538203153618"></a>新增支持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>框架基础功能</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1416815259367"><a name="p1416815259367"></a><a name="p1416815259367"></a>新增适配算子开发(详见算子清单)</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>训练模型</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>
<h2 id="特性修改md">特性修改</h2>
不涉及
<h2 id="已修复问题md">已修复问题</h2>
不涉及
<h2 id="已知问题md">已知问题</h2>
<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>
<h2 id="兼容性md">兼容性</h2>
A800-9010:CentOS 7.6/Ubuntu 18.04/BC-Linux 7.6/Debian 9.9/Debian 10/OpenEuler 20.03 LTS
A800-9000:CentOS 7.6/Euler 2.8/Kylin v10/BC-Linux 7.6/OpenEuler 20.03 LTS/UOS 20 1020e
Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 580 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 394 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 406 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 253 B

Binary file not shown.

After

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
@@ -1,3 +1,17 @@
# Copyright (c) 2020 Huawei Technologies Co., Ltd
# 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.
# -*- coding: UTF-8 -*-
import os
@@ -980,6 +980,8 @@
NPU: conv_transpose2d_npu_
- func: conv_transpose3d.input(Tensor input, Tensor weight, Tensor? bias=None, int[3] stride=1, int[3] padding=0, int[3] output_padding=0, int groups=1, int[3] dilation=1) -> Tensor
npu_dispatch:
NPU: conv_transpose3d_npu_
- func: copy_(Tensor(a!) self, Tensor src, bool non_blocking=False) -> Tensor(a!)
manual_kernel_registration: True
@@ -1112,11 +1114,19 @@
- func: npu_conv_transpose2d(Tensor input, Tensor weight, Tensor? bias, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups) -> Tensor
npu_dispatch_only:
NPU: convolution_transpose_npu
NPU: conv_transpose2d_npu
- func: npu_convolution_transpose_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
npu_dispatch_only:
NPU: convolution_transpose_backward_npu
NPU: npu_convolution_transpose_backward
- func: npu_conv_transpose2d_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
npu_dispatch_only:
NPU: conv_transpose2d_backward_npu
- func: npu_conv_transpose3d_backward(Tensor input, Tensor grad_output, Tensor weight, int[] padding, int[] output_padding, int[] stride, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
npu_dispatch_only:
NPU: conv_transpose3d_backward_npu
- func: npu_convolution(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int groups) -> Tensor
npu_dispatch_only:
@@ -1126,6 +1136,10 @@
npu_dispatch_only:
NPU: npu_convolution_backward
- func: npu_convolution_double_backward(Tensor? ggI, Tensor? ggW, Tensor? ggb, Tensor input, Tensor gO, Tensor weight, int[] stride, int[] padding, int[] dilation, int groups, bool[3] output_mask) -> (Tensor, Tensor, Tensor)
npu_dispatch_only:
NPU: npu_convolution_double_backward
- func: npu_conv2d(Tensor input, Tensor weight, Tensor? bias, int[] stride, int[] padding, int[] dilation, int groups) -> Tensor
npu_dispatch_only:
NPU: conv2d_npu
@@ -1179,34 +1193,30 @@
dispatch:
CPU: cummax_helper_cpu
CUDA: cummax_helper_cuda
npu_dispatch:
NPU: cummax_helper_npu
- func: cummin(Tensor self, int dim) -> (Tensor values, Tensor indices)
supports_named_tensor: True
variants: function, method
npu_dispatch:
NPU: cummin_npu
- func: cummin.out(Tensor self, int dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)
supports_named_tensor: True
npu_dispatch:
NPU: cummin_out_npu
- func: cummin.dimname(Tensor self, Dimname dim) -> (Tensor values, Tensor indices)
supports_named_tensor: True
variants: function, method
npu_dispatch:
NPU: cummin_npu
- func: cummin.dimname_out(Tensor self, Dimname dim, *, Tensor(a!) values, Tensor(b!) indices) -> (Tensor(a!) values, Tensor(b!) indices)
supports_named_tensor: True
npu_dispatch:
NPU: cummin_out_npu
- func: _cummin_helper(Tensor self, Tensor(a!) values, Tensor(b!) indices, int dim) -> ()
variants: function
dispatch:
CPU: cummin_helper_cpu
CUDA: cummin_helper_cuda
npu_dispatch:
NPU: cummin_helper_npu
- func: cumprod(Tensor self, int dim, *, ScalarType? dtype=None) -> Tensor
supports_named_tensor: True
@@ -1508,6 +1518,8 @@
use_c10_dispatcher: full
supports_named_tensor: True
variants: function, method
npu_dispatch:
NPU: erfc_npu
- func: erfc_(Tensor(a!) self) -> Tensor(a!)
supports_named_tensor: True
@@ -1515,12 +1527,16 @@
dispatch:
CPU: _erfc__cpu
CUDA: _erfc__cuda
npu_dispatch:
NPU: erfc_npu_
- func: erfc.out(Tensor self, *, Tensor(a!) out) -> Tensor(a!)
supports_named_tensor: True
dispatch:
CPU: _erfc_out_cpu
CUDA: _erfc_out_cuda
npu_dispatch:
NPU: erfc_out_npu
- func: exp(Tensor self) -> Tensor
use_c10_dispatcher: full
@@ -2627,14 +2643,20 @@
- func: batch_norm_stats(Tensor input, float eps) -> (Tensor, Tensor)
dispatch:
CUDA: batch_norm_stats_cuda
npu_dispatch:
NPU: batch_norm_stats_npu
- func: batch_norm_elemt(Tensor input, Tensor? weight, Tensor? bias, Tensor mean, Tensor invstd, float eps) -> Tensor
dispatch:
CUDA: batch_norm_elemt_cuda
npu_dispatch:
NPU: batch_norm_elemt_npu
- func: batch_norm_elemt.out(Tensor input, Tensor? weight, Tensor? bias, Tensor mean, Tensor invstd, float eps, *, Tensor(a!) out) -> Tensor(a!)
dispatch:
CUDA: batch_norm_elemt_cuda_out
npu_dispatch:
NPU: batch_norm_elemt_out_npu
# for backward compatibility
- func: batch_norm_gather_stats(Tensor input, Tensor mean, Tensor invstd, Tensor? running_mean, Tensor? running_var, float momentum, float eps, int count) -> (Tensor, Tensor)
@@ -2655,6 +2677,8 @@
- func: batch_norm_backward_reduce(Tensor grad_out, Tensor input, Tensor mean, Tensor invstd, Tensor? weight, bool input_g, bool weight_g, bool bias_g) -> (Tensor, Tensor, Tensor, Tensor)
dispatch:
CUDA: batch_norm_backward_reduce_cuda
npu_dispatch:
NPU: batch_norm_backward_reduce_npu
- 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:
@@ -5154,6 +5178,8 @@
dispatch:
CPU: __lshift__
CUDA: __lshift__
npu_dispatch:
NPU: __lshift___npu
- func: __lshift__.Tensor(Tensor self, Tensor other) -> Tensor
use_c10_dispatcher: full
@@ -5161,18 +5187,24 @@
dispatch:
CPU: __lshift__
CUDA: __lshift__
npu_dispatch:
NPU: __lshift___npu
- func: __ilshift__.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)
variants: method
dispatch:
CPU: __ilshift__
CUDA: __ilshift__
npu_dispatch:
NPU: __iLshift___npu
- func: __ilshift__.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)
variants: method
dispatch:
CPU: __ilshift__
CUDA: __ilshift__
npu_dispatch:
NPU: __iLshift___npu
- func: __rshift__.Scalar(Tensor self, Scalar other) -> Tensor
use_c10_dispatcher: full
@@ -5180,6 +5212,8 @@
dispatch:
CPU: __rshift__
CUDA: __rshift__
npu_dispatch:
NPU: __rshift___npu
- func: __rshift__.Tensor(Tensor self, Tensor other) -> Tensor
use_c10_dispatcher: full
@@ -5187,18 +5221,24 @@
dispatch:
CPU: __rshift__
CUDA: __rshift__
npu_dispatch:
NPU: __rshift___npu
- func: __irshift__.Scalar(Tensor(a!) self, Scalar other) -> Tensor(a!)
variants: method
dispatch:
CPU: __irshift__
CUDA: __irshift__
npu_dispatch:
NPU: __iRshift___npu
- func: __irshift__.Tensor(Tensor(a!) self, Tensor other) -> Tensor(a!)
variants: method
dispatch:
CPU: __irshift__
CUDA: __irshift__
npu_dispatch:
NPU: __iRshift___npu
- func: lgamma_(Tensor(a!) self) -> Tensor(a!)
supports_named_tensor: True
@@ -5442,11 +5482,15 @@
dispatch:
CPU: tril_indices_cpu
CUDA: tril_indices_cuda
npu_dispatch:
NPU: tril_indices_npu
- func: triu_indices(int row, int col, int offset=0, *, ScalarType? dtype=long, Layout? layout=None, Device? device=None, bool? pin_memory=None) -> Tensor
dispatch:
CPU: triu_indices_cpu
CUDA: triu_indices_cuda
npu_dispatch:
NPU: triu_indices_npu
- func: trace(Tensor self) -> Tensor
use_c10_dispatcher: full
@@ -5856,6 +5900,8 @@
dispatch:
CPU: _triangular_solve_helper_cpu
CUDA: _triangular_solve_helper_cuda
npu_dispatch:
NPU: _triangular_solve_helper_npu
- func: symeig.e(Tensor self, bool eigenvectors=False, bool upper=True, *, Tensor(a!) e, Tensor(b!) V) -> (Tensor(a!) eigenvalues, Tensor(b!) eigenvectors)
@@ -5867,6 +5913,8 @@
dispatch:
CPU: _symeig_helper_cpu
CUDA: _symeig_helper_cuda
npu_dispatch:
NPU: _symeig_helper_npu
- func: eig.e(Tensor self, bool eigenvectors=False, *, Tensor(a!) e, Tensor(b!) v) -> (Tensor(a!) eigenvalues, Tensor(b!) eigenvectors)
dispatch:
@@ -5889,6 +5937,8 @@
dispatch:
CPU: _svd_helper_cpu
CUDA: _svd_helper_cuda
npu_dispatch:
NPU: _svd_helper_npu
- func: cholesky.out(Tensor self, bool upper=False, *, Tensor(a!) out) -> Tensor(a!)
@@ -7118,22 +7168,30 @@
dispatch:
CPU: rrelu_with_noise_out_cpu
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward_out
npu_dispatch:
NPU: rrelu_with_noise_out_npu
- func: rrelu_with_noise(Tensor self, Tensor noise, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor
python_module: nn
dispatch:
CPU: rrelu_with_noise_cpu
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward
npu_dispatch:
NPU: rrelu_with_noise_npu
- func: rrelu_with_noise_backward(Tensor grad_output, Tensor self, Tensor noise, Scalar lower, Scalar upper, bool training, bool self_is_result) -> Tensor
use_c10_dispatcher: full
python_module: nn
npu_dispatch:
NPU: rrelu_with_noise_backward_npu
- func: rrelu_with_noise_(Tensor(a!) self, Tensor noise, Scalar lower=0.125, Scalar upper=0.3333333333333333, bool training=False, Generator? generator=None) -> Tensor(a!)
python_module: nn
dispatch:
CPU: rrelu_with_noise_cpu_
CUDA: legacy::cuda::_thnn_rrelu_with_noise_forward_
npu_dispatch:
NPU: rrelu_with_noise_npu_
- func: softplus.out(Tensor self, Scalar beta=1, Scalar threshold=20, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
@@ -7512,48 +7570,64 @@
dispatch:
CPU: max_unpooling2d_forward_out_cpu
CUDA: max_unpooling2d_forward_out_cuda
npu_dispatch:
NPU: max_unpool2d_out_npu
- func: max_unpool2d(Tensor self, Tensor indices, int[2] output_size) -> Tensor
python_module: nn
dispatch:
CPU: max_unpooling2d_forward_cpu
CUDA: max_unpooling2d_forward_cuda
npu_dispatch:
NPU: max_unpool2d_npu
- func: max_unpool2d_backward.grad_input(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size, *, Tensor(a!) grad_input) -> Tensor(a!)
python_module: nn
dispatch:
CPU: max_unpooling2d_backward_out_cpu
CUDA: max_unpooling2d_backward_out_cuda
npu_dispatch:
NPU: max_unpool2d_backward_out_npu
- func: max_unpool2d_backward(Tensor grad_output, Tensor self, Tensor indices, int[2] output_size) -> Tensor
python_module: nn
dispatch:
CPU: max_unpooling2d_backward_cpu
CUDA: max_unpooling2d_backward_cuda
npu_dispatch:
NPU: max_unpool2d_backward_npu
- func: max_unpool3d.out(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
dispatch:
CPU: max_unpooling3d_forward_out_cpu
CUDA: max_unpooling3d_forward_out_cuda
npu_dispatch:
NPU: max_unpool3d_out_npu
- func: max_unpool3d(Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
python_module: nn
dispatch:
CPU: max_unpooling3d_forward_cpu
CUDA: max_unpooling3d_forward_cuda
npu_dispatch:
NPU: max_unpool3d_npu
- func: max_unpool3d_backward.grad_input(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding, *, Tensor(a!) grad_input) -> Tensor(a!)
python_module: nn
dispatch:
CPU: max_unpooling3d_backward_out_cpu
CUDA: max_unpooling3d_backward_out_cuda
npu_dispatch:
NPU: max_unpool3d_backward_out_npu
- func: max_unpool3d_backward(Tensor grad_output, Tensor self, Tensor indices, int[3] output_size, int[3] stride, int[3] padding) -> Tensor
python_module: nn
dispatch:
CPU: max_unpooling3d_backward_cpu
CUDA: max_unpooling3d_backward_cuda
npu_dispatch:
NPU: max_unpool3d_backward_npu
- func: reflection_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
@@ -7600,12 +7674,16 @@
dispatch:
CPU: reflection_pad2d_backward_out_cpu
CUDA: reflection_pad2d_backward_out_cuda
npu_dispatch:
NPU: reflection_pad2d_backward_out_npu
- func: reflection_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
python_module: nn
dispatch:
CPU: reflection_pad2d_backward_cpu
CUDA: reflection_pad2d_backward_cuda
npu_dispatch:
NPU: reflection_pad2d_backward_npu
- func: replication_pad1d.out(Tensor self, int[2] padding, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
@@ -7652,12 +7730,16 @@
dispatch:
CPU: replication_pad2d_backward_out_cpu
CUDA: replication_pad2d_backward_out_cuda
npu_dispatch:
NPU: replication_pad2d_backward_out_npu
- func: replication_pad2d_backward(Tensor grad_output, Tensor self, int[4] padding) -> Tensor
python_module: nn
dispatch:
CPU: replication_pad2d_backward_cpu
CUDA: replication_pad2d_backward_cuda
npu_dispatch:
NPU: replication_pad2d_backward_npu
- func: replication_pad3d.out(Tensor self, int[6] padding, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
@@ -8090,19 +8172,27 @@
- func: slow_conv3d.out(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias=None, int[3] stride=1, int[3] padding=0, *, Tensor(a!) out) -> Tensor(a!)
python_module: nn
npu_dispatch:
NPU: slow_conv3d_out_npu
- func: slow_conv3d(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias=None, int[3] stride=1, int[3] padding=0) -> Tensor
python_module: nn
npu_dispatch:
NPU: slow_conv3d_npu
- func: slow_conv3d_forward.output(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias, int[3] stride, int[3] padding, *, Tensor(a!) output, Tensor(b!) finput, Tensor(c!) fgrad_input) -> (Tensor(a!), Tensor(b!), Tensor(c!))
python_module: nn
dispatch:
CPU: slow_conv3d_forward_out_cpu
npu_dispatch:
NPU: slow_conv3d_forward_out_npu
- func: slow_conv3d_forward(Tensor self, Tensor weight, int[3] kernel_size, Tensor? bias, int[3] stride, int[3] padding) -> (Tensor output, Tensor finput, Tensor fgrad_input)
python_module: nn
dispatch:
CPU: slow_conv3d_forward_cpu
npu_dispatch:
NPU: slow_conv3d_forward_npu
- func: slow_conv3d_backward.grad_input(Tensor grad_output, Tensor self, Tensor weight, int[3] kernel_size, int[3] stride, int[3] padding, Tensor finput, Tensor fgrad_input, *, Tensor(a!)? grad_input, Tensor(b!)? grad_weight, Tensor(c!)? grad_bias) -> (Tensor(a!), Tensor(b!), Tensor(c!))
python_module: nn
@@ -8268,7 +8358,7 @@
npu_dispatch_only:
NPU: dtype_cast_npu_
- func: npu_roi_alignbk(Tensor self, Tensor rois, int[] xdiff_shape, int pooled_width, int pooled_height, float spatial_scale, int sample_num) -> Tensor
- func: npu_roi_alignbk(Tensor self, Tensor rois, int[] xdiff_shape, int pooled_width, int pooled_height, float spatial_scale, int sample_num, int? roi_end_mode=None) -> Tensor
variants: function, method
npu_dispatch_only:
NPU: roi_align_backward_npu
@@ -8414,12 +8504,12 @@
npu_dispatch_only:
NPU: dropout_backward_npu
- func: npu_indexing(Tensor self, int[] begin, int[] end, int[] strides) -> Tensor
- func: npu_indexing(Tensor self, int[] begin, int[] end, int[] strides, int begin_mask=0, int end_mask=0, int ellipsis_mask=0, int new_axis_mask=0, int shrink_axis_mask=0) -> Tensor
variants: function, method
npu_dispatch_only:
NPU: indexing_npu
- func: npu_indexing.out(Tensor self, int[] begin, int[] end, int[] strides, *, Tensor(a!) out) -> Tensor(a!)
- func: npu_indexing.out(Tensor self, int[] begin, int[] end, int[] strides, int begin_mask=0, int end_mask=0, int ellipsis_mask=0, int new_axis_mask=0, int shrink_axis_mask=0, *, Tensor(a!) out) -> Tensor(a!)
npu_dispatch_only:
NPU: indexing_out_npu
@@ -8548,4 +8638,12 @@
- 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!))
npu_dispatch_only:
NPU: bert_apply_adam_npu
NPU: bert_apply_adam_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
- func: npu_giou_backward(Tensor grad, Tensor bboxes, Tensor gtboxes, bool trans=False, bool is_cross=False, int mode=0) -> (Tensor, Tensor)
npu_dispatch_only:
NPU: giou_backward_npu

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