Compare commits

...
Author SHA1 Message Date
weili10 774baebe55 !2796 [Fix]Make npu_deformable_conv2d running with fp32.
Merge pull request !2796 from 王晓/deformable_to_fp32_1.8_dev_1
2023-03-31 13:11:56 +00:00
wangxiao 287579ada1 Make npu_deformable_conv2d running with fp32. 2023-03-30 16:23:17 +08:00
weili10 131dd9aae8 !2623 Make DeformableOffsets running with fp32.
Merge pull request !2623 from 王晓/deformable_to_fp32_1.8_dev
2023-03-16 06:47:34 +00:00
wangxiao d2f35b9777 Make DeformableOffsets running with fp32. 2023-03-15 18:10:40 +08:00
weili10 30160ae4de !2568 Enable the SigmoidCrossEntropyWithLogitsGradV2 operator to support the function of setting pos_weight or weight to an integer.
Merge pull request !2568 from 郑亚金/v1.8.1-3.0.0-dev_zyj_0313_sigmode
2023-03-13 13:48:08 +00:00
郑亚金 c719415fef Make SigmoidCrossEntropyWithLogitsGradV2 support when pos_weight is integer. 2023-03-13 20:03:51 +08:00
weili10 ddf5b83206 !2556 Make SigmoidCrossEntropyWithLogitsV2 support when pos_weight is integer.
Merge pull request !2556 from 郑亚金/v1.8.1-3.0.0-dev_zyj_sigmoid_0311
2023-03-11 14:26:01 +00:00
郑亚金 26911511de Make SigmoidCrossEntropyWithLogitsV2 support when pos_weight is integer. 2023-03-11 21:07:11 +08:00
weili10 6e5dbc57ca !2537 Make reciprocal support Integer.
Merge pull request !2537 from 郑亚金/v1.8.1-3.0.0-dev_reciprocal
2023-03-09 13:54:58 +00:00
郑亚金 ba1931a441 Make reciprocal support integer. 2023-03-09 19:53:57 +08:00
weili10 431e636e9e !2506 [Feature] Enable binary by default.
Merge pull request !2506 from 王强/v1.8.1-3.0.0-dev
2023-03-03 09:52:00 +00:00
wq160 3e91839843 [Feature] Enable binary by default. 2023-03-03 17:11:41 +08:00
weili10 4850443eba !2504 [Feature] Modify the default value of the TASK_QUEUE_ENABLE
Merge pull request !2504 from 詹昊/v1.8.1-3.0.0-dev
2023-03-03 08:39:54 +00:00
zhanhao e29e5dd9b9 Modify the default value of the TASK_QUEUE_ENABLE 2023-03-03 16:27:44 +08:00
i-robot 660da0e85d !2482 [BugFix]Full operation fill with dtype inferred from fill_value.
Merge pull request !2482 from 邵非凡/full-1.8-3.0.0
2023-03-02 03:32:47 +00:00
邵非凡 f420148b77 Full operation fill with dtype inferred from fill_value. 2023-03-01 16:16:39 +08:00
i-robot e50c34dfea !2440 [bugfix] Add dtype cast when input dtype is int64, because the OneHot cann't support it.
Merge pull request !2440 from 郭夏/onehot_1.8.1-3.0
2023-02-28 07:19:42 +00:00
i-robot aad0b4de4e !2388 【bugfix】Support the param out is a slice of other tensor, in max.
Merge pull request !2388 from 郭夏/max_out
2023-02-27 06:40:26 +00:00
郭夏 8e33c02f0f [bugfix] Add dtype cast when input dtype is int64, because the OneHot cann't support it.
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2023-02-27 11:37:13 +08:00
i-robot 92322edbc4 !2398 [BugFix] Fix embedding_bag in 0D scenario.
Merge pull request !2398 from 戢芳/embedding1.8_3.0
2023-02-27 01:24:40 +00:00
i-robot d8bc3ab390 !2363 [Fix] Update version 3.0.0 ReleaseNote .
Merge pull request !2363 from 彭子荣/v1.8.1-3.0.0
2023-02-23 12:36:57 +00:00
i-robot 4303b8e77f !2418 [bugfix] Fix uniform kernel error.
Merge pull request !2418 from will-devil/bf183dev
2023-02-23 12:30:31 +00:00
wangyicheng c01fcce508 Fix uniform kernel error. 2023-02-23 17:19:29 +08:00
i-robot 3694f59418 !2386 [bugfix] Fix uniform kernel forward error.
Merge pull request !2386 from will-devil/183dev
2023-02-22 07:36:16 +00:00
郭夏 2fa5dc6b0b 【bugfix】Support the param out is a slice of other tensor, in max.
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2023-02-22 13:26:56 +08:00
pipihugh 883d7e923e Fix embedding_bag in 0D scenario. 2023-02-22 11:12:56 +08:00
wangyicheng 20750f0a9a Fix uniform kernel forward error. 2023-02-21 10:08:24 +08:00
i-robot 2eaf9d2944 !2294 Fix input device for get_rng_state and set_rng_state.
Merge pull request !2294 from shaoyf/fix/181_300_rng_state
2023-02-17 09:06:54 +00:00
pengzirong 7c67039927 更新3.0.0版本RELEASENOTE 2023-02-17 17:00:50 +08:00
i-robot 0488caf153 !2314 [Fix] Fix the deadlock in taskqueue
Merge pull request !2314 from 詹昊/v1.8.1-3.0.0
2023-02-16 08:51:52 +00:00
zhanhao 89c6412295 Fix the deadlock in taskqueue 2023-02-15 15:38:34 +08:00
i-robot c5ac2f45a9 !2303 [Fix]Fix the input tensor src_stride under aicore mode.
Merge pull request !2303 from 於欣洁/v1.8.1-3.0.0_vc0213
2023-02-14 02:04:28 +00:00
weili10 4ea5135d4d update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-02-13 13:25:54 +00:00
yuxinjie 50d3504b51 Fix the input tensor src_stride under aicore mode. 2023-02-13 20:23:06 +08:00
i-robot 046244ed74 !2284 [Fix] Fix no attribute python_exit_status.
Merge pull request !2284 from 龚俊强/v1.8.1-3.0.0
2023-02-13 08:25:05 +00:00
shaoyf 1cb32e90a7 Fix input device for get_rng_state and set_rng_state. 2023-02-13 15:39:11 +08:00
junqiang521 dc1ef0eb00 Master version upgrade, update _shutdown_workers 2023-02-13 14:55:21 +08:00
i-robot caf9a961a6 !2269 Fix output shape of lstm_backward.
Merge pull request !2269 from 郑亚金/v1.8.1-3.0.0_zyj_lstm_0209
2023-02-11 09:10:55 +00:00
郑亚金 746688c5be Fix output shape of lstm_backward. 2023-02-11 16:00:36 +08:00
i-robot e03782361b !2279 [Fix] fix isinstance bug in transfer_to_npu tools
Merge pull request !2279 from 施博/instance_v18_3
2023-02-10 11:30:50 +00:00
i-robot ef1793c9e2 !2275 [Fix] fix device constructor bug
Merge pull request !2275 from 施博/fix_device_assert_v18_3
2023-02-10 09:52:09 +00:00
shibo19 e8697157a2 fix isinstance bug in transfer_to_npu tools 2023-02-10 17:27:45 +08:00
i-robot b2e048fc97 !2205 [Feature] Add NpuPreGenDropout feature
Merge pull request !2205 from 宁振江/v1.8.1-3.0.0
2023-02-10 08:59:02 +00:00
shibo19 f65d54dcfa fix device constructor bug 2023-02-10 16:47:34 +08:00
ningzhenjiang 2df89a8d08 Add NpuPreGenDropout feature 2023-02-10 14:58:35 +08:00
i-robot 34ac9dfd52 !2254 Add Attr of Swish.
Merge pull request !2254 from 戢芳/swish1.8
2023-02-10 03:23:42 +00:00
i-robot 5e8296002d !2257 Fix clamp in int64 scenario.
Merge pull request !2257 from 戢芳/clamp1.8
2023-02-10 03:21:20 +00:00
i-robot e5da392470 !2264 Correct the output dtype of pow.
Merge pull request !2264 from 郑亚金/v1.8.1-3.0.0_zyj_pow_0209
2023-02-10 02:55:48 +00:00
i-robot a3ecdfba7a !2250 [Fix] parameter parsing error when 'device=None'.
Merge pull request !2250 from 杜金航/v1.8.1-3.0.0
2023-02-09 12:37:51 +00:00
郑亚金 058c855e48 Correct the output dtype of pow. 2023-02-09 16:04:06 +08:00
pipihugh 0edce2564c Fix clamp in int64 scenario. 2023-02-09 10:50:40 +08:00
pipihugh efa59b2200 Add Attr of Swish. 2023-02-09 09:41:38 +08:00
dujinhang c95745e790 [Fix] parameter parsing error when 'device=None'. 2023-02-08 17:32:42 +08:00
i-robot bdf3d95bd6 !2208 Torch.load supports npu tensor load to cpu.
Merge pull request !2208 from 闫鹏全/v1.8.1-3.0.0
2023-02-07 15:39:33 +00:00
闫鹏全 735eace090 Merge branch.
Signed-off-by: 闫鹏全 <yanpengquan@huawei.com>
2023-02-07 14:27:59 +00:00
i-robot 5a26719308 !2246 [Fix] Fix device class bug
Merge pull request !2246 from 施博/fix_device_assert_v18_3
2023-02-07 13:53:25 +00:00
shibo19 3633a172e7 fix device class bug 2023-02-07 20:28:19 +08:00
i-robot 9df30bd765 !2239 Strengthen index operator verification.
Merge pull request !2239 from 刘哲续/v1.8.1-3.0.0
2023-02-07 12:04:50 +00:00
刘哲续 8ff2d0947d Strengthen index operator verification. 2023-02-07 17:25:46 +08:00
闫鹏全 524f6a9663 Torch.load supports npu tensor load to cpu. 2023-02-07 17:11:34 +08:00
i-robot 5bf3c1722a !2206 [Fix] Fix bug in storage_resize_npu.
Merge pull request !2206 from 刘嘉巍/v1.8.1-3.0.0
2023-02-07 08:43:16 +00:00
i-robot d9a7fc180a !2233 [Fix] Fix instance assert bug for torch_npu._C.device
Merge pull request !2233 from 施博/fix_device_assert_v18_3
2023-02-07 06:43:44 +00:00
shibo19 24d1c22e18 fix assert for torch_npu._C.device 2023-02-07 11:06:24 +08:00
i-robot f06123b41a !2229 FusedColorjitter moving the position of the import pillow avoids the problem of dependencies when importing torch_npu
Merge pull request !2229 from 王姜奔/v1.8.1-3.0.0
2023-02-06 13:37:16 +00:00
王姜奔 0562c43fcc Moving the position of the import pillow avoids the problem of dependencies when importing torch_npu
Signed-off-by: 王姜奔 <wangjiangben@huawei.com>
2023-02-06 11:45:46 +00:00
i-robot 0ddf5e6ebc !2223 [Fix] Fix device type bug in serialization
Merge pull request !2223 from 施博/fix_device_v3.0
2023-02-06 06:24:23 +00:00
shibo19 41a0d2e918 fix device type bug in serialization 2023-02-06 10:19:11 +08:00
i-robot 10086fd264 !2190 Restore the adaptation of fill_.
Merge pull request !2190 from 戢芳/fill1.8_3.0
2023-02-06 01:08:22 +00:00
i-robot a3c056fa5d !2196 [Fix] Taskqueue add memory barrier.
Merge pull request !2196 from 詹昊/v1.8.1-3.0.0
2023-02-04 03:45:16 +00:00
i-robot 3178fd9561 !2173 [Fix] Add class "Device" for torch_npu
Merge pull request !2173 from 施博/fix_device_18
2023-02-03 08:02:11 +00:00
施博 3142dcecea Merge branch 'v1.8.1-3.0.0' of gitee.com:ascend/pytorch into fix_device_18
Signed-off-by: 施博 <shibo19@huawei.com>
2023-02-02 09:22:57 +00:00
shibo19 fa2157ce49 Add class "Device" for torch_npu 2023-02-02 17:22:16 +08:00
pipihugh 2a0c8f1196 Restore the adaptation of fill_. 2023-02-02 16:32:38 +08:00
zhanhao 05050c7e6b Taskqueue add memory barrier 2023-02-02 16:18:46 +08:00
刘嘉巍 e7bf9e6a1c Fix bug in storage_resize_npu 2023-02-02 16:15:08 +08:00
weili10 1b95bdcdd3 update cann version.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-30 13:21:18 +00:00
weili10 b084d6df58 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-19 08:15:15 +00:00
weili10 db8edc442d update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-19 07:57:08 +00:00
weili10 109ca03752 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2023-01-19 07:56:01 +00:00
i-robot 6ce98a9a92 !2130 Modify the default value of the TASK_QUEUE_ENABLE.
Merge pull request !2130 from shaoyf/181_300/task_queue
2023-01-14 11:37:10 +00:00
shaoyf 31709876be Modify the default value of the TASK_QUEUE_ENABLE. 2023-01-14 19:00:50 +08:00
weili10 c62ab664a5 !2121 [Fix] Modify syncbn to the original implementation.
Merge pull request !2121 from shaoyf/bugfix/syncbn
2023-01-13 10:03:13 +00:00
shaoyf 533e520179 Modify syncbn to the original implementation. 2023-01-13 17:01:00 +08:00
i-robot 586cf41a3f !2116 [Fix] Fixed npu device not torch.device type issue.
Merge pull request !2116 from 杜金航/v1.8.1-3.0.0
2023-01-12 14:24:12 +00:00
dujinhang 0ee3963ed6 [Fix] Fixed npu device not torch.device type issue. 2023-01-12 22:07:52 +08:00
i-robot c06919b836 !2109 [perf] topk optimize
Merge pull request !2109 from yangxiaorun/cherry-pick-1673493339
2023-01-12 11:39:13 +00:00
yangxiaorun 8615ed3b4f fixed e2603be from https://gitee.com/yangxiaorun1/pytorch/pulls/2107
perf: topk perf optimize
2023-01-12 03:15:39 +00:00
i-robot 37080cf443 !2104 Modify mv to adapt MatMul's ND case.
Merge pull request !2104 from 王晓/mv_nd_1.8_3.0.0
2023-01-11 15:51:59 +00:00
wangxiao c78232d2c0 Modify mv and npu_linear to adapt MatMul's nd case. 2023-01-11 22:28:17 +08:00
i-robot d16be41674 !1972 [Refactor]Simplify the usage of accuracy comparison tool.
Merge pull request !1972 from 杜金航/v1.8.1-3.0.0
2023-01-11 03:27:18 +00:00
i-robot 630723267c !2082 [Fix] Update op list for AOE dump.
Merge pull request !2082 from 施博/aoe_v1.8
2023-01-10 08:34:15 +00:00
i-robot 795b968518 !2096 Migrate checkpoint feature to 1.8.1-3.0.0 branch
Merge pull request !2096 from hanjun/v1.8.1-3.0.0
2023-01-10 03:10:16 +00:00
h00558267 2757d5e475 Migrate checkpoint feature to 1.8.1-3.0.0 branch 2023-01-10 10:37:13 +08:00
i-robot 318739a04d !2072 [Feature] Add backward function of npu_convolution_backward.
Merge pull request !2072 from 郭夏/v1.8.1-3.0.0
2023-01-09 12:55:30 +00:00
i-robot 3131cd3e3d !2087 [Fix]Fix silu inplace backward.
Merge pull request !2087 from 王晓/silu_1.8_3.0.0
2023-01-09 12:18:38 +00:00
i-robot c5e9f8a65d !2083 [Fix] Add attr of GatherV2.
Merge pull request !2083 from 戢芳/gather3.0
2023-01-09 12:17:58 +00:00
wangxiao bf96de52ce Fix silu inplace backward. 2023-01-09 19:16:58 +08:00
郭夏 3d00ccb838 [Feature] Add backward function of npu_convolution_backward.
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2023-01-09 18:48:21 +08:00
shibo19 0958ececf5 Update op list for AOE dump 2023-01-09 17:19:31 +08:00
pipihugh dca1a1e942 Add attr of GatherV2. 2023-01-09 13:39:15 +08:00
i-robot 6c2dc57411 !2064 [BugFix] Adjust the index adaptation logic.
Merge pull request !2064 from 刘哲续/v1.8.1-3.0.0
2023-01-08 08:33:43 +00:00
刘哲续 5bd3a895e9 Adjust the index adaptation logic. 2023-01-07 22:11:31 +08:00
i-robot e7328150c8 !2079 [Fix] Output int32 When the input of sum is int or bool.
Merge pull request !2079 from 戢芳/sum3.0
2023-01-07 12:57:11 +00:00
pipihugh 32a5b98293 Output int32 When the input of sum is int or bool. 2023-01-07 14:40:58 +08:00
i-robot bceda430c8 !2065 [Fix] Fix the problem of cnt can not be 0.
Merge pull request !2065 from 詹昊/v1.8.1-3.0.0
2023-01-06 09:57:36 +00:00
zhanhao 9edb9058f0 Fix the problem of cnt can not be 0. 2023-01-06 17:10:06 +08:00
i-robot 4e7e9da29c !2052 [Feature] Add adapters of tril_indices and triu_indices.
Merge pull request !2052 from 戢芳/triu_indices3.0
2023-01-06 03:45:30 +00:00
dujinhang d7d201d251 [Synchronize]Simplify the usage of accuracy comparison tool. 2023-01-06 11:44:48 +08:00
i-robot 95e9590880 !2058 IndexPut support 1D broadcast case
Merge pull request !2058 from 王晓歆/indexput_new_shang
2023-01-05 13:47:43 +00:00
i-robot 68897be92e !2053 Reduce Transpose calls of npu_deformable_conv2d.
Merge pull request !2053 from 王晓/nhwc_fix_v2_3.0.0
2023-01-05 13:37:59 +00:00
i-robot 6c9cce4cb8 !2044 [Fix] Adjust the Index adaptation logic.
Merge pull request !2044 from 刘哲续/v1.8.1-3.0.0
2023-01-05 13:35:19 +00:00
i-robot 6adf15d1dd !2048 [bugfix] Modify InferShapeofNHWC.
Merge pull request !2048 from will-devil/shapedev2
2023-01-05 13:31:49 +00:00
wangxiaoxin_sherie 1424ab9c91 indexput support 1D broadcast case 2023-01-05 21:03:51 +08:00
刘哲续 0a25bdb394 Adjust the Index adaptation logic. 2023-01-05 20:08:32 +08:00
wangyicheng a60114d389 Modify InferShapeofNHWC. 2023-01-05 19:52:38 +08:00
i-robot 8fbcaa2542 !2055 [Cleancode] Clean code for all.
Merge pull request !2055 from shaoyf/cleancode/181_300
2023-01-05 11:44:27 +00:00
i-robot 2c4dd2a28e !2040 Fix hardsigmoid_ and add corresponding cases.
Merge pull request !2040 from 戢芳/hardsigmoid3.0
2023-01-05 11:22:13 +00:00
pipihugh 9ff2ac83a7 Add adapters of tril_indices and triu_indices. 2023-01-05 13:55:14 +08:00
shaoyf a8ed592d30 Clean code for all. 2023-01-05 13:46:45 +08:00
wangxiao f3953ad39f Reduce Transpose calls of npu_deformable_conv2d. 2023-01-05 10:36:03 +08:00
i-robot 558385f933 !2023 [Fix]Add flag in read and write queue.
Merge pull request !2023 from 詹昊/v1.8.1-3.0.0
2023-01-05 02:25:38 +00:00
i-robot 5931ccc0e0 !2043 [Fix] Fix new_zeros and new_empty without args.
Merge pull request !2043 from shaoyf/cherry-pick-1672831738
2023-01-04 12:29:25 +00:00
zhanhao 510d4e38bf Add flag in read and write queue. 2023-01-04 20:18:03 +08:00
shaoyf abe3638940 fixed ac8cade from https://gitee.com/shaoyf/pytorch/pulls/2035
Fix new_zeros and new_empty without args.
2023-01-04 11:28:59 +00:00
i-robot 4276d15246 !2038 [Fix]IndexPut unsupport bool incomplete axis
Merge pull request !2038 from 王晓歆/indexput_new_shang
2023-01-04 11:28:27 +00:00
pipihugh 68e6904aad Fix hardsigmoid_ and add corresponding cases. 2023-01-04 16:21:17 +08:00
wangxiaoxin_sherie c1b685ec15 Intercept bool non full axis case. 2023-01-04 15:55:34 +08:00
i-robot ae3acfa89c !2003 [bugfix] Set gate order of LSTM to ifjo, same as CPU's.
Merge pull request !2003 from 郭夏/lstm
2023-01-03 08:38:20 +00:00
weili10 905556dc1f !2012 Use ND as default format in MatMul
Merge pull request !2012 from weili10/revert-merge-1909-v1.8.1-3.0.0
2022-12-30 11:14:29 +00:00
weili10 b97f3d4125 回退 'Pull Request !1909 : [fix] revert cast ND in Matmul' 2022-12-30 10:17:13 +00:00
i-robot dd1a210f0b !1981 [Fix] Syncbn support input shape (N,C,+)
Merge pull request !1981 from huangxinliang/v1.8.1-3.0.0
2022-12-30 06:15:53 +00:00
xinlianglalala 1f17bd7b31 Do reshape to support ND format 2022-12-30 12:10:00 +08:00
郭夏 c837ed95f9 [bugfix]Set gate order of LSTM to ifjo, same as CPU's.
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-12-30 03:24:05 +00:00
i-robot c4718c766a !1975 Call Transpose explicitly in adapter of deformable_conv2d.
Merge pull request !1975 from 王晓/deformable_conv_nhwc2_3.0.0
2022-12-29 13:23:37 +00:00
i-robot 2d9d2c3954 !1997 Fix layer_norm shape error.
Merge pull request !1997 from 王晓/ln_resize_3.0.0
2022-12-29 09:06:27 +00:00
wangxiao bde8b65340 Fix layer_norm shape error. 2022-12-29 13:35:28 +08:00
i-robot 4bc8ff49b0 !1991 Fix compilation errors when the version.py file exists.
Merge pull request !1991 from 闫鹏全/v1.8.1-3.0.0
2022-12-27 13:51:04 +00:00
i-robot 4971b7b495 !1984 Index/IndexPut aicore operator adaptation.
Merge pull request !1984 from 王晓歆/indexput_shang
2022-12-27 13:04:32 +00:00
i-robot 4ef294bcc1 !1980 [BugFix] Correct the output shape of lstm_backward.
Merge pull request !1980 from 戢芳/lstm3.0
2022-12-27 10:19:03 +00:00
闫鹏全 4c32e388f8 Fix compilation errors when the version.py file exists. 2022-12-27 14:31:53 +08:00
i-robot 6a17bae281 !1977 [Fix] Only warning once when running unsupported kernel.
Merge pull request !1977 from 刘嘉巍/v1.8.1-3.0.0
2022-12-26 12:47:15 +00:00
wangxiaoxin_sherie 14996a93fc Add Index/IndexPut aicore adpater. 2022-12-26 19:19:19 +08:00
liu-jiaweikf 9fc040820b Warning only once 2022-12-26 18:02:49 +08:00
i-robot c78f539229 !1974 [BugFix] Fix the error of median and fill_.
Merge pull request !1974 from 戢芳/median3.0
2022-12-26 06:46:28 +00:00
pipihugh efd072dbb8 Correct the output shape of lstm_backward. 2022-12-26 13:55:09 +08:00
wangxiao f0a7a317d7 Call Transpose explicitly in adapter of deformable_conv2d. 2022-12-24 17:37:45 +08:00
weili10 deaf49c0f0 update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-23 11:55:52 +00:00
pipihugh 4dd75516a2 Fix the error of median and fill_. 2022-12-23 09:43:55 +08:00
i-robot c53382e05a !1971 [feature] memcpy async enqueue
Merge pull request !1971 from 王强/v1.8.1-3.0.0
2022-12-23 00:56:42 +00:00
i-robot 33fe989f66 !1958 Update the version number of the branch.
Merge pull request !1958 from 闫鹏全/v1.8.1-3.0.0
2022-12-22 13:12:25 +00:00
i-robot 7d42332443 !1969 [BugFix] Support npu:x format for Tensor.npu
Merge pull request !1969 from shaoyf/bugfix/npu_1.8.1-3.0.0
2022-12-22 13:11:27 +00:00
i-robot 32de06a915 !1900 Modify the framework of Viewcopy.
Merge pull request !1900 from 於欣洁/v1.8.1-3.0.0
2022-12-22 10:40:48 +00:00
x00430237 246a84e3fc [feature] memcpy async enqueue 2022-12-22 18:21:42 +08:00
shaoyf 58f18b5294 [BugFix] Support None for Tensor.npu. 2022-12-22 09:16:32 +00:00
闫鹏全 6d181d7004 Update the version number of the branch. 2022-12-22 16:33:37 +08:00
weili10 fa7a9e758d update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-21 12:48:17 +00:00
i-robot b02893d253 !1951 [Fix] Modify the default device of as_tensor.
Merge pull request !1951 from shaoyf/cherry-pick-1671537648
2022-12-21 04:05:03 +00:00
shaoyf 8a18825d2b fixed 0b5ebb4 from https://gitee.com/shaoyf/pytorch/pulls/1950
[Fix] Modify the default device of as_tensor.
2022-12-20 12:00:48 +00:00
i-robot a388e6de95 !1944 [BugFix] Fix the accuracy problem of nllloss2d.
Merge pull request !1944 from 戢芳/nllloss3.0
2022-12-20 03:51:04 +00:00
pipihugh 3fb8100078 Fix the accuracy problem of nllloss2d. 2022-12-20 09:18:15 +08:00
i-robot 1917d214e1 !1943 [Fix]: Modify error msg in HCCL op.
Merge pull request !1943 from 施博/hccl_error_v1.8
2022-12-19 12:32:16 +00:00
shibo19 28d2812ebf Fix: modify error msg in HCCL op 2022-12-19 20:27:43 +08:00
i-robot 2eefe1f1b0 !1938 Synchronize accuracy comparison and overflow detection tools to v1.8.1-3.0.0
Merge pull request !1938 from 杜金航/v1.8.1-3.0.0
2022-12-19 12:07:56 +00:00
i-robot ab8b1916bf !1941 [Fix] Fix bug in indexing contiguous operation.
Merge pull request !1941 from 刘嘉巍/v1.8.1-3.0.0
2022-12-19 11:32:19 +00:00
刘嘉巍 9e27f353fa Fix bug in indexing_opt 2022-12-19 16:30:35 +08:00
dujinhang e763367d81 Synchronize master to v1.8.1-3.0.0 2022-12-19 16:11:37 +08:00
i-robot 1986ba362e !1932 [Fix] revert 'Pull Request !1930 : Add Index/IndexPut Adaptation'
Merge pull request !1932 from weili10/revert-merge-1930-v1.8.1-3.0.0
2022-12-18 13:26:18 +00:00
weili10 92c00609f1 Modify the default value of the TASK_QUEUE_ENABLE
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-18 13:15:26 +00:00
weili10 61daeb2ec0 回退 'Pull Request !1930 : Add Index/IndexPut Adaptation' 2022-12-18 13:04:25 +00:00
i-robot a25a3f18ff !1930 Add Index/IndexPut Adaptation
Merge pull request !1930 from 赖长铃/index_indexput_c84
2022-12-17 15:41:58 +00:00
cling e5d06ab18a add index/indexput aicore kernel 2022-12-17 21:29:56 +08:00
i-robot 5e10771032 !1928 Add exclude aicore engine of viewcopy.
Merge pull request !1928 from 於欣洁/v1.8.1-3.0.0
2022-12-17 13:29:46 +00:00
i-robot e42a5e79f0 !1926 [BugFix] Correct the output shape of layer_norm_eval.
Merge pull request !1926 from 戢芳/layer_norm3.0
2022-12-17 11:23:58 +00:00
yuxinjie f3f9aec20f Add exclude aicore engine of viewcopy. 2022-12-17 19:11:43 +08:00
pipihugh 61972e558a Correct the output shape of layer_norm_eval. 2022-12-17 18:11:07 +08:00
i-robot 58bb15db8d !1923 [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios.
Merge pull request !1923 from 戢芳/bn_trans3.0
2022-12-17 08:35:40 +00:00
pipihugh b4163275eb BatchNorm2d eliminate transdata in binary 5HD scenarios. 2022-12-17 15:35:48 +08:00
yuxinjie b44bcea8db Modify the framework of viewcopy. 2022-12-17 11:57:55 +08:00
i-robot 2aee971f9d !1905 Synchronize master branch: private format rectification
Merge pull request !1905 from 戢芳/format3.0
2022-12-16 11:55:56 +00:00
i-robot e502a7c848 !1919 [Fix] Support torch.npu.FloatTensor for PyTorch installed by wheel(x86_64).
Merge pull request !1919 from shaoyf/cherry-pick-1671174122
2022-12-16 08:26:06 +00:00
i-robot 754cc15934 !1908 [Fix] Modify the error information of libhccl.so.
Merge pull request !1908 from 詹昊/v1.8.1-3.0.0
2022-12-16 07:33:49 +00:00
i-robot d29db7cc67 !1902 change asynchronous copy + stream synchronization to stream synchronization + synchronous copy
Merge pull request !1902 from 刘晶晶/aclrtMemcpy-3.0.0
2022-12-16 07:31:50 +00:00
weili10 7d04486423 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-16 07:27:17 +00:00
i-robot 6dbdc16833 !1915 Revert Index/IndexInput API
Merge pull request !1915 from 刘哲续/v1.8.1-3.0.0
2022-12-16 07:21:46 +00:00
shaoyf 89179e9144 fixed ca5852a from https://gitee.com/shaoyf/pytorch/pulls/1913
Support npu tensor for PyTorch installed by wheel(x86_64)
2022-12-16 07:02:03 +00:00
i-robot a77cbf6e97 !1916 [Fix] revert 'Pull Request !1889 : [Feature] Modify the size of AvgPoolV2Grad to int32'
Merge pull request !1916 from weili10/revert-merge-1889-v1.8.1-3.0.0
2022-12-16 06:53:46 +00:00
weili10 3861938495 回退 'Pull Request !1889 : [Feature] Modify the size of AvgPoolV2Grad to int32' 2022-12-16 06:31:31 +00:00
刘哲续 57321fab56 Revert Index/IndexPut API. 2022-12-16 12:06:00 +08:00
zhanhao 01e7fae8a3 Modify error infomation of libhccl.so 2022-12-16 11:57:03 +08:00
weili10 a0e28b3c66 !1909 [fix] revert cast ND in Matmul
Merge pull request !1909 from weili10/revert-merge-1787-v1.8.1-3.0.0
2022-12-15 16:39:12 +00:00
weili10 15b328eb42 回退 'Pull Request !1787 : ND default on for MatMul' 2022-12-15 16:23:37 +00:00
i-robot eb4004a53d !1904 [Fix]IndexPut reduce constraint
Merge pull request !1904 from 王晓歆/indexput_empty_shang
2022-12-15 15:20:53 +00:00
pipihugh e674440b47 Synchronize master branch: private format rectification. 2022-12-15 21:52:29 +08:00
wangxiaoxin_sherie ceea4fe18f Indexput reduce constraint 2022-12-15 21:50:12 +08:00
i-robot 32df77e9b7 !1892 [SF] Optimize the RepeatInterleave operator adaptation scheme
Merge pull request !1892 from aikede/sf_reInleave
2022-12-15 09:36:55 +00:00
liujingjing 3a82f9463f change asynchronous copy + stream synchronization to stream synchronization + synchronous copy 2022-12-15 15:38:51 +08:00
i-robot 1413e8ae6d !1899 Sync wrap_dtype_for_hccl to the v1.8.1-3.0.0 branch
Merge pull request !1899 from 王姜奔/v1.8.1-3.0.0
2022-12-15 07:02:39 +00:00
王姜奔 8c7f762370 add wrap_dtype_for_hccl 2022-12-15 14:36:11 +08:00
i-robot 2f63c547c4 !1884 [Fix] Optimize release queue.
Merge pull request !1884 from 詹昊/v1.8.1-3.0.0
2022-12-15 02:09:36 +00:00
weili10 46accd209d !1885 Add Index/IndexPut Adaptation.
Merge pull request !1885 from 刘哲续/v1.8.1-3.0.0
2022-12-14 15:47:14 +00:00
刘哲续 749276da5d Add Index/IndexPut Adaptation. 2022-12-14 22:41:28 +08:00
zhanhao ccd7267cee Optimize taskqueue. 2022-12-14 21:40:14 +08:00
i-robot 7dc5159e6d !1894 [Fix] revert 'Pull Request !1842 : [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios'
Merge pull request !1894 from weili10/revert-merge-1842-v1.8.1-3.0.0
2022-12-14 13:14:15 +00:00
aikede 89c499e336 Optimize the RepeatInterleave operator adaptation scheme 2022-12-14 20:56:48 +08:00
i-robot 2bcdf464d4 !1889 [Feature] Modify the size of AvgPoolV2Grad to int32
Merge pull request !1889 from 戢芳/avg_pool2d_grad3.0
2022-12-14 10:30:30 +00:00
weili10 744c908831 回退 'Pull Request !1842 : [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios' 2022-12-14 10:01:03 +00:00
pipihugh 6d681e0002 Modify the size of AvgPoolV2Grad to int32. 2022-12-14 15:51:33 +08:00
i-robot 5c11c8b594 !1882 [fix] revert deformable_conv2d changes
Merge pull request !1882 from weili10/revert-merge-1841-v1.8.1-3.0.0
2022-12-13 15:10:26 +00:00
weili10 184e7af7f9 回退 'Pull Request !1841 : Call Transpose explicitly in adapter of deformable_conv2d.' 2022-12-13 14:46:48 +00:00
i-robot 6baa844d09 !1879 Modified the Usage Guide of the accuracy comparison tool at GPU Scenarios
Merge pull request !1879 from 谭親林/v1.8.1-3.0.0
2022-12-13 14:32:11 +00:00
tanqinlin 63e4905e0d modify usage guide for GPU Scenarios 2022-12-13 22:14:11 +08:00
i-robot 59ada59f12 !1863 [Fix] Optimize log printing in taskqueue.
Merge pull request !1863 from 詹昊/v1.8.1-3.0.0
2022-12-13 14:02:14 +00:00
zhanhao ad159d4008 Add log printing to taskqueue. 2022-12-13 21:17:47 +08:00
i-robot a1ee328dba !1818 Device verification of tensor
Merge pull request !1818 from 王夏夏/v1.8.1-3.0.0
2022-12-13 13:16:29 +00:00
i-robot 45d935d980 !1851 Update Syncbn adapter for mixed precision training (v1.8.1-3.0.0)
Merge pull request !1851 from huangxinliang/v1.8.1-3.0.0
2022-12-13 12:50:31 +00:00
xinlianglalala 4d19446a9c Update Syncbn adapter for mixed precision training 2022-12-13 20:11:03 +08:00
i-robot 41340a0504 !1853 [Fix] Fix the precision error in allgather operator
Merge pull request !1853 from 施博/allgather_v18_3.0
2022-12-13 11:40:13 +00:00
i-robot 56fb98d377 !1854 Revert Index/IndexPut Adaptive logic
Merge pull request !1854 from 刘哲续/v1.8.1-3.0.0
2022-12-13 06:15:52 +00:00
刘哲续 3bf1ddde1b Revert Index/IndexPut adaptive logic. 2022-12-13 11:06:05 +08:00
shibo19 4ef89b5009 Bugfix: Fix the precision error in allgather operator 2022-12-13 10:11:05 +08:00
i-robot 46065dfb91 !1843 [Feature] Basic rectification of batchnorm eliminating transdata
Merge pull request !1843 from 戢芳/weight_3.0
2022-12-12 17:35:49 +00:00
i-robot 9eef5f5a13 !1842 [Feature] BatchNorm2d eliminate transdata in binary 5HD scenarios
Merge pull request !1842 from 戢芳/bn_transdata3.0
2022-12-12 17:33:51 +00:00
i-robot 24d72ba3b5 !1845 回退 'Pull Request !1796 : taskqueue优化'
Merge pull request !1845 from weili10/revert-merge-1796-v1.8.1-3.0.0
2022-12-12 15:55:50 +00:00
pipihugh 6b840a21cd BatchNorm2d eliminate transdata in binary 5HD scenarios. 2022-12-12 23:49:09 +08:00
weili10 805ed0b767 回退 'Pull Request !1796 : taskqueue优化' 2022-12-12 15:43:49 +00:00
i-robot 276a6fd592 !1816 【Feature】 Add the aicore branch of indexput
Merge pull request !1816 from 王晓歆/v1.8.1-3.0.0
2022-12-12 15:26:09 +00:00
i-robot 6dc23bbcb5 !1807 [Feature]Add the aicore branch of index
Merge pull request !1807 from 戢芳/index_aicore3.0
2022-12-12 15:21:50 +00:00
i-robot 0154df7c4c !1841 Call Transpose explicitly in adapter of deformable_conv2d.
Merge pull request !1841 from 王晓/deformable_conv_nhwc_3.0.0
2022-12-12 15:17:49 +00:00
pipihugh 4e4a123868 Basic rectification of batchnorm eliminating transdata. 2022-12-12 23:10:14 +08:00
王晓 e97e5ed2fa Add infershapeofNHWC to formathelper.
Signed-off-by: 王晓 <wangxiao99@huawei.com>
2022-12-12 14:54:33 +00:00
王晓 7d0e020038 Call Transpose explicitly in adapter of deformable_conv2d.
Signed-off-by: 王晓 <wangxiao99@huawei.com>
2022-12-12 14:26:22 +00:00
wangxiaoxin_sherie 57c068062d Add the aicore branch of indexput. 2022-12-12 21:14:20 +08:00
pipihugh 8497afbc67 Add the aicore branch of index. 2022-12-12 20:14:58 +08:00
weili10 50277fc97a update torch_npu/csrc/core/npu/register/OptionsManager.cpp.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-12-12 09:39:41 +00:00
xiaxia3 bd152ae9c9 Add tensor device verification 2022-12-12 10:54:30 +08:00
i-robot 5908caa6c6 !1813 Modify the error information of libhccl.so
Merge pull request !1813 from 詹昊/v1.8.1-3.0.0
2022-12-10 12:54:58 +00:00
zhanhao 39c1373934 Modify the error message reported when libhccl.so cannot be found. 2022-12-10 19:10:57 +08:00
i-robot 1d112602c3 !1787 ND default on for MatMul
Merge pull request !1787 from 唐超/v1.8.1-3.0.0
2022-12-10 09:08:43 +00:00
i-robot e3a6732327 !1809 [Feature] add aclrtCreateStreamWithConfig to create fast streams
Merge pull request !1809 from 王强/v1.8.1-3.0.0
2022-12-10 07:48:25 +00:00
i-robot 6316eeabb8 !1799 【BugFix】修复unique2申请空tensor的问题-3.0
Merge pull request !1799 from 戢芳/unique3.0
2022-12-10 07:16:25 +00:00
pipihugh a03ac753db Fixed the issue that unique2 applied for empty tensor 2022-12-10 14:30:12 +08:00
i-robot 6193332a63 !1800 [Feature] add aclrtCreateStreamWithConfig to create fast streams
Merge pull request !1800 from 王强/master
2022-12-10 14:17:03 +08:00
i-robot 329788183e !1793 AsStrided + Transpose instead of AsStrided【商发】
Merge pull request !1793 from 刘嘉巍/v1.8.1-3.0.0
2022-12-10 02:38:10 +00:00
i-robot b2ec030dab !1798 【精度比对工具】增加序号映射
Merge pull request !1798 from 杜金航/v1.8.1-3.0.0
2022-12-10 01:58:08 +00:00
i-robot 0c60492bd7 !1796 taskqueue优化
Merge pull request !1796 from 詹昊/v1.8.1-3.0.0
2022-12-09 13:10:26 +00:00
dujinhang 2c9e79c777 精度比对工具增加序号 2022-12-09 17:36:43 +08:00
zhanhao db40d88649 optimize task_queue 2022-12-09 16:13:21 +08:00
i-robot 8ce6140b6c !1795 回退batchnorm算子适配修改
Merge pull request !1795 from weili10/revert-merge-1638-v1.8.1-3.0.0
2022-12-09 07:58:33 +00:00
weili10 554167543e 回退 'Pull Request !1638 : 【Feature】batchNorm参数format与输入一致-3.0' 2022-12-09 07:32:24 +00:00
i-robot f0015e8d69 !1789 【1.8.1算子适配】logsumexp算子适配
Merge pull request !1789 from 郑亚金/v1.8.1-3.0.0_zyj_1209_logsumexp
2022-12-09 07:20:33 +00:00
刘嘉巍 ffd17028e2 AsStrided + Transpose instead of AsStrided 2022-12-09 11:32:33 +08:00
chaoTANG570034 618e228e31 set nd default on 2022-12-09 11:12:20 +08:00
yangxiaorun f45fc228a1 !1790 【新增DEBUG日志】记录pytorch申请释放内存及缓存池使用情况
Merge pull request !1790 from yangxiaorun/cherry-pick-1670554314
2022-12-09 02:56:18 +00:00
yangxiaorun 4df4b1d021 fixed 2df5874 from https://gitee.com/yangxiaorun1/pytorch/pulls/1502
feat: add memory log for pytorch
2022-12-09 02:51:56 +00:00
hxf12345677 6198b7013b logsumexp算子适配 2022-12-09 10:27:48 +08:00
i-robot a4a586c099 !1721 _nnpack_spatial_convolution OpCommand重构-3.0
Merge pull request !1721 from 戢芳/ns_conv3.0
2022-12-09 01:32:31 +00:00
i-robot 5ce381ee29 !1742 【BugFix】sum规避int和bool型-3.0
Merge pull request !1742 from 戢芳/sum_debug3.0
2022-12-08 08:27:35 +00:00
i-robot faf4f8f4a1 !1774 【溢出检测工具】增加api层dump功能
Merge pull request !1774 from 杜金航/v1.8.1-3.0.0
2022-12-08 08:23:37 +00:00
i-robot d03d9902a5 !1772 [商分]RepeatInterleave 算子适配层 合入商分
Merge pull request !1772 from aikede/sf_reInleave
2022-12-08 03:59:28 +00:00
aikede ced11d481d [商分]RepeatInterleave 算子增加适配层 2022-12-08 11:26:27 +08:00
pipihugh 45f75b2d91 _nnpack_spatial_convolution OpCommand重构 2022-12-08 10:55:58 +08:00
dujinhang 22c866562a 溢出检测工具增加api层dump功能 2022-12-08 09:56:54 +08:00
i-robot e98fb3e7a9 !1748 syncbn相关适配clean code修改商分
Merge pull request !1748 from huangxinliang/v1.8.1-3.0.0
2022-12-06 10:53:04 +00:00
xinlianglalala 73ec4aa20a clean code 2022-12-06 14:05:56 +08:00
i-robot 29c4e3177e !1711 【BugFix】修复smooth_l1_loss_backward的beta-3.0
Merge pull request !1711 from 戢芳/smoothloss3.0
2022-12-06 02:48:04 +00:00
pipihugh e557a670f7 bugfix:修复smooth_l1_loss_backward的beta 2022-12-05 16:59:38 +08:00
i-robot ac2be3d4b3 !1724 亲和库限制说明
Merge pull request !1724 from 彭子荣/v1.8.1-3.0.0
2022-12-03 03:06:20 +00:00
i-robot 6b70ebc508 !1741 [feature] support npu tensortype, eg. torch.npu.FloatTensor
Merge pull request !1741 from shaoyf/feature/300/npu_tensortype
2022-12-03 02:36:20 +00:00
shaoyf 2a5c8d712c support npu tensortype eg. torch.npu.FloatTensor 2022-12-03 09:36:23 +08:00
i-robot 5ae140b269 !1744 syncbn算子优化适配
Merge pull request !1744 from huangxinliang/v1.8.1-3.0.0
2022-12-02 09:25:00 +00:00
pipihugh accf0ad0b9 sum规避int和bool型 2022-12-02 15:22:08 +08:00
xinlianglalala 901f7aa6a9 syncbn算子适配 2022-12-02 15:22:07 +08:00
i-robot 9846f84eb1 !1734 【序列化bugfix】避免_lagecy_save进行数据存储
Merge pull request !1734 from 闫鹏全/v1.8.1-3.0.0
2022-12-02 06:48:24 +00:00
pengzirong 2f362da467 亲和库增加限制说明
补充亲和库限制

优化器合并参数说明
2022-12-02 14:26:03 +08:00
i-robot f112fad7bf !1718 精度比对工具dump效率优化
Merge pull request !1718 from 杜金航/v1.8.1-3.0.0
2022-12-01 09:35:04 +00:00
dujinhang 67b833a230 精度比对工具dump效率优化 2022-12-01 17:01:50 +08:00
闫鹏全 d10fa4eac6 不支持legacy_save,采用zipfile的存储方式 2022-12-01 15:52:54 +08:00
i-robot 484bbfea80 !1712 补充亲和库局限性说明
Merge pull request !1712 from 王夏夏/v1.8.1-3.0.0
2022-11-30 11:27:17 +00:00
i-robot 7cb21ab5c9 !1704 【BugFix】sum保持self和result类型一致,且只规避bool型-3.0
Merge pull request !1704 from 戢芳/sum_debug3.0
2022-11-30 08:43:28 +00:00
weili10 988c67fe4a update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-30 06:39:29 +00:00
xiaxia3 02277f6bb8 补充亲和库局限性说明 2022-11-29 17:42:33 +08:00
i-robot be4930fb5e !1696 【序列化bugfix】解除cpu tensor加载时依赖torch_npu
Merge pull request !1696 from 闫鹏全/v1.8.1-3.0.0
2022-11-28 13:42:20 +00:00
i-robot cba848741e !1701 【BugFix】补充nllloss_2d的weight赋0的判断条件-3.0
Merge pull request !1701 from 戢芳/nllloss3.0
2022-11-26 12:49:00 +00:00
pipihugh de4619188c sum保持输入输出dtype一致,只规避bool型 2022-11-26 20:40:00 +08:00
pipihugh fff99b3219 补充nllloss_2d的weight赋0条件 2022-11-26 13:16:03 +08:00
i-robot c48f3c8406 !1678 增加溢出检测功能支持
Merge pull request !1678 from 杜金航/v1.8.1-3.0.0
2022-11-25 09:41:43 +00:00
15990042527 703047dd98 增加溢出检测功能 2022-11-25 14:25:52 +08:00
闫鹏全 783acb8bf1 解除torch.save中cpu tensor对torch_npu包的依赖 2022-11-25 09:39:21 +08:00
i-robot f1107b1799 !1643 【BugFix】sum统一转fp32计算-3.0
Merge pull request !1643 from 戢芳/sum_dtype3.0
2022-11-22 11:10:25 +00:00
i-robot ab33067954 !1638 【Feature】batchNorm参数format与输入一致-3.0
Merge pull request !1638 from 戢芳/bn3.0
2022-11-22 11:08:30 +00:00
pipihugh 33aff05f8b sum转fp32计算 2022-11-22 10:21:12 +08:00
i-robot 7dffeb3877 !1635 【BugFix】删除copy_tensor_host_to_device-3.0
Merge pull request !1635 from 戢芳/copy_tensor3.0
2022-11-22 01:52:23 +00:00
i-robot 546ed2b617 !1669 【BugFix】修复div输入dtype不同时计算错误问题(商分)
Merge pull request !1669 from 王晓/div_diff_dtype_3.0.0
2022-11-21 08:57:19 +00:00
pipihugh cd65e8be97 batchNorm参数format与输入一致,保证二进制场景功能正常 2022-11-21 16:46:15 +08:00
wangxiao c7ecb68fd9 fix div fifferent dtype 2022-11-21 14:44:46 +08:00
i-robot 5cf3dbb015 !1666 Bugfix & Performance optimize for UpsampleNearest2dKernelNpu(商发)
Merge pull request !1666 from 刘嘉巍/v1.8.1-3.0.0
2022-11-19 09:18:35 +00:00
刘嘉巍 1cf96d4ef5 bugfix of upsamplenearest2dkernel 2022-11-19 11:44:45 +08:00
i-robot 54f51718e3 !1627 修复bn3d format问题(商分)
Merge pull request !1627 from 王晓/bn3d_3.0.0
2022-11-18 09:24:54 +00:00
i-robot 1ea15096a4 !1658 bugfix: 修复DDP场景多进程场景创建文件失败问题
Merge pull request !1658 from 施博/v1.8-3
2022-11-18 09:11:15 +00:00
i-robot 499097c474 !1659 aoe: update op list for aoe
Merge pull request !1659 from 施博/v1.8-3_aor
2022-11-18 08:13:21 +00:00
i-robot 598a152b1c !1608 【Feature】conv类算子私有格式整改-3.0
Merge pull request !1608 from 戢芳/conv3.0
2022-11-18 08:07:29 +00:00
shibo19 c2de09166e update op list for aoe 2022-11-18 15:15:26 +08:00
shibo19 c8aff7cb3e 修复DDP场景多进程场景创建文件失败问题 2022-11-18 15:13:37 +08:00
wangxiao c5924abc19 fix bn3d format 2022-11-18 13:37:54 +08:00
i-robot 912a0494e6 !1652 Optimize performance of AsStrided(商发)
Merge pull request !1652 from 刘嘉巍/v1.8.1-3.0.0
2022-11-18 03:07:21 +00:00
刘嘉巍 b862c56315 optimize performance of AsStridedKernel 2022-11-18 09:29:03 +08:00
i-robot 5d3aa66939 !1594 新API清单更新
Merge pull request !1594 from 彭子荣/v1.8.1-3.0.0
2022-11-17 11:56:49 +00:00
i-robot 75d2a2a05b !1645 【序列化bugfix】序列化加载参数map_location支持npu device数据
Merge pull request !1645 from 闫鹏全/v1.8.1-3.0.0
2022-11-17 08:07:59 +00:00
i-robot 81030a0de6 !1612 【BugFix】删除indexput中的异步拷贝-3.0
Merge pull request !1612 from 戢芳/indexput_up3.0
2022-11-17 08:05:57 +00:00
闫鹏全 e3a0019cc2 torch.load适配支持npu device类型的入参 2022-11-17 15:05:34 +08:00
pipihugh fb1ed121b9 conv类算子私有格式整改 2022-11-17 14:05:02 +08:00
pengzirong 02af7db9a6 API清单更新 2022-11-17 12:03:37 +08:00
pipihugh a370d2c5ec bugfix:删除不合理的copy_tensor_host_to_device 2022-11-16 16:08:19 +08:00
i-robot 1fb16225e3 !1626 【fixbug】修复cat不支持空tensor问题(商分)
Merge pull request !1626 from 王晓/cat_null_3.0.0
2022-11-15 11:29:46 +00:00
i-robot a843b9e341 !1628 README更新
Merge pull request !1628 from Jializheng/v1.8.1-3.0.0
2022-11-15 11:10:03 +00:00
j00648035 84b648e708 update deepspeed readme 2022-11-15 17:27:59 +08:00
wangxiao 605bc33d1b fix cat null 3.0.0 2022-11-15 16:46:34 +08:00
i-robot b99ac6da04 !1614 【BugFix】修复conv调用sum_out的反向问题-3.0
Merge pull request !1614 from 戢芳/conv_sum3.0
2022-11-15 04:01:16 +00:00
i-robot cf83f8e254 !1621 [bugfix] 给torch.cuda.amp下的文件打上自动转换函数补丁,避免自动转换失败
Merge pull request !1621 from 王姜奔/v1.8.1-3.0.0
2022-11-14 13:15:22 +00:00
王姜奔 9d44cba582 update patch_cuda 2022-11-14 20:57:22 +08:00
weili10 32bc6aa8a5 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-11-14 08:58:49 +00:00
pipihugh a5261b8776 bugfix:修复conv调用sum_out的反向问题 2022-11-14 10:35:29 +08:00
pipihugh 291e32ad75 bugfix:删除indexput中的异步拷贝 2022-11-12 18:25:32 +08:00
i-robot a3f914ffff !1598 empty_with_format整改-商分
Merge pull request !1598 from 戢芳/empty_3.0
2022-11-12 08:59:59 +00:00
i-robot 4a1995885c !1607 [BugFix] Support npu:x format for Tensor.npu
Merge pull request !1607 from shaoyf/cherry-pick-1668161156
2022-11-11 11:37:59 +00:00
shaoyf 510bf64e08 fixed c39619f from https://gitee.com/shaoyf/pytorch/pulls/1606
Bugfix Support npu:x format for Tensor.npu
2022-11-11 10:05:56 +00:00
i-robot d9f9579c05 !1603 【序列化bugfix】兼容老版本的文件加载
Merge pull request !1603 from 闫鹏全/v1.8.1-3.0.0
2022-11-11 09:38:05 +00:00
闫鹏全 01f118eff5 兼容old_zipfile_serialization 2022-11-11 17:18:49 +08:00
i-robot c948c58690 !1591 【add】:新增torch._aminmax的npu适配
Merge pull request !1591 from 郭夏/add_aminmax
2022-11-11 09:16:00 +00:00
i-robot 789b74e496 !1588 【bugfix】: 修复mul在输入有scalar参数时(tensor * scalar)输出类型处理错误问题
Merge pull request !1588 from 郭夏/bugfix_mul
2022-11-11 09:14:02 +00:00
pipihugh bf2b9c1e70 empty_with_format整改 2022-11-11 16:21:03 +08:00
郭夏 2d19f7bcc4 新增_aminmax适配
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-11 08:04:15 +00:00
郭夏 be54a1ae16 修复mul在输入有scalar参数时(tensor * scalar)输出类型处理错误问题
Signed-off-by: 郭夏 <guoxia2@huawei.com>
2022-11-11 07:46:16 +00:00
i-robot 5821884d10 !1581 Independent storage_offset compile in AsStrided(商发)
Merge pull request !1581 from 刘嘉巍/v1.8.1-3.0.0
2022-11-11 03:36:06 +00:00
刘嘉巍 16b654d181 independent storage_offset compile in AsStrided 2022-11-11 09:27:34 +08:00
i-robot a15941b531 !1572 【BugFix】max支持不同dtype输入-商分
Merge pull request !1572 from 戢芳/max_3.0
2022-11-10 13:07:48 +00:00
i-robot 4c7d261c5d !1496 【图模式1.8】Basic module for asynchronous printing in graph mode (商发)
Merge pull request !1496 from 刘嘉巍/v1.8.1-3.0.0
2022-11-10 13:05:41 +00:00
i-robot d511986f8e !1549 README更新
Merge pull request !1549 from 彭子荣/v1.8.1-3.0.0
2022-11-10 13:03:51 +00:00
i-robot ad23aa3072 !1575 【序列化】npu serialization
Merge pull request !1575 from 闫鹏全/v1.8.1-3.0.0
2022-11-10 11:49:42 +00:00
刘嘉巍 069460e0b1 basic module for asynchronous pringting in graph mode 2022-11-10 15:39:00 +08:00
闫鹏全 8738fdf440 npu serialization 2022-11-10 15:22:05 +08:00
pipihugh 97b5cc3747 bugfix:max支持不同dtype输入 2022-11-10 13:50:04 +08:00
i-robot b9b78c4da4 !1568 【Feature】sum增加dimlist的校验-商分
Merge pull request !1568 from 戢芳/sum_3.0
2022-11-10 02:30:37 +00:00
pipihugh 794650ffb6 feature:sum添加dimlist校验 2022-11-10 09:22:13 +08:00
pengzirong f9d863f194 readme更新镜像版本配套表 2022-11-08 17:10:16 +08:00
i-robot 2a41383d6e !1538 API修正
Merge pull request !1538 from 彭子荣/v1.8.1-3.0.0
2022-11-08 03:47:09 +00:00
pengzirong ec151adbb7 API修正 2022-11-08 11:18:43 +08:00
i-robot 69a12427f2 !1522 [fix] do not support NZ tensor when rank<2
Merge pull request !1522 from 王强/v1.8.1-3.0.0
2022-11-05 08:17:27 +00:00
wq160 58611cfdc2 [fix] do not support NZ tensor when rank<2 2022-11-05 11:02:42 +08:00
weili10 76803d7a2e !1503 API支持清单更新
Merge pull request !1503 from 彭子荣/v1.8.1-3.0.0
2022-11-03 09:17:41 +00:00
pengzirong 32ea7725d6 API更新 2022-11-03 16:58:28 +08:00
i-robot 7d0b9dffb2 !1471 【BugFix】规避sum不支持bool类型-商分
Merge pull request !1471 from 戢芳/sum_bool_rc3
2022-10-28 10:48:51 +00:00
i-robot 58ce863f66 !1477 batchnorm性能优化
Merge pull request !1477 from shaoyf/cherry-pick-1666874862
2022-10-28 09:24:58 +00:00
pipihugh ed725f16f9 sum算子不支持bool,转bool规避rc3 2022-10-28 16:53:20 +08:00
i-robot 0a9db8d5bc !1479 [refactor] optimize contiguous op name, op: AsStrided ViewCopy
Merge pull request !1479 from xudaohong/v1.8.1-3.0.rc3
2022-10-28 08:04:52 +00:00
x00430237 1c335f3734 [refactor] optimize contiguous op name, AsStrided ViewCopy 2022-10-28 09:17:01 +08:00
shaoyf 15bb908e6d fixed e5f6878 from https://gitee.com/shaoyf/pytorch/pulls/1472
Change the dtype of num_batches_tracked in _NormBase from int64 to int32
2022-10-27 12:47:42 +00:00
i-robot 05d12f12cd !1465 [refactor] optimize contiguous op name
Merge pull request !1465 from xudaohong/v1.8.1-3.0.rc3
2022-10-27 02:40:49 +00:00
x00430237 b775c31dd6 [refactor] modify codecheck 2022-10-26 18:16:33 +08:00
x00430237 25d5ee5bb5 [refactor] modify test cases synchronously 2022-10-26 18:16:33 +08:00
x00430237 c0019d0c1c [refactor] optimize memory repoint contiguous op name 2022-10-26 18:16:33 +08:00
x00430237 cbb73d7d7d [refactor] optimize contiguous op name 2022-10-26 18:16:33 +08:00
i-robot 8e34f19670 !1463 [bugfix]cancel lstm npu_dtype_cast
Merge pull request !1463 from darin123/v1.8.1-3.0.rc3
2022-10-26 09:02:30 +00:00
anping 5aa01f8f74 [bugfix]cancel lstm npu_dtype_cast 2022-10-26 16:23:37 +08:00
i-robot aab1760132 !1462 【BugFix】sum适配重构-商分
Merge pull request !1462 from 戢芳/sum1.8_rc3
2022-10-26 08:06:28 +00:00
pipihugh 4aa5714e57 sum适配重构 2022-10-26 15:03:28 +08:00
i-robot 708daf9168 !1443 【refactor】npu_dtype_cast替换to方案
Merge pull request !1443 from darin123/v1.8.1-3.0.rc3
2022-10-26 06:16:39 +00:00
anping b55f60052b [refactor]npu_dtype_cast replace to function. 2022-10-24 11:22:45 +08:00
i-robot 58aabf5807 !1442 优化npu_dtype_cast
Merge pull request !1442 from 王夏夏/v1.8.1-3.0.rc3
2022-10-22 07:44:31 +00:00
xiaxia3 f884ffe7d4 优化npu_dtype_cast 2022-10-22 14:37:57 +08:00
weili10 a3265a868d update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-10-22 04:10:23 +00:00
i-robot e5deeac584 !1434 viewcopy修改入参编译选项
Merge pull request !1434 from 王晓/viewcopy_independent
2022-10-20 09:32:42 +00:00
i-robot 5ef79b6c4e !1427 【FixBug】修复index算子重复编译问题
Merge pull request !1427 from 王晓/index_indepdt
2022-10-20 09:20:39 +00:00
wangxiao 3bf4f83b66 viewcopy_independent 2022-10-20 16:57:35 +08:00
i-robot 5936da408a !1428 【feature】优化环境变量ACL_DUMP_DATA内部判定
Merge pull request !1428 from 汪瑞哲/v1.8.1-3.0.rc3
2022-10-20 07:53:47 +00:00
wang-ruizhe7 cb77c09b97 feat: Optimize option: ACL_DUMP_DATA
Change the internal implementation of this functions, using
const static to ensure that the GetBoolTypeOption func run only once.
2022-10-20 15:05:16 +08:00
wangxiao 3a67565f67 index outsize independent 2022-10-20 14:51:41 +08:00
i-robot 7fcb40495c !1423 【feature】新增环境变量DISABLE_ACLOP_COM_EXE
Merge pull request !1423 from 汪瑞哲/v1.8.1-3.0.rc3
2022-10-20 06:35:17 +00:00
wang-ruizhe7 1d12efd9b3 feat: Add env variable "DISABLE_ACLOP_COM_EXE"
1. This env variable can control whether op compile and execute
in single mode(with task queue or not).
2. Change the internal implementation of the three functions, using
   const static to ensure that the GetBoolTypeOption func run only once.
2022-10-20 11:32:10 +08:00
weili10 06fed4347b update README.zh.md.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-10-20 01:50:32 +00:00
i-robot 0368c9d196 !1422 资料问题更新
Merge pull request !1422 from 彭子荣/v1.8.1-3.0.rc3
2022-10-19 12:09:47 +00:00
pengzirong 240df38f54 修改版本配套表&问题 2022-10-19 18:06:12 +08:00
i-robot 9f8a959b13 !1412 补充README图片
Merge pull request !1412 from 彭子荣/v1.8.1-3.0.rc3
2022-10-18 08:25:20 +00:00
pengzirong ea93144083 补充FAQ图 2022-10-18 09:31:44 +08:00
i-robot 88f3722a7e !1395 新增训练调优&工具使用指南
Merge pull request !1395 from 彭子荣/v1.8.1-3.0.rc3
2022-10-17 03:58:26 +00:00
i-robot 578699fe7c !1374 index indexput v3(商分)
Merge pull request !1374 from 王晓/rc3_index_v3_new
2022-10-15 03:07:41 +00:00
pengzirong c8e320840a 新增训练调优&工具使用指南 2022-10-14 18:45:03 +08:00
i-robot 10cda1bfcf !1384 【BugFix】mul去除多余copy操作 - 商分
Merge pull request !1384 from 戢芳/mulrc3
2022-10-14 06:22:49 +00:00
i-robot b51465ccc4 !1377 新增训练调优&工具使用指南
Merge pull request !1377 from 彭子荣/v1.8.1-3.0.rc3
2022-10-14 02:41:06 +00:00
pipihugh c35da010df bugfix:去除mul中多余的copy操作 2022-10-14 09:45:45 +08:00
pengzirong f42d1adbf2 新增训练调优&工具使用指南
1

1
2022-10-13 12:21:20 +08:00
wangxiao 60c876fccd index indexput v3 2022-10-12 20:18:23 +08:00
i-robot 85078b7a6d !1363 bugfix:torch.device for Module.to
Merge pull request !1363 from 王夏夏/v1.8.1-3.0.rc3
2022-10-09 13:21:59 +00:00
xiaxia3 0f30ce7c90 bugfix:torch.device for Module.to 2022-10-09 21:11:19 +08:00
i-robot 43b649c9c3 !1356 FAQs 文档修改,增加一条多卡初始化卡住的情况
Merge pull request !1356 from 龚俊强/v1.8.1-3.0.rc3
2022-10-09 03:00:23 +00:00
i-robot 0c3a39d2eb !1361 【bugfix】1.8版本显存性能劣化修正
Merge pull request !1361 from 闫鹏全/v1.8.1-3.0.rc3
2022-10-09 02:40:21 +00:00
闫鹏全 8e67bc79c5 NPU计算格式适配 2022-10-09 09:13:17 +08:00
i-robot 01525c8043 !1358 【bernoulli适配_商分】 bernoulli IR修改,适配层对齐 & cast 问题处理
Merge pull request !1358 from 沈鹏程/108_bernoulli_IR_shangfen
2022-10-08 14:15:50 +00:00
shenpengcheng 0560393277 IR修改适配层对齐 & cast问题处理 2022-10-08 21:39:02 +08:00
junqiang521 eaa979182e add FAQs 2022-10-08 19:39:08 +08:00
i-robot 105ce9b9b7 !1353 [Cleancode] Clean code for wrong import order.
Merge pull request !1353 from shaoyf/cherry-pick-1665219552
2022-10-08 10:36:52 +00:00
shaoyf 7cb2f3f615 fixed f296e85 from https://gitee.com/shaoyf/pytorch/pulls/1352
Clean code for wrong import order.
2022-10-08 08:59:13 +00:00
i-robot 2c599ad2ab !1351 二进制规避代码回退
Merge pull request !1351 from weili10/revert-merge-1342-v1.8.1-3.0.rc3
2022-10-08 08:59:06 +00:00
i-robot 5823172995 !1340 修复index中转连续走aicpu导致性能下降问题(商分)
Merge pull request !1340 from 王晓/rc3_index_mae
2022-10-08 07:46:54 +00:00
i-robot 3da9a07053 !1333 grid_sample2d适配层传参符合算子IR
Merge pull request !1333 from aikede/bug_grid_rc3
2022-10-08 07:44:57 +00:00
weili10 cfc3f32e02 回退 'Pull Request !1342 : BNTrainingUpdate在二进制场景下不使用inplace的running_mean与running_var' 2022-10-08 07:36:33 +00:00
wangxiao 6f29462a9b fix index bug 2022-10-08 14:30:25 +08:00
weili10 3e7c76d4f5 !1346 【BCM】合入index_put适配代码
Merge pull request !1346 from weili10/revert-merge-1345-v1.8.1-3.0.rc3
2022-10-07 15:04:47 +00:00
weili10 52c2074f92 回退 'Pull Request !1345 : 回退index_put算子bcm整改代码,解决带:输入场景性能劣化问题' 2022-10-07 14:18:17 +00:00
weili10 d02a477ee1 !1345 回退index_put算子bcm整改代码,解决带:输入场景性能劣化问题
Merge pull request !1345 from weili10/revert-merge-1320-v1.8.1-3.0.rc3
2022-10-07 14:11:24 +00:00
weili10 87ef723b94 回退 'Pull Request !1320 : 【BCM】index_put 适配(商发)' 2022-10-07 14:00:50 +00:00
施博 f4bb4b4b97 !1342 BNTrainingUpdate在二进制场景下不使用inplace的running_mean与running_var
Merge pull request !1342 from 郭鹏/v1.8.1-3.0.rc3
2022-10-06 07:14:13 +00:00
gp513 67cf4f85bf BNTrainingUpdate no inplace if jit_compile is false
bugfix
2022-10-06 14:56:26 +08:00
i-robot 195dab2fde !1336 修复index_select反向index_add不支持index为0维问题(商分)
Merge pull request !1336 from 王晓/rc3_index_select
2022-10-05 08:38:58 +00:00
wangxiao 9fa200d68d fix index_add 2022-09-30 18:00:23 +08:00
i-robot a7158a1929 !1332 【BugFix】修正HCCL报错信息不完整
Merge pull request !1332 from 汪瑞哲/v1.8.1-3.0.rc3
2022-09-30 06:11:27 +00:00
aikede 2fb5dc8a49 gridsample2d 传参符合算子IR 2022-09-30 11:53:58 +08:00
wang-ruizhe7 a23d501c29 fix: Fix HCCL error does not have complete error message
HCCL error does not show specific error code and error info, so add
AclGetErrMsg() interface in C10D_HCCL_CHECK macro to show more detailed
error message.
2022-09-30 10:26:36 +08:00
i-robot d988e05c1e !1320 【BCM】index_put 适配(商发)
Merge pull request !1320 from hxf12345677/indexrc3
2022-09-29 12:18:58 +00:00
i-robot 7004fdc8c1 !1322 【精度比对】backwardhook执行bug修复
Merge pull request !1322 from 闫鹏全/v1.8.1-3.0.rc3
2022-09-28 03:32:32 +00:00
i-robot 1ffbd2c529 !1324 回退processgrouphccl binding代码
Merge pull request !1324 from weili10/revert-merge-1306-v1.8.1-3.0.rc3
2022-09-28 03:30:25 +00:00
weili10 0ebd5bc2de 回退 'Pull Request !1306 : add ProcessGroupHCCL methods binding' 2022-09-28 03:05:43 +00:00
i-robot 2dab50e911 !1323 【BugFix】_unique2算子fp16场景存在精度问题,转fp32规避 - 商分
Merge pull request !1323 from 戢芳/unique1.8_rc3
2022-09-27 13:20:44 +00:00
闫鹏全 c378e36a49 修复正向计算result类型推断错误,导致的反向hook执行报错的问题 2022-09-27 20:04:43 +08:00
i-robot ae60dadb0c !1310 【图模式1.8】Disable DropoutKernel RNG state in graph mode
Merge pull request !1310 from 刘嘉巍/dev-rc3
2022-09-27 11:46:44 +00:00
i-robot b2471c6019 !1317 masked_select支持非bool mask(商分)
Merge pull request !1317 from 王晓/maskedselect_rc3
2022-09-27 11:44:43 +00:00
hxf12345677 f23017520f 【BCM】indexput 适配 2022-09-27 19:37:50 +08:00
pipihugh 59974ffb1f bugfix:_unique2算子fp16场景存在精度问题,转fp32规避 2022-09-27 19:31:40 +08:00
i-robot a4a74ef608 !1306 add ProcessGroupHCCL methods binding
Merge pull request !1306 from weili10/v1.8.1-3.0.rc3
2022-09-27 08:20:48 +00:00
i-robot 682f4916bc !1316 [Bugfix] Support npu:x format for Module.to.
Merge pull request !1316 from 尤安升/v1.8.1-3.0.rc3
2022-09-27 08:18:52 +00:00
wangxiao 98cacfd424 maskselect mask support no bool 2022-09-27 15:34:05 +08:00
尤安升 6fa6a82725 [Bugfix] Support npu:x format for Module.to. 2022-09-27 15:24:46 +08:00
刘嘉巍 3fb4baa9ae disable DropoutKernel rng state in graph mode 2022-09-27 11:01:19 +08:00
i-robot 4df3f6c129 !1254 【图模式1.8】adapt ops for graph mode & add testcase
Merge pull request !1254 from 刘嘉巍/dev-rc3
2022-09-27 02:54:38 +00:00
i-robot 87cd5ddc67 !1307 回退padv3grad适配(商发)
Merge pull request !1307 from hxf12345677/pav3
2022-09-27 01:40:34 +00:00
hxf12345677 4bb25f12a1 padv3grad 商发回退 2022-09-26 20:52:26 +08:00
i-robot 7670985e45 !1292 [Cleancode] clean code for all.
Merge pull request !1292 from shaoyf/v1.8.1_clean_code
2022-09-26 12:35:12 +00:00
i-robot 68b3519bba !1257 【BugFix】修复avgpool2d 算子输出shape错误问题, 对不支持三维输入做增维操作(商分)
Merge pull request !1257 from hxf12345677/avg
2022-09-26 12:33:14 +00:00
weili10 f2f1f86dc7 add ProcessGroupHCCL methods binding 2022-09-26 16:48:08 +08:00
shaoyf 61d0e69a87 adjust torch_npu import order 2022-09-26 10:26:11 +08:00
i-robot 4ffb7eb40a !1287 【BugFix】修正HCCL接口reduce标杆 - 商分
Merge pull request !1287 from 戢芳/reduce_rc3
2022-09-26 02:12:56 +00:00
i-robot a0316876e5 !1293 【BCM】删除triu、scatter_add的过适配 - 商分
Merge pull request !1293 from 戢芳/delete_rc3
2022-09-26 02:10:55 +00:00
尤安升 c0bcc5cb92 update scripts/codegen/templates/torch_funcs.py. 2022-09-24 07:07:11 +00:00
i-robot 8f8e68860e !1283 【BCM】upsample_nearest3d、upsample_trilinear3d删除过适配-商分
Merge pull request !1283 from 戢芳/upsample3d_rc3
2022-09-23 11:02:18 +00:00
i-robot 1f4e3405b9 !1284 【BCM】masked_scatter去除过适配-商分
Merge pull request !1284 from 戢芳/masked_scatter_rc3
2022-09-23 10:36:17 +00:00
i-robot fbc55e8ae5 !1295 【BugFix】cumprod IR参数变更- 商分
Merge pull request !1295 from 戢芳/cumprod_rc3
2022-09-23 10:34:14 +00:00
pipihugh bd74e86d31 cumprod 算子IR变更 2022-09-23 18:17:41 +08:00
i-robot 98dd3950e3 !1288 aoe支持算子列表刷新,dump算子同步刷新
Merge pull request !1288 from 施博/aoe_ops_rc3
2022-09-23 08:51:38 +00:00
pipihugh d9256f66f4 删除triu、scatter_add的过适配 2022-09-23 13:52:39 +08:00
shaoyf 7aec2ef7b3 clean code for all 2022-09-23 13:41:24 +08:00
shibo19 5455e9181f aoe支持算子列表刷新,dump算子同步刷新 2022-09-23 11:25:06 +08:00
pipihugh a3abdfeb01 bugfix:修正reduce的标杆 2022-09-22 21:00:49 +08:00
pipihugh a4457668f9 upsample_nearest3d、upsample_trilinear3d删除过适配 2022-09-22 14:09:27 +08:00
pipihugh 8ba5fbcae8 masked_scatter删除过适配 2022-09-22 14:06:51 +08:00
i-robot e5319854a4 !1266 nonzero第三类算子适配(商分)
Merge pull request !1266 from 王晓/rc3_nonzero
2022-09-21 02:54:38 +00:00
i-robot 1455dcdefb !1273 【BCM】upsample_nearest1d调用Resize-商分
Merge pull request !1273 from 戢芳/resize1.8_rc3
2022-09-20 13:38:34 +00:00
pipihugh 78c93d343a upsample_nearest1d调用Resize 2022-09-20 20:16:53 +08:00
i-robot 6e33590fe1 !1265 Modify randperm adapt to StatelessRandperm(商分)
Merge pull request !1265 from 王晓/rc3_randperm
2022-09-20 12:10:35 +00:00
i-robot 1ccb012c63 !1264 【BugFix】修复new_zeros、new_full、new_ones、new_tensor算子参数device='npu'报错问题
Merge pull request !1264 from shaoyf/bugfix_new_zeros
2022-09-20 12:08:34 +00:00
i-robot b66b9d76da !1259 【1.8.1算子适配】 MaskedSelect改为第三类算子适配(商分)
Merge pull request !1259 from hxf12345677/masked
2022-09-20 12:06:36 +00:00
hxf12345677 a27ed04728 修复avgpool2d 算子输出shape错误问题, 对不支持三维输入做增维操作 2022-09-19 20:19:49 +08:00
weili10 116a7637e9 update OWNERS.
Signed-off-by: weili10 <liwei386@huawei.com>
2022-09-19 11:26:07 +00:00
hxf12345677 26d8351efb MaskedSelect改为第三类算子适配 2022-09-19 14:47:13 +08:00
i-robot b8f7ebf540 !1263 index IR 变更(1.8商分)
Merge pull request !1263 from 王晓/rc3_index
2022-09-17 11:30:05 +00:00
shaoyf 7d20630d3e fix new_zeros new_full new_ones new_tensor when device='npu' 2022-09-17 18:43:37 +08:00
tianyumi 0e1635a3a5 randperm adapt to StatelessRandperm to support seed 2022-09-17 14:53:00 +08:00
tianyumi c1046a88a7 nonzero 3rd kind adapt 2022-09-17 14:47:08 +08:00
i-robot c68ff46887 !1253 【精度对比工具】文档更新
Merge pull request !1253 from 闫鹏全/master
2022-09-16 09:30:19 +00:00
刘嘉巍 6e4bd4b8d1 adapt ops for graph mode & add testcase 2022-09-16 16:47:48 +08:00
i-robot 3e6aa13e26 !1250 回退nllloss过适配
Merge pull request !1250 from 戢芳/back_nllloss
2022-09-16 04:06:09 +00:00
pipihugh 0cf1761227 回退nllloss过适配 2022-09-16 11:18:44 +08:00
闫鹏全 14a496d500 精度对比工具文档完善 2022-09-13 10:06:59 +08:00
452 changed files with 14201 additions and 7663 deletions
+2
View File
@@ -84,6 +84,7 @@ endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=pedantic")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=redundant-decls")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=old-style-cast")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILENAME__='\"$(notdir $(abspath $<))\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
# These flags are not available in GCC-4.8.5. Set only when using clang.
@@ -194,6 +195,7 @@ target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/lib
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libacl_op_compiler.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libge_runner.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libgraph.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC ${TORCHNPU_THIRD_PARTY_ROOT}/acl/libs/libacl_tdt_channel.so)
target_link_libraries(${PLUGIN_NAME} PUBLIC torch torch_cpu c10 python3.7m)
+12 -2
View File
@@ -2,11 +2,11 @@ approvers:
- blian
- nalinaly
- weili10
- you-ansheng
reviewers:
- shibo19
- Ronnie_zheng
- xiaxia3
- li_chao10
- petissue
- td__lihan
- ascendzyj
@@ -20,4 +20,14 @@ reviewers:
- fairwarning
- you-ansheng
- yinzijun
- weili10
- weili10
- granpad7
- clinglai
- shaoyf
- yanpengquan07
- xiong05
- liu-jiaweikf
- xiepeng20
- brightlyking
- chenhao_1209
- wbigat
+5
View File
@@ -488,6 +488,11 @@ To verify the torch_npu reference, switch to another directory. If you perform t
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## Multi card training is stuck in initialization stage until timeout
IPv6 address is used in the "init_process_group" function of multi card communication, for example ::1 (Note that localhost may point to IPv6 address)
Use IPv4 to avoid this problem
# Version Description
For details, see [Release Notes](https://gitee.com/ascend/pytorch/tree/master/docs/en/RELEASENOTE).
+83 -20
View File
@@ -30,19 +30,26 @@ apt-get install -y gcc==7.3.0 cmake==3.12.0
# Ascend配套软件
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 |
| :------------ | :----------- | :----------- | ------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 |
| AscendPyTorch版本 | CANN版本 | 支持PyTorch版本 | Gitee分支名称 | AscendHub镜像版本 |
| :------------ | :----------- | :----------- | ------------- | ------------- |
| 2.0.2 | CANN 5.0.2 | 1.5.0.post2 | 2.0.2.tr5 | 21.0.2 |
| 2.0.3 | CANN 5.0.3 | 1.5.0.post3 | 2.0.3.tr5 | 21.0.3 |
| 2.0.4 | CANN 5.0.4 | 1.5.0.post4 | 2.0.4.tr5 | 21.0.4 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.5.0.post5 | v1.5.0-3.0.rc1 | 22.0.RC1 |
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 | \ |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 | 22.0.RC2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 | 22.0.RC2-1.8.1 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.5.0.post7 | v1.5.0-3.0.rc3 | \ |
| 3.0.rc3 | CANN 6.0.RC1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 | 22.0.RC3-1.8.1 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.11.0.rc1(beta) | v1.11.0-3.0.rc3 | \ |
| 3.0.0 | CANN 6.0.1 | 1.5.0.post8 | v1.5.0-3.0.0 | \ |
| 3.0.0 | CANN 6.0.1 | 1.8.1 | v1.8.1-3.0.0 | \ |
| 3.0.0 | CANN 6.0.1 | 1.11.0.rc2(beta) | v1.11.0-3.0.0 | \ |
# 安装方式
## 安装Pytorch依赖环境
## 安装PyTorch依赖环境
如果使用非root用户安装,用户需要在本步骤的每句命令后加**--user**,示例如:pip3 install pyyaml --user。
@@ -59,15 +66,19 @@ pip3 install wheel
#x86_64
pip3 install torch==1.8.1+cpu #若使用pip命令安装cpu版本PyTorch报错,请手动下载whl包安装,下载地址:(https://download.pytorch.org/whl/torch)
#aarch64
#社区未提供arm架构cpu安装包,请参见FAQ第一条,使用源码编译安装pytorch
#aarch64(推荐使用镜像)
1.可在docker中使用AscendHub镜像仓库提供的基于PyTorch版本制作的基础镜像,包含训练、转换和推理等功能。
#镜像仓库地址:(https://ascendhub.huawei.com/#/detail/pytorch-modelzoo)
2.鲲鹏arm服务器可在鲲鹏开源软件文件共享中心获取编译好的PyTorch二进制安装包。
#鲲鹏文件共享中心地址:(https://mirrors.huaweicloud.com/kunpeng/archive/Ascend/PyTorch/)
3.社区未提供的arm架构cpu安装包,可参见FAQ第一条,使用源码编译安装pytorch。
```
编译生成pytorch插件的二进制安装包。
```
# 下载master分支代码,进入插件根目录
git clone -b master https://gitee.com/ascend/pytorch.git
# 下载1.8.1-3.0.0分支代码,进入插件根目录
git clone -b v1.8.1-3.0.0 https://gitee.com/ascend/pytorch.git
cd pytorch
# 指定python版本编包方式:
bash ci/build.sh --python=3.7
@@ -80,7 +91,7 @@ bash ci/build.sh --python=3.9
然后安装pytorch/dist下生成的插件torch_npu包,{arch}为架构名称。
```
pip3 install --upgrade dist/torch_npu-1.8.1rc2-cp37-cp37m-linux_{arch}.whl
pip3 install --upgrade dist/torch_npu-1.8.1-cp37-cp37m-linux_{arch}.whl
```
下载torchvision。
@@ -181,11 +192,13 @@ Ascend PyTorch的版本分支有以下几种维护阶段:
| **分支名** | **当前状态** | **上线时间** | **后续状态** | **EOL 日期**|
|------------|--------------|----------------------|----------------------------------------|------------|
| **v2.0.2** | Maintained | 2021-07-29 | Unmaintained <br> 2022-07-29 estimated | |
| **v2.0.3** | Maintained | 2021-10-15 | Unmaintained <br> 2022-10-15 estimated | |
| **v2.0.4** | Maintained | 2022-01-15 | Unmaintained <br> 2023-01-15 estimated | |
| **v2.0.2** | EOL | 2021-07-29 | N/A | |
| **v2.0.3** | EOL | 2021-10-15 | N/A | |
| **v2.0.4** | Unmaintained | 2022-01-15 | EOL <br> 2023-04-15 estimated | |
| **v3.0.rc1** | Maintained | 2022-04-10 | Unmaintained <br> 2023-04-10 estimated | |
| **v3.0.rc2** | Maintained | 2022-07-15 | Unmaintained <br> 2023-07-15 estimated | |
| **v3.0.rc3** | Maintained | 2022-10-20 | Unmaintained <br> 2023-10-20 estimated | |
| **v3.0.0** | Maintained | 2023-1-20 | Unmaintained <br> 2024-1-20 estimated | |
# FAQ
@@ -205,6 +218,12 @@ git submodule sync
git submodule update --init --recursive
```
配置环境变量
```
export USE_XNNPACK=0
```
执行编译安装。
```
@@ -485,7 +504,7 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
该warning不影响模型的精度和性能,可以忽略。
待NPU 设备号合入社区或者后续Pytorch版本`_has_compatible_shallow_copy_type`注册方式发生变动,该warning会被解决。
待NPU 设备号合入社区或者后续PyTorch版本`_has_compatible_shallow_copy_type`注册方式发生变动,该warning会被解决。
![输入图片说明](https://images.gitee.com/uploads/images/2022/0701/153621_2b5080c4_7902902.png)
@@ -493,9 +512,53 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
验证torch_npu的引入,请切换至其他目录进行,在编译目录执行会提示如下错误。
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## 在执行import torch_npu时出现ModuleNotFooundError: NO module named '_lzma'报错问题
在python命令行下,执行import torch_npu测试时,出现ModuleNotFooundError: NO module named '_lzma'问题,可能由于Python环境失效,重装Python即可。<img src="figures/QA.png" />
## 编译过程中出现XNNPACK相关的Make Error报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
![](figures/QA1.png)
1. 执行命令设置环境变量
```
export USE_XNNPACK=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 编译时出现Breakpad error: field 'regs' has incomplete type 'google_breakpad::user_regs_struct'报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
1. 执行命令配置环境变量
```
export BUILD_BREAKPAD=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 多卡训练初始化阶段卡顿至超时
init_process_group 函数中使用了IPV6地址,例如::1(注意localhost 可能指向IPv6的地址),使用IPv4可以避免这个问题
# 版本说明
版本说明请参阅[ReleseNote](docs/zh/RELEASENOTE)
File diff suppressed because it is too large Load Diff
@@ -52,6 +52,9 @@ apt-get install -y gcc==7.3.0 cmake==3.12.0
| 3.0.rc1 | CANN 5.1.RC1 | 1.8.1.rc1 | v1.8.1-3.0.rc1 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.5.0.post6 | v1.5.0-3.0.rc2 |
| 3.0.rc2 | CANN 5.1.RC2 | 1.8.1.rc2 | v1.8.1-3.0.rc2 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.5.0.post7 | v1.5.0-3.0.rc3 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.8.1.rc3 | v1.8.1-3.0.rc3 |
| 3.0.rc3 | CANN 6.0.RC1 | 1.11.0.rc1 | v1.11.0-3.0.rc3 |
# 安装方式<a name="安装方式"></a>
@@ -79,8 +82,8 @@ pip3 install torch==1.8.1+cpu #若使用pip命令安装cpu版本PyTorch报错,
编译生成pytorch插件的二进制安装包。
```
# 下载master分支代码,进入插件根目录
git clone -b master https://gitee.com/ascend/pytorch.git
# 下载v1.8.1-3.0.rc3分支代码,进入插件根目录
git clone -b v1.8.1-3.0.rc3 https://gitee.com/ascend/pytorch.git
cd pytorch
# 指定python版本编包方式:
bash ci/build.sh --python=3.7
@@ -93,7 +96,7 @@ bash ci/build.sh --python=3.9
然后安装pytorch/dist下生成的插件torch_npu包,{arch}为架构名称。
```
pip3 install --upgrade dist/torch_npu-1.8.1rc2-cp37-cp37m-linux_{arch}.whl
pip3 install --upgrade dist/torch_npu-1.8.1rc3-cp37-cp37m-linux_{arch}.whl
```
下载torchvision。
```
@@ -475,8 +478,53 @@ warning如下图所示,由Tensor.set_data浅拷贝操作触发。主要原因
<img src="figures/FAQ torch_npu.png" style="zoom:150%;" />
## 在执行import torch_npu时出现ModuleNotFooundError: NO module named '_lzma'报错问题
5在python命令行下,执行import torch_npu测试时,出现ModuleNotFooundError: NO module named '_lzma'问题,可能由于Python环境失效,重装Python即可。<img src="figures/QA.png" />
## 编译过程中出现XNNPACK相关的Make Error报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
![](figures/QA1.png)
1. 执行命令设置环境变量
```
export USE_XNNPACK=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 编译时出现Breakpad error: field 'regs' has incomplete type 'google_breakpad::user_regs_struct'报错
编译原生pytorch时,未配置相关环境变量,导致编译不成功。
1. 执行命令配置环境变量
```
export BUILD_BREAKPAD=0
```
2. 执行命令清除当前编译内容
```
make clean
```
3. 重新编译
## 多卡训练初始化阶段卡顿至超时
init_process_group 函数中使用了IPV6地址,例如::1(注意localhost 可能指向IPv6的地址),使用IPv4可以避免这个问题
# 版本说明<a name='版本说明'></a>
版本说明请参阅[ReleseNote](https://gitee.com/ascend/pytorch/blob/master/docs/zh/RELEASENOTE/RELEASENOTE.md)
版本说明请参阅[ReleseNote](https://gitee.com/ascend/pytorch/blob/v1.8.1-3.0.rc3/docs/zh/RELEASENOTE/RELEASENOTE.md)
Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

@@ -29,7 +29,7 @@
- [自定义算子导出方法](#自定义算子导出方法md)
<h2 id="简介md">简介</h2>
### 概述<a name="zh-cn_topic_0000001125558589_section7405182695312"></a>
#### 概述<a name="zh-cn_topic_0000001125558589_section7405182695312"></a>
为了实现PyTorch深度学习框架在昇腾AI处理器上运行,需要将框架算子用TBE自定义开发。
@@ -167,7 +167,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
- 当前昇腾AI处理器中支持的算子以及对应的算子约束可以通过以下两种方式查询。
- 命令行开发方式下,您可以参见《CANN 算子清单 \(Ascend 910\)》进行离线查询。
- MindStudio开发方式下,您可以通过MindStudio进行在线查询,详细查看方法可参见《MindStudio 用户指南》中的“算子&模型速查”章节。
- 当前PyTorch适配的算子列表可以参见[《PyTorch API支持清单》](https://gitee.com/ascend/pytorch/blob/master/docs/zh/PyTorch%20API%E6%94%AF%E6%8C%81%E6%B8%85%E5%8D%95.md)。
- 当前PyTorch适配的算子列表可以参见[《PyTorch API支持清单》](https://gitee.com/ascend/pytorch/blob/v1.8.1-3.0.rc3/docs/zh/PyTorch%20API%E6%94%AF%E6%8C%81%E6%B8%85%E5%8D%95.md)。
<h2 id="算子适配开发md">算子适配开发</h2>
@@ -189,7 +189,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
<h3 id="获取PyTorch源码md">获取PyTorch源码</h3>
针对pytorch1.8.1版本,PyTorch源码获取请参见[《PyTorch安装指南》](https://gitee.com/ascend/pytorch/blob/master/docs/zh/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97.md)中“安装PyTorch框架”章节,完成在"pytorch/pytorch_v1.8.1"目录生成适配昇腾AI处理器的全量代码步骤。将在pytorch/pytorch目录中进行PyTorch 算子适配开发。
针对pytorch1.8.1版本,PyTorch源码获取请参见[《PyTorch安装指南》](https://gitee.com/ascend/pytorch/blob/v1.8.1-3.0.rc3/docs/zh/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97/PyTorch%E5%AE%89%E8%A3%85%E6%8C%87%E5%8D%97.md)中“安装PyTorch框架”章节,完成在"pytorch/pytorch_v1.8.1"目录生成适配昇腾AI处理器的全量代码步骤。将在pytorch/pytorch目录中进行PyTorch 算子适配开发。
<h3 id="注册算子开发md">注册算子开发</h3>
@@ -200,7 +200,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
<h4 id="概述md">概述</h4>
当前制定的NPU适配派发原则是NPU算子的派发不经过框架公共函数,直接派发成NPU适配的函数,即算子执行调用栈中只包含NPU适配的函数调用,不包含框架公共函数。PyTorch框架在编译时,会根据 native\_functions.yaml 的定义,按框架中定义的类型和设备分发原则,生成相应的新算子的中间层的调用说明。对于NPU,会生成在 build/aten/src/ATen/NPUType.cpp。
当前制定的NPU适配派发原则是NPU算子的派发不经过框架公共函数,直接派发成NPU适配的函数,即算子执行调用栈中只包含NPU适配的函数调用,不包含框架公共函数。PyTorch框架在编译时,会根据 native\_functions.yaml 的定义,按框架中定义的类型和设备分发原则,生成相应的新算子的中间层的调用说明。对于NPU,会生成在 torch_npu/csrc/aten/RegisterNPU.cpp。
<h4 id="PyTorch1-8-1-注册算子开发md">PyTorch1.8.1 注册算子开发</h4>
@@ -208,7 +208,7 @@ PyTorch算子开发包含TBE算子开发和PyTorch框架下的算子适配。
1. 打开native\_functions.yaml文件。
native\_functions.yaml 文件中,定义了所有算子函数原型,包括函数名称和参数等信息,每个算子函数支持不同硬件平台的派发信息。该文件所在路径为pytorch/aten/src/ATen/native/native\_functions.yaml。
native\_functions.yaml 文件中,定义了所有算子函数原型,包括函数名称和参数等信息,每个算子函数支持不同硬件平台的派发信息。该文件所在路径为scripts/codegen/native\_functions.yaml。
2. 确定需要派发函数。
- yaml 中已存在的算子
@@ -688,7 +688,7 @@ pip3 install --upgrade torch_npu-1.8.1rc1-cp37-cp37m-linux_{arch}.whl
3. 执行测试用例脚本
进入test\_add.py所在的目录,执行:
进入test\_add.py所在的目录/test/test_network_ops,执行:
```
python3.7 test_add.py
@@ -831,7 +831,7 @@ pip3.7 install torchvision --no-deps
至此步骤,不应该有错误,屏幕应该输出 "add" 中增加的日志打印。若出错,请完成代码清理排查,保证无新开发的代码影响测试。
3. 将新开发的“自定义TBE算子”合并到"cann"中,在对应的在算子入口增加日志打印,作为运行标识。
4. 完成上面的"cann"编译、安装,调用“python3.7.5 test\_add.py”进行测试。
4. 完成上面的"cann"编译、安装,调用“python3.7 test\_add.py”进行测试。
>![](public_sys-resources/icon-note.gif) **说明:**
>根据Ascend的设计逻辑,用户开发安装的“custom”算子包优先级高于“built-in”的内置算子包,在运行加载时,会优先加载调度“custom”包中的算子。过程中,若解析“custom”中的算子信息文件失败,则会跳过“custom”算子包,不加载调度任何“custom”算子包中的任何算子。
@@ -839,11 +839,11 @@ pip3.7 install torchvision --no-deps
>- 若此步骤出错,或屏幕未输出 "add" 中增加的日志打印,则说明新开发的“自定义TBE算子”有错误,影响了“自定义算子包”的加载,建议**优先排查新开发的“自定义TBE算子”中的“算子信息定义”是否正确**。
>- 若此步骤正确,至少说明 **新开发的“自定义TBE算子”中的“算子信息定义”不影响运行**。
5. 调用“python3.7.5 xxx\_testcase.py”进行测试;
5. 调用“python3.7 xxx\_testcase.py”进行测试,xxx为新增算子名称;
>![](public_sys-resources/icon-note.gif) **说明:**
>- 若屏幕正常输出新开发的“自定义TBE算子”中增加的日志打印,则至少说明调度到了新开发的算子。
>- 若屏幕未输出新开发的“自定义TBE算子”中增加的日志打印,则问题可能出现在“PyTorch适配”中,需要排查这一部分的实现代码,较多的可能会出现在“XxxxKernelNpu.cpp”中的输入、输出未能正确适配。
>- 若屏幕未输出新开发的“自定义TBE算子”中增加的日志打印,则问题可能出现在“PyTorch适配”中,需要排查这一部分的实现代码,较多的可能会出现在“XxxxKernelNpu.cpp”中的输入、输出未能正确适配,XxxxKernelNpu.cpp为新增算子信息文件。
@@ -859,7 +859,7 @@ pip3.7 install torchvision --no-deps
1. 打开安装在用户目录下的算子包安装目录。
```
cd ~/.local/Ascend/opp/op_impl/built-in/ai_core/tbe/impl
cd /usr/local/Ascend/ascend-toolkit/op_impl/build-in/ai_core/tbe/config/ascend910/
ll
```
@@ -12,7 +12,14 @@
在同一模型或算子调试过程中,遇到算子相关的计算精度问题,定位时费时费力,所以推出了一个精度比对工具。
精度对比工具,通过在PyTorch模型中注入hook,跟踪计算图中算子的前向传播与反向传播时的输入与输出,对比npu芯片中的算子计算数值与cpu(gpu)芯片中的算子计算数值进行对比,排查npu算子在npu芯片中存在计算精度误差,进行问题的精准定位。
精度对比工具,通过在PyTorch模型中注入hook,跟踪计算图中算子的前向传播与反向传播时的输入与输出,排查存在计算精度误差,进行问题的精准定位。
主要的使用场景包括:
- 同一模型,从gpu(或cpu)移植到npu中存在精度下降问题,对比npu芯片中的算子计算数值与gpu(cpu)芯片中的算子计算数值,进行问题定位。
- 同一模型,进行迭代(模型、算子或设备迭代)时存在的精度下降问题,对比相同模型在迭代前后版本的算子计算数值,进行问题定位。
以gpu为参照定位精度问题,使用ptdbg_ascend插件来进行数据dump和比对,请参考[ptdbg_ascend](https://gitee.com/ascend/tools/tree/master/ptdbg_ascend)。
## **前提条件**
@@ -61,7 +68,7 @@
cos(\theta) = \frac{\sum_{i=1}^{n} (\hat{y_{i}} \times y_{i})}
{\sqrt{\sum_{i=1}^{n}\hat{y_{i}}} \times \sqrt{\sum_{i=1}^{n}y_{i}^{2}}}
$$
当余弦夹角数值越接近于1说明计算出的两个张量越相似
当余弦夹角数值越接近于1说明计算出的两个张量越相似,在计算中可能会存在nan,主要由于可能会出现其中一个向量为0
2. 均方根误差(RMSE):
@@ -89,7 +96,7 @@ import os
import torch
import torch.nn as nn
from torch_npu.hooks import set_dump_path, seed_all, register_acc_cmp_hook
from torch_npu.hooks import set_dump_path, seed_all, register_hook, wrap_acc_cmp_hook
from torch_npu.hooks.tools import compare
@@ -108,10 +115,10 @@ class ModuleOP(nn.Module):
r1 = self.relu(x2)
return r1
# 对该网络进行hook注入和数据dump
module = ModuleOp()
register_acc_cmp_hook(module) # 对模型注入forwar和backward的hooks
# 对模型注入forwar和backward的hooks,如需关闭,请使用register_hook(model_cpu, wrap_acc_cmp_hook, sample=False)
register_hook(model_cpu, wrap_acc_cmp_hook)
seed_all()
x = torch.randn(2, 2)
@@ -135,7 +142,7 @@ compare("./npu_module_op.pkl", "./cpu_module_op.pkl", "./module_result.csv")
```
使用精度比对工具进行torchvision下现有模型的计算精度比对,整体思路相同,以resnet50模型为例代码如下:
使用精度比对工具进行torchvision下现有模型的计算精度比对,整体思路相同,其中cpu和npu的对比思路与npu和npu的对比思路也是相同,以resnet50模型为例代码如下:
```python
import os
import copy
@@ -143,7 +150,7 @@ import torch
import torch.nn as nn
from torchvision import models, datasets, transforms
from torch_npu.hooks import set_dump_path, seed_all, register_acc_cmp_hook
from torch_npu.hooks import set_dump_path, seed_all, register_hook, wrap_acc_cmp_hook
from torch_npu.hooks.tools import compare
@@ -153,12 +160,12 @@ model_cpu.eval()
model_npu = copy.deepcopy(model_cpu)
model_npu.eval()
# 对该计算进行hook注入和数据dump
register_acc_cmp_hook(model_cpu)
register_acc_cmp_hook(model_npu)
seed_all()
# 对该计算进行hook注入和数据dump,采样功能默认开启,如需关闭,请使用register_hook(model_cpu, wrap_acc_cmp_hook, sample=False)
register_hook(model_cpu, wrap_acc_cmp_hook)
register_hook(model_npu, wrap_acc_cmp_hook)
# 需要根据不同的模型输入和标签生成相应的tensor(或读取实际数据),损失函数等
# 需要根据不同的模型输入和标签生成相应的tensor(或读取实际数据),损失函数等,如果是随机生成的标签需要保证数据的有效性
inputs = torch.randn(1, 3, 244, 244)
labels = torch.randn(1).long()
criterion = nn.CrossEntropyLoss()
@@ -181,4 +188,17 @@ loss.backward()
# 对比dump出的数据精度,生成csv文件
compare("./npu_resnet50_op.pkl", "./cpu_resnet50_op.pkl", "./resnet50_result.csv")
```
如需相对生成的pkl文件解析读取数据,可参考下列代码
```python
import json
pkl_file=open(pkl_path,'r') # pkl_path:需要解析的文件
tensor_line=pkl_file.readline() # 读取行数据
tensor_data=json.loads(tensor_line)
print(tensor_data[0]) # 算子名称
print(tensor_data[1]) # 对应数据
print(tensor_data[2]) # 数据类型
print(tensor_data[3]) # 数据尺寸
```
@@ -11,6 +11,7 @@
华为对自有训练模型算子进行了优化,其中包括算子消除、算子融合、算子拆分等,以更好的适配NPU等训练设备。
因此在模型迁移的过程中,有时会遇到自有实现的算子运算的结果与业界标准算子运算结果存在偏差,精度不达标的问题,需要借助计算精度比对工具得出模型中的哪些算子在GPU和NPU的计算中会存在较大的差异,从而重点分析这些算子的表现性能,帮助开发人员快速定位并解决算子精度问题。
此外在进行模型版本迭代、底层算子迭代、计算设备(npu)迭代时也可能会引入计算精度的问题,有时会遇到新实现的算子运算的结果与要被替代的算子运算结果存在偏差等,需要借助计算精度对比工具得出那些算子在不同的版本或在不同的设备上存在较大的计算差异,从而快速定位计算精度问题。
## **已有的精度对比脚本工具**
目前已经有一些可以进行精度比对的脚本示例,其主要思路都是相同的,包括整网对比和单算子对比,如图所示。
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 946 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 356 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 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

+183 -1
View File
@@ -1,4 +1,18 @@
# FrameworkPTAdapter 3.0.RC2 版本说明书
# FrameworkPTAdapter 3.0.0 版本说明书
- [FrameworkPTAdapter 3.0.0](#FrameworkPTAdapter-3-0-0md)
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
- [特性修改](#特性修改md)
- [已修复问题](#已修复问题md)
- [已知问题](#已知问题md)
- [兼容性](#兼容性md)
- [FrameworkPTAdapter 3.0.RC3](#FrameworkPTAdapter-3-0-RC3md)
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
- [特性修改](#特性修改md)
- [已修复问题](#已修复问题md)
- [已知问题](#已知问题md)
- [兼容性](#兼容性md)
- [FrameworkPTAdapter 3.0.RC2](#FrameworkPTAdapter-3-0-RC2md)
- [用户须知](#用户须知md)
- [新增特性](#新增特性md)
@@ -35,6 +49,174 @@
- [已知问题](#已知问题-4md)
- [兼容性](#兼容性-5md)
<h2 id="FrameworkPTAdapter-3-0-0md">FrameworkPTAdapter 3.0.0</h2>
<h3 id="用户须知md">用户须知</h3>
本框架基于Facebook主导的开源PyTorch进行修改,延续原生的PyTorch特性,使用NPU进行动态图训练;以算子粒度进行模型适配,代码重用性好,支持现有的网络只修改设备类型或数据类型,即可迁移到NPU上使用。
PyTorch1.8.1版本开始采用插件化适配方式,与原生PyTorch框架实现彻底解耦,功能、性能与PyTorch1.5.0基本保持一致,对后端算子适配提供较好开发体验。PyTorch 1.11.0当前为beta版本,建议优先使用PyTorch 1.8.1版本。
<h3 id="新增特性md">新增特性</h3>
**表 1** PyTorch支持的版本特性列表
<a name="t76c34275cbb74753970f7c5a9eb594fa"></a>
<table><thead align="left"><tr id="r0c10e7163bf54fe8816ab5ca2d77ccc4"><th class="cellrowborder" valign="top" width="25.590000000000003%" 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="15.52%" 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="58.89%" id="mcps1.2.4.1.3"><p id="a2a1562364b09433a83133fa10b3cf2b3"><a name="a2a1562364b09433a83133fa10b3cf2b3"></a><a name="a2a1562364b09433a83133fa10b3cf2b3"></a>说明</p>
</th>
</tr>
</thead>
<tbody><tr id="row91681125173610"><td class="cellrowborder" valign="top" width="25.590000000000003%" headers="mcps1.2.4.1.1 "><p id="p1712174492611"><a name="p1712174492611"></a><a name="p1712174492611"></a>适配NPU的PyTorch1.5.0特性</p>
</td>
<td class="cellrowborder" valign="top" width="15.52%" headers="mcps1.2.4.1.2 "><p id="p2168172519364"><a name="p2168172519364"></a><a name="p2168172519364"></a>框架基础功能</p>
</td>
<td class="cellrowborder" valign="top" width="58.89%" headers="mcps1.2.4.1.3 "><p id="p1416815259367"><a name="p1416815259367"></a><a name="p1416815259367"></a>适配CANN算子IR变更。</p>
</td>
</tr>
<tr id="row2620183971614"><td class="cellrowborder" rowspan="3" valign="top" width="25.590000000000003%" headers="mcps1.2.4.1.1 "><p id="p0819102247"><a name="p0819102247"></a><a name="p0819102247"></a>适配NPU的PyTorch1.8.1特性</p>
<p id="p15488161812213"><a name="p15488161812213"></a><a name="p15488161812213"></a></p>
</td>
<td class="cellrowborder" valign="top" width="15.52%" headers="mcps1.2.4.1.2 "><p id="p76365489137"><a name="p76365489137"></a><a name="p76365489137"></a>框架基础功能</p>
</td>
<td class="cellrowborder" valign="top" width="58.89%" headers="mcps1.2.4.1.3 "><p id="p363616485131"><a name="p363616485131"></a><a name="p363616485131"></a>支持NPU Tensor类型,修复少量BUG</p>
</td>
</tr>
<tr id="row945906124515"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1077934311314"><a name="p1077934311314"></a><a name="p1077934311314"></a>序列化存取</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p977954315133"><a name="p977954315133"></a><a name="p977954315133"></a>支持NPU Tensor直接序列化存取,完善torch.save/load接口能力</p>
</td>
</tr>
<tr id="row13545374516"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p44561110214"><a name="p44561110214"></a><a name="p44561110214"></a>精度对比工具</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p412459182110"><a name="p412459182110"></a><a name="p412459182110"></a>支持溢出检测,优化数据dump性能</p>
</td>
</tr>
<tr id="row3722227133312"><td class="cellrowborder" rowspan="3" valign="top" width="25.590000000000003%" headers="mcps1.2.4.1.1 "><p id="p107221327153315"><a name="p107221327153315"></a><a name="p107221327153315"></a>适配NPU的PyTorch1.11.0特性</p>
</td>
<td class="cellrowborder" valign="top" width="15.52%" headers="mcps1.2.4.1.2 "><p id="p153563917719"><a name="p153563917719"></a><a name="p153563917719"></a>框架基础功能</p>
</td>
<td class="cellrowborder" valign="top" width="58.89%" headers="mcps1.2.4.1.3 "><p id="p272242719336"><a name="p272242719336"></a><a name="p272242719336"></a>支持NPU Tensor类型,修复少量BUG</p>
</td>
</tr>
<tr id="row6631141014305"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1416445591310"><a name="p1416445591310"></a><a name="p1416445591310"></a>序列化存取</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p11164185561312"><a name="p11164185561312"></a><a name="p11164185561312"></a>支持NPU Tensor直接序列化存取,完善torch.save/load接口能力</p>
</td>
</tr>
<tr id="row270811563411"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p121645556134"><a name="p121645556134"></a><a name="p121645556134"></a>精度对比工具</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1716425591313"><a name="p1716425591313"></a><a name="p1716425591313"></a>支持溢出检测,优化数据dump性能</p>
</td>
</tr>
</tbody>
</table>
<h3 id="特性修改md">特性修改</h3>
不涉及
<h3 id="已修复问题md">已修复问题</h3>
不涉及
<h3 id="已知问题md">已知问题</h3>
<a name="table1969972073016"></a>
<table><thead align="left"><tr id="row3699162017307"><th class="cellrowborder" valign="top" width="18.22%" id="mcps1.1.3.1.1"><p id="p16992020153010"><a name="p16992020153010"></a><a name="p16992020153010"></a>已知问题</p>
</th>
<th class="cellrowborder" valign="top" width="81.78%" id="mcps1.1.3.1.2"><p id="p269919203308"><a name="p269919203308"></a><a name="p269919203308"></a>问题描述</p>
</th>
</tr>
</thead>
<tbody><tr id="row9699142003011"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1769932017300"><a name="p1769932017300"></a><a name="p1769932017300"></a>数据类型支持</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p13699152010301"><a name="p13699152010301"></a><a name="p13699152010301"></a>NPU不支持float16类型的inf/nan数据输入输出。</p>
</td>
</tr>
<tr id="row146991520153016"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p156997200308"><a name="p156997200308"></a><a name="p156997200308"></a>数据Format</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p10699182020308"><a name="p10699182020308"></a><a name="p10699182020308"></a>出现4D以上的format时不能降维。</p>
</td>
</tr>
<tr id="row11121205610549"><td class="cellrowborder" rowspan="3" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p1647216219558"><a name="p1647216219558"></a><a name="p1647216219558"></a>集合通信约束</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p3116115695415"><a name="p3116115695415"></a><a name="p3116115695415"></a>要求一次训练任务中不同device上执行的图相同。</p>
</td>
</tr>
<tr id="row51211656105411"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p1311616560541"><a name="p1311616560541"></a><a name="p1311616560541"></a>当前只支持1/2/4/8P粒度的分配。</p>
</td>
</tr>
<tr id="row8647195765419"><td class="cellrowborder" valign="top" headers="mcps1.1.3.1.1 "><p id="p2064225716544"><a name="p2064225716544"></a><a name="p2064225716544"></a>只支持int8,int32,float16和float32数据类型。</p>
</td>
</tr>
<tr id="row4646195719548"><td class="cellrowborder" valign="top" width="18.22%" headers="mcps1.1.3.1.1 "><p id="p4642195718541"><a name="p4642195718541"></a><a name="p4642195718541"></a>Apex功能支持</p>
</td>
<td class="cellrowborder" valign="top" width="81.78%" headers="mcps1.1.3.1.2 "><p id="p864205725412"><a name="p864205725412"></a><a name="p864205725412"></a>Apex当前版本的实现方式主要为python实现,不支持APEX中的自定义优化CUDA Kernel。</p>
</td>
</tr>
</tbody>
</table>
<h3 id="兼容性md">兼容性</h3>
A800-9010:CentOS 7.6/Ubuntu 18.04, 2.04/BC-Linux 7.6/Debian 9.9/Debian 10/OpenEuler 20.03 LTS
A800-9000:CentOS 7.6/Ubuntu 18.04, 2.04/Euler 2.8, 2.10/Kylin v10/BC-Linux 7.6/OpenEuler 20.03 LTS/UOS 20 1020e
<h2 id="FrameworkPTAdapter-3-0-RC3md">FrameworkPTAdapter 3.0.RC3</h2>
<h3 id="用户须知md">用户须知</h3>
本框架基于Facebook主导的开源PyTorch进行修改,延续原生的PyTorch特性,使用NPU进行动态图训练;以算子粒度进行模型适配,代码重用性好,支持现有的网络只修改设备类型或数据类型,即可迁移到NPU上使用。
PyTorch1.8.1版本开始采用插件化适配方式,与原生PyTorch框架实现彻底解耦,功能、性能与PyTorch1.5.0基本保持一致,对后端算子适配提供较好开发体验。
<h3 id="新增特性md">新增特性</h3>
**表 1** PyTorch支持的版本特性列表
| 一级特性 | 二级特性 | 说明 |
| -------------------------- | -------------------------------- | ---------------------------------------------- |
| 适配NPU的PyTorch1.5.0特性 | 框架基础功能 | 适配CANN算子IR变更。 |
| 适配NPU的PyTorch1.8.1特性 | 精度对比工具 | 支持NPU与CPU精度对比工具。 |
| profiling | 支持自定义算子profiling。 | |
| API满足度提升 | 新增部分API适配(详见API清单)。 | |
| 适配NPU的PyTorch1.11.0特性 | 框架基础功能 | 支持模型训练功能,适配算子API(详见API清单)。 |
| 混合精度 | 支持apex混合精度训练。 | |
| 分布式 | 支持DDP分布式训练功能。 | |
| profiling | 支持E2E profiling功能。 | |
<h3 id="特性修改md">特性修改</h3>
不涉及
<h3 id="已修复问题md">已修复问题</h3>
不涉及
<h3 id="已知问题md">已知问题</h3>
| 已知问题 | 问题描述 |
| --------------------------------------------- | ------------------------------------------------------------ |
| 数据类型支持 | NPU不支持float16类型的inf/nan数据输入输出。 |
| 数据Format | 出现4D以上的format时不能降维。 |
| 集合通信约束 | 要求一次训练任务中不同device上执行的图相同。 |
| 当前只支持1/2/4/8P粒度的分配。 | |
| 只支持int8,int32,float16和float32数据类型。 | |
| Apex功能支持 | Apex当前版本的实现方式主要为python实现,不支持APEX中的自定义优化CUDA Kernel。 |
<h3 id="兼容性md">兼容性</h3>
A800-9010:CentOS 7.6/Ubuntu 18.04, 2.04/BC-Linux 7.6/Debian 9.9/Debian 10/OpenEuler 20.03 LTS
A800-9000:CentOS 7.6/Ubuntu 18.04, 2.04/Euler 2.8, 2.10/Kylin v10/BC-Linux 7.6/OpenEuler 20.03 LTS/UOS 20 1020e
<h2 id="FrameworkPTAdapter-3-0-RC2md">FrameworkPTAdapter 3.0.RC2</h2>
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 288 KiB

+5 -1
View File
@@ -25,7 +25,11 @@ backend = None
def transfer_args_of_wrapper_func_to_cpu(sig: DispatcherSignature, func: NativeFunction) -> Tuple[str, List[str]]:
convert: str = f"// Convert args to cpu in order to use at::native kernel \n " \
f"std::cout << \"Cur kernel: {sig.func.name} is running on cpu.\" << std::endl; \n "
f"static auto warn_once = [](){{ \n " \
f"std::cout << \"Warning: kernel [{sig.func.name}] is not supported by NPU currently. " \
f"Now this kernel is running on CPU.\" << std::endl; \n " \
f"return true; \n " \
f"}}(); \n "
args_names: List[str] = []
args = native_arguments(sig.func, func.use_c10_dispatcher)
for arg in args:
@@ -26,6 +26,8 @@
#include <torch/csrc/Device.h>
#include <torch/csrc/tensor/python_tensor.h>
#include "torch_npu/csrc/core/Device.h"
namespace at_npu {
namespace key {
static constexpr c10::DeviceType NativeDeviceType = c10::DeviceType::XLA;
@@ -40,7 +42,7 @@ static bool isDeviceTensor(const at::Tensor &tensor) {
}
static at::Device parse_npu_device(PyObject* obj) {
if (!obj) {
if (!obj || obj == Py_None) {
return at::Device(c10::backendToDeviceType(c10::dispatchKeyToBackend(torch::tensors::get_default_dispatch_key())));
}
if (THPUtils_checkLong(obj)) {
@@ -60,6 +62,8 @@ static at::Device parse_npu_device(PyObject* obj) {
const auto device = reinterpret_cast<THPDevice*>(obj);
return device->device;
}
const auto device = reinterpret_cast<TNPDevice*>(obj);
return device->device;
}
static c10::optional<at::Device> parse_npu_device_optional(PyObject* obj) {
+17 -18
View File
@@ -13,18 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import numpy
import torch
import torch_npu
from torch_npu.utils.device_guard import torch_device_guard, device
@torch_device_guard
def _device(*args, **kwargs):
new_device = torch_npu.new_device(*args, **kwargs)
if new_device.type == torch.npu.native_device:
return device(type=torch_npu.npu.npu_device, index=new_device.index)
return new_device
from torch_npu.utils.device_guard import torch_device_guard
@torch_device_guard
@@ -62,26 +55,31 @@ def _npu_dropout_gen_mask(*args, **kwargs):
return torch_npu.npu_dropout_gen_mask(*args, **kwargs)
@torch_device_guard
def _new_device(*args, **kwargs):
return torch_npu._C.device(*args, **kwargs)
def jit_script(obj, optimize=None, _frames_up=0, _rcb=None):
# (Ascend) Disable extension of torch.jit.script
return obj
def _as_tensor(*args, **kwargs):
if isinstance(args[0], torch.Tensor):
dst_device = args[0].device
else:
dst_device = "cpu"
if kwargs and "device" in kwargs:
dst_device = kwargs.get("device")
if "npu" in str(dst_device):
if isinstance(args[0], numpy.ndarray):
return torch.from_numpy(args[0]).to(dst_device)
else:
return args[0].to(dst_device)
return torch._C._VariableFunctions.as_tensor(*args, **kwargs)
dst_device = kwargs.pop("device")
return torch._C._VariableFunctions.as_tensor(*args, **kwargs).to(dst_device)
${device_methods_def_py_dispatch}
def add_torch_funcs():
torch.device = _device
torch.tensor = _tensor
torch.full = _full
torch.randint = _randint
@@ -91,5 +89,6 @@ def add_torch_funcs():
torch.npu_dropout_gen_mask = _npu_dropout_gen_mask
torch.jit.script = jit_script
torch.as_tensor = _as_tensor
torch.new_device = _new_device
${device_methods_def_py}
+19 -1
View File
@@ -19,10 +19,12 @@ import multiprocessing.pool
import os
import re
import shutil
import stat
import subprocess
import sys
import traceback
import platform
from pathlib import Path
import distutils.ccompiler
import distutils.command.clean
@@ -36,7 +38,21 @@ from setuptools.command.build_clib import build_clib
from setuptools.command.egg_info import egg_info
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
VERSION = '1.8.1rc3'
VERSION = '1.8.1'
def generate_torch_npu_version():
torch_npu_root = Path(__file__).parent
version_path = torch_npu_root / "torch_npu" / "version.py"
if version_path.exists():
version_path.unlink()
flags = os.O_WRONLY | os.O_CREAT | os.O_EXCL
modes = stat.S_IWUSR | stat.S_IRUSR
with os.fdopen(os.open(version_path, flags, modes), 'w') as f:
f.write("__version__ = '{version}'\n".format(version=VERSION))
generate_torch_npu_version()
def which(thefile):
@@ -226,6 +242,8 @@ def get_src_py_and_dst():
ret = []
generated_python_files = glob.glob(
os.path.join(BASE_DIR, "torch_npu", '**/*.py'),
recursive=True) + glob.glob(
os.path.join(BASE_DIR, "torch_npu", '**/*.yaml'),
recursive=True)
for src in generated_python_files:
dst = os.path.join(
+24 -5
View File
@@ -63,19 +63,38 @@ class WN(torch.nn.Module):
class TestSerialization(TestCase):
'''
The saved data is transferred to PyTorch CPU device before being saved, so a
following `torch.load()` will load CPU data.
The saved data is saved by using the PyTorch CPU storage structure, but
following `torch.load()` will load the corresponding NPU data.
'''
def test_save(self):
x = torch.randn(5).npu()
with tempfile.TemporaryDirectory() as tmpdir:
path = os.path.join(tmpdir, 'data.pt')
torch.save(x, path)
self.assertExpectedInline(str(x.device), f'{torch_npu.npu.native_device}:0')
self.assertExpectedInline(f'{x.device.type}:{x.device.index}', f'{torch_npu.npu.npu_device}:0')
x_loaded = torch.load(path, map_location="npu:0")
x_loaded = x_loaded.npu()
self.assertRtolEqual(x.cpu(), x_loaded.cpu())
y_loaded = torch.load(path, map_location="npu")
self.assertRtolEqual(x.cpu(), y_loaded.cpu())
z_loaded = torch.load(path, map_location=torch.device("npu"))
self.assertRtolEqual(x.cpu(), z_loaded.cpu())
m_loaded = torch.load(path, map_location="cpu")
self.assertRtolEqual(x.cpu(), m_loaded)
n_loaded = torch.load(path, map_location=torch.device("cpu"))
self.assertRtolEqual(x.cpu(), n_loaded)
def test_load_maplocation(self):
x = torch.randn(2, 3)
with tempfile.TemporaryDirectory() as tmpdir:
path = os.path.join(tmpdir, 'data.pt')
torch.save(x, path)
x_loaded = torch.load(path, map_location="npu:0")
self.assertExpectedInline(f'{x_loaded.device.type}', f'{torch_npu.npu.npu_device}')
self.assertRtolEqual(x, x_loaded.cpu())
x_loaded = torch.load(path, map_location=torch.device("npu:0"))
self.assertExpectedInline(f'{x_loaded.device.type}', f'{torch_npu.npu.npu_device}')
self.assertRtolEqual(x, x_loaded.cpu())
def test_save_string(self):
x = dict(ds_version='0.6.0+0b40f54')
with tempfile.TemporaryDirectory() as tmpdir:
@@ -100,7 +119,7 @@ class TestSerialization(TestCase):
path = os.path.join(tmpdir, 'data.pt')
torch.save((x, model, number), path)
x_loaded, model_loaded, number_loaded = torch.load(path)
self.assertRtolEqual(x.cpu(), x_loaded)
self.assertRtolEqual(x.cpu(), x_loaded.cpu())
self.assertExpectedInline(str(model), str(model_loaded))
self.assertTrue(number, number_loaded)
+6
View File
@@ -177,6 +177,12 @@ class TestCreationOps(TestCase):
cpu_output = torch.as_tensor(npu_input, device="cpu")
self.assertRtolEqual(cpu_output.numpy(), npu_input.cpu().numpy())
# npu tesor to npu tensor
npu_input = torch.tensor([1, 2, 3]).npu()
npu_output = torch.as_tensor(npu_input)
self.assertEqual(npu_input.device, npu_output.device)
self.assertRtolEqual(npu_input.cpu().numpy(), npu_output.cpu().numpy())
def test_as_strided(self):
x = torch.randn(3, 3, device='npu:0')
npu_output1 = torch.as_strided(x, (2, 2), (1, 2))
+8 -7
View File
@@ -19,7 +19,7 @@ import torch
import torch.nn as nn
import torch.nn.functional as F
import torch_npu
from torch_npu.contrib.module import NpuFairseqDropout
from torch_npu.contrib.module import NpuFairseqDropout, NpuCachedDropout
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
@@ -32,24 +32,25 @@ class NpuMNIST(nn.Module):
self.conv2 = nn.Conv2d(10, 20, kernel_size=5)
self.fc1 = nn.Linear(320, 50)
self.fc2 = nn.Linear(50, 10)
self.dropout = NpuFairseqDropout(p=1)
def forward(self, x):
def forward(self, x, dropout):
x = F.relu(F.max_pool2d(self.conv1(x), 2))
x = F.relu(F.max_pool2d(self.conv2(x), 2))
x = self.dropout(x)
x = dropout(x)
x = x.view(-1, 40)
return x
class TestEnsembleDropout(unittest.TestCase):
def test_EnsembleDropout(self):
model = NpuMNIST().to("npu")
x = torch.randn(2,10,16,16).to("npu")
NpuFairseqDropout.enable_dropout_ensemble(model)
output = model(x)
dropout = NpuFairseqDropout(p=1)
output = model(x, dropout)
NpuCachedDropout.enable_dropout_ensemble(model)
dropout = NpuCachedDropout(p=1)
output = model(x, dropout)
if __name__ == "__main__":
run_tests()
+62
View File
@@ -35,6 +35,8 @@ class TestDevice(TestCase):
npu_tensor = func(self, *args, **kwargs)
self.assertEqual(npu_tensor.device.type, "npu")
self.assertEqual(npu_tensor.device.index, device_id)
kwargs["device"] = None
func(self, *args, **kwargs)
return wrapper
@@ -67,6 +69,66 @@ class TestDevice(TestCase):
cpu_input = torch.randn(2,3)
return cpu_input.npu(device)
@device_monitor
def test_torch_func_tensor_with_device_input(self, device=None):
return torch.tensor((2, 3), device=device)
def test_device_argument_as_input(self):
device_str = "npu:0"
torch.npu.set_device(device_str)
device = torch.device(device_str)
assert isinstance(device, torch.device)
torch.npu.set_device(device)
tensor = torch.rand(2,3).npu()
assert isinstance(tensor.device, torch.device)
assert tensor.device.type == "npu"
assert tensor.device.index == 0
new_device = torch.device(device)
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
new_device = torch.device(device=device)
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
new_device = torch.device(device=device_str)
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
new_device = torch.device(type="npu", index=0)
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
new_device = torch.device(torch._C.device(device_str.replace("npu", "xla")))
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
assert not isinstance(torch._C.device(device_str.replace("npu", "xla")), torch.device)
new_device = torch.new_device(torch._C.device(device_str.replace("npu", "xla")))
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
new_device = torch.new_device(torch.device(device_str))
assert isinstance(new_device, torch.device)
assert new_device.type == "npu"
assert new_device.index == 0
device = torch.device(None)
assert device.type == "cpu"
device = torch.device(device=None)
assert device.type == "cpu"
if __name__ == '__main__':
run_tests()
+6 -4
View File
@@ -12,11 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import os
import numpy as np
import torch
import torch_npu
import numpy as np
import torch.distributed as dist
import torch.multiprocessing as mp
@@ -75,8 +75,10 @@ class HcclReduceTest(TestCase):
for shape in shape_format:
if shape[0] == np.int8:
shape[1] = 0
expected, input1 = create_common_tensor(shape, -10, 10)
expected *= world_size
exp_input, input1 = create_common_tensor(shape, -10, 10)
expected = 0
for _ in range(world_size):
expected += exp_input
self._test_multiprocess(HcclReduceTest._test_reduce,
HcclReduceTest._init_dist_hccl, expected, input1, world_size)
@@ -0,0 +1,133 @@
# 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.
import os
import torch
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.hooks import set_dump_path, seed_all, register_acc_cmp_hook
from torch_npu.hooks.tools import compare
class TestFunctionalOP(torch.nn.Linear):
def forward(self, x):
x1 = torch.nn.functional.linear(x, self.weight, self.bias)
x2 = torch.nn.functional.relu(x1)
if (x2 == 0).any():
return x1
return x2
class TestTensorBuiltinOP(torch.nn.Module):
def forward(self, x, y):
z_add = x + y
z_sub = x - y
z = z_add * z_sub
if (z == z_add).any():
return z_sub
return z
class TestTorchOP(torch.nn.Module):
def forward(self, x, y):
z_add = torch.add(x, y)
z_sub = torch.sub(x, y)
z_relu = torch.relu(z_add)
z = torch.add(z_sub, z_relu)
if (z != z_sub).any():
return z_sub
return z
class TestAccCmpHookBackwardhook(TestCase):
def test_function_op(self):
module = TestFunctionalOP(3, 4)
register_acc_cmp_hook(module)
seed_all()
set_dump_path("./cpu_functional_op.pkl")
x = torch.randn(2, 3, 3)
x.requires_grad = True
out = module(x)
loss = torch.sum(out)
loss.backward()
set_dump_path("./npu_functional_op.pkl")
module.npu()
x = x.npu()
out = module(x)
loss = out.sum()
loss.backward()
assert os.path.exists("./cpu_functional_op.pkl") and os.path.exists("./npu_functional_op.pkl")
compare("./npu_functional_op.pkl", "./cpu_functional_op.pkl", "./functional_op_result.csv")
assert os.path.exists("./functional_op_result.csv")
def test_tensor_bulitin_op(self):
module = TestTensorBuiltinOP()
register_acc_cmp_hook(module)
seed_all()
set_dump_path("./cpu_tensor_builtin_op.pkl")
x = torch.randn(2, 3, 4)
y = torch.randn(2, 3, 4)
x.requires_grad = True
y.requires_grad = True
out = module(x, y)
loss = out.sum()
loss.backward()
set_dump_path("./npu_tensor_builtin_op.pkl")
module.npu()
x = x.npu()
y = y.npu()
out = module(x, y)
loss = out.sum()
loss.backward()
assert os.path.exists("./cpu_tensor_builtin_op.pkl") and os.path.exists("./npu_tensor_builtin_op.pkl")
compare("./npu_tensor_builtin_op.pkl", "./cpu_tensor_builtin_op.pkl", "./tensor_builtin_op_result.csv")
assert os.path.exists("./tensor_builtin_op_result.csv")
def test_tensor_op(self):
module = TestTorchOP()
register_acc_cmp_hook(module)
seed_all()
set_dump_path("./cpu_torch_op.pkl")
x = torch.randn(2, 3, 4)
y = torch.randn(2, 3, 4)
x.requires_grad = True
y.requires_grad = True
out = module(x, y)
loss = torch.sum(out)
loss.backward()
set_dump_path("./npu_torch_op.pkl")
module.npu()
x = x.npu()
y = y.npu()
out = module(x, y)
loss = out.sum()
loss.backward()
assert os.path.exists("./cpu_torch_op.pkl") and os.path.exists("./npu_torch_op.pkl")
compare("./npu_torch_op.pkl", "./cpu_torch_op.pkl", "./torch_op_result.csv")
assert os.path.exists("./torch_op_result.csv")
def tearDown(self) -> None:
for filename in os.listdir('./'):
if filename.endswith(".pkl"):
os.remove("./" + filename)
if __name__ == '__main__':
run_tests()
+93
View File
@@ -0,0 +1,93 @@
# Copyright (c) 2022 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.
import torch
import numpy as np
import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
class TestAminmax(TestCase):
def cpu_op_exec(self, input0):
output = torch._aminmax(input0)
output0 = output[0].numpy()
output1 = output[1].numpy()
return output0, output1
def npu_op_exec(self, input0):
output = torch._aminmax(input0)
output0 = output[0].cpu().numpy()
output1 = output[1].cpu().numpy()
return output0, output1
def cpu_op_dim_exec(self, input0, dim, keepdim):
output = torch._aminmax(input0, dim, keepdim)
output0 = output[0].numpy()
output1 = output[1].numpy()
return output0, output1
def npu_op_dim_exec(self, input0, dim, keepdim):
output = torch._aminmax(input0, dim, keepdim)
output0 = output[0].cpu().numpy()
output1 = output[1].cpu().numpy()
return output0, output1
def test__aminmax_shape_format(self, device="npu"):
shape_format = [
[np.float16, 0, [256, 1000]],
[np.float32, 0, [1000]],
[np.int8, 0, [256, 1000, 4, 4]],
[np.int16, 0, [1000, 128, 3]],
[np.int32, 0, [256]],
[np.uint8, 0, [100, 128, 1000]],
[np.int64, 0, [100, 128, 1000]],
]
for item in shape_format:
cpu_input, npu_input = create_common_tensor(item, 0, 100)
if cpu_input.dtype == torch.half:
cpu_input = cpu_input.to(torch.float)
cpu_output0, cpu_output1 = self.cpu_op_exec(cpu_input)
npu_output0, npu_output1 = self.npu_op_exec(npu_input)
self.assertRtolEqual(cpu_output0.astype(npu_output0.dtype), npu_output0)
self.assertRtolEqual(cpu_output1.astype(npu_output1.dtype), npu_output1)
def test__aminmax_dim_shape_format(self, device="npu"):
shape_format = [
[np.float16, 0, [64, 4]],
[np.float32, 0, [32, 4, 16, 8]],
]
for item in shape_format:
cpu_input, npu_input = create_common_tensor(item, 0, 100)
dim = np.random.randint(len(item[2]))
keepdim = np.random.randint(10) > 4
if cpu_input.dtype == torch.half:
cpu_input = cpu_input.to(torch.float)
cpu_output0, cpu_output1 = self.cpu_op_dim_exec(cpu_input, dim, keepdim)
npu_output0, npu_output1 = self.npu_op_dim_exec(npu_input, dim, keepdim)
self.assertRtolEqual(cpu_output0.astype(npu_output0.dtype), npu_output0)
self.assertRtolEqual(cpu_output1.astype(npu_output1.dtype), npu_output1)
if __name__ == "__main__":
run_tests()
@@ -18,6 +18,7 @@ import numpy as np
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAdaptiveMaxPool2d(TestCase):
@@ -31,6 +32,7 @@ class TestAdaptiveMaxPool2d(TestCase):
output = m(input1)
return output.cpu().numpy()
@graph_mode
def test_adaptiveMaxPool2d_shape_format_fp32_6(self):
format_list = [-1]
# (1, 8, 9) IndexError
@@ -47,6 +49,7 @@ class TestAdaptiveMaxPool2d(TestCase):
self.assertRtolEqual(cpu_output, npu_output, 0.0004)
@graph_mode
def test_adaptiveMaxPool2d_case_in_photo2cartoon(self):
cpu_x = torch.rand(1, 256, 31, 31)
npu_x = cpu_x.npu()
@@ -54,6 +57,7 @@ class TestAdaptiveMaxPool2d(TestCase):
npu_out = F.adaptive_max_pool2d(npu_x, 1)
self.assertRtolEqual(cpu_out, npu_out.cpu(), 0.0003)
@graph_mode
def test_adaptiveMaxPool2d_case_in_photo2cartoon_fp16(self):
cpu_x = torch.rand(1, 256, 31, 31).half()
npu_x = cpu_x.npu()
@@ -19,6 +19,7 @@ import numpy as np
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAdaptiveMaxPool2dBackward(TestCase):
@@ -39,6 +40,7 @@ class TestAdaptiveMaxPool2dBackward(TestCase):
npu_grad = npu_grad.to("cpu")
return npu_grad
@graph_mode
def test_adaptiveMaxPool2d_shape_format_fp32_6(self):
format_list = [0, 3]
shape_list = [(1, 3, 8, 9)]
@@ -55,6 +57,7 @@ class TestAdaptiveMaxPool2dBackward(TestCase):
npu_output = self.npu_op_exec(npu_input, output_size)
self.assertRtolEqual(cpu_output, npu_output)
@graph_mode
def test_adaptiveMaxPool2d_backward_case_in_photo2cartoon(self):
cpu_x = torch.rand(1, 256, 31, 31)
npu_x = cpu_x.npu()
@@ -66,6 +69,7 @@ class TestAdaptiveMaxPool2dBackward(TestCase):
npu_out.backward(torch.ones_like(npu_out))
self.assertRtolEqual(cpu_x.grad, npu_x.grad.cpu(), 0.0003)
@graph_mode
def test_adaptiveMaxPool2d_backward_case_in_photo2cartoon_fp16(self):
cpu_x = torch.rand(1, 256, 31, 31).half()
npu_x = cpu_x.npu()
+4 -1
View File
@@ -13,13 +13,16 @@
# limitations under the License.
import sys
import torch
import torch_npu
import numpy as np
import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
class TestAddCMul(TestCase):
def generate_data(self, min_d, max_d, shape, dtype):
input1 = np.random.uniform(min_d, max_d, shape).astype(dtype)
@@ -13,13 +13,16 @@
import copy
import sys
import torch
import torch_npu
import numpy as np
import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
class Test_AmpForeachNonFiniteCheckAndUnscale_(TestCase):
def generate_data(self, min_d, max_d, shape, dtype, input3):
input1 = np.random.uniform(min_d, max_d, shape).astype(dtype)
+4 -1
View File
@@ -15,9 +15,12 @@
# limitations under the License.
import sys
import torch
import torch_npu
import numpy as np
import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
+27 -2
View File
@@ -19,6 +19,7 @@ import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAvgPool2d(TestCase):
def cpu_op_exec(self, input1, ceil_mode):
@@ -34,7 +35,8 @@ class TestAvgPool2d(TestCase):
output = output.detach().numpy()
return output
def test_avg_pool2d_backward_shape_format_fp16(self, device="npu"):
@graph_mode
def test_avg_pool2d_backward_shape_format_fp16(self):
shape_format = [
[[np.float16, 0, (1, 3, 147, 147)], True],
[[np.float16, 0, (1, 3, 147, 147)], True]
@@ -47,7 +49,8 @@ class TestAvgPool2d(TestCase):
npu_output = self.npu_op_exec(npu_input, item[1])
self.assertRtolEqual(cpu_output, npu_output, prec16=0.002)
def test_avg_pool2d_backward_shape_format_fp32(self, device="npu"):
@graph_mode
def test_avg_pool2d_backward_shape_format_fp32(self):
shape_format = [
[[np.float32, 0, (1, 3, 147, 147)], True],
[[np.float32, 0, (1, 3, 147, 147)], True]
@@ -59,6 +62,28 @@ class TestAvgPool2d(TestCase):
npu_output = self.npu_op_exec(npu_input, item[1])
self.assertRtolEqual(cpu_output, npu_output, 0.0009)
def test_avg_pool2d_3d_fp32(self):
cinput = torch.randn(128, 32, 7)
ninput = cinput.npu()
cmodel = torch.nn.AvgPool2d((4, 5))
nmodel = cmodel.npu()
cpu_output = cmodel(cinput)
npu_output = nmodel(ninput)
self.assertRtolEqual(cpu_output.numpy(), npu_output.cpu().numpy())
def test_avg_pool2d_4d_fp32(self):
cinput = torch.randn(18, 43, 12, 400)
ninput = cinput.npu()
kernel = 13
padding = 6
stride = 10
ceil_mode = True
cmodel = torch.nn.AvgPool2d(kernel, stride = stride, padding = padding, ceil_mode = ceil_mode)
nmodel = cmodel.npu()
cpu_output = cmodel(cinput)
npu_output = nmodel(ninput)
self.assertRtolEqual(cpu_output.numpy(), npu_output.cpu().numpy())
if __name__ == "__main__":
run_tests()
@@ -19,6 +19,7 @@ import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAvgPool2dBackward(TestCase):
@@ -46,7 +47,8 @@ class TestAvgPool2dBackward(TestCase):
return output_grad, output
def test_avg_pool2d_backward_shape_format_fp16(self, device="npu"):
@graph_mode
def test_avg_pool2d_backward_shape_format_fp16(self):
format_list = [0, 3]
shape_list = [(5, 20, 8, 8)]
shape_format = [
@@ -63,7 +65,8 @@ class TestAvgPool2dBackward(TestCase):
self.assertRtolEqual(cpu_output, npu_output)
self.assertRtolEqual(cpu_output_grad, npu_output_grad)
def test_avg_pool2d_backward_shape_format_fp32(self, device="npu"):
@graph_mode
def test_avg_pool2d_backward_shape_format_fp32(self):
format_list = [0, 3]
shape_list = [(5, 20, 8, 8)]
shape_format = [
+5 -2
View File
@@ -20,6 +20,7 @@ import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAvgPool3D(TestCase):
@@ -39,7 +40,8 @@ class TestAvgPool3D(TestCase):
output_data = m(input1)
return output_data
def test_avg_pool_3d_fp32(self, device="npu"):
@graph_mode
def test_avg_pool_3d_fp32(self):
shape_format = [
[[np.float32, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)],
[[np.float32, -1, (2, 1, 4, 4, 4)], 3, 2],
@@ -53,7 +55,8 @@ class TestAvgPool3D(TestCase):
cpu_output = self.cpu_op_exec(item[1], item[2], cpu_input1)
self.assertRtolEqual(cpu_output, npu_output.cpu(), 1.e-3)
def test_avg_pool_3d_fp16(self, device="npu"):
@graph_mode
def test_avg_pool_3d_fp16(self):
shape_format = [
[[np.float16, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)],
[[np.float16, -1, (2, 1, 4, 4, 4)], 3, 2],
@@ -20,6 +20,7 @@ import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.common_utils import create_common_tensor
from torch_npu.testing.decorator import graph_mode
class TestAvgPool3DBackward(TestCase):
@@ -57,7 +58,8 @@ class TestAvgPool3DBackward(TestCase):
output = output.detach().numpy()
return output_grad, output
def test_avg_pool_3d_fp32(self, device="npu"):
@graph_mode
def test_avg_pool_3d_fp32(self):
shape_format = [
[[np.float32, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)],
[[np.float32, -1, (2, 1, 4, 4, 4)], 3, 2],
@@ -72,7 +74,8 @@ class TestAvgPool3DBackward(TestCase):
self.assertRtolEqual(cpu_output, npu_output, 1.e-3)
self.assertRtolEqual(cpu_output_grad, npu_output_grad, 1.e-3)
def test_avg_pool_3d_fp16(self, device="npu"):
@graph_mode
def test_avg_pool_3d_fp16(self):
shape_format = [
[[np.float16, -1, (20, 16, 50, 44, 31)], (3, 2, 2), (2, 1, 2)],
[[np.float16, -1, (2, 1, 4, 4, 4)], 3, 2],
@@ -16,9 +16,12 @@ import torch
import torch_npu
from torch_npu.testing.testcase import TestCase, run_tests
from torch_npu.testing.decorator import graph_mode
class TestBatchNormElemt(TestCase):
def test_batch_norm_elent(self, device="npu"):
@graph_mode
def test_batch_norm_elent(self):
input1 = torch.tensor([[1.], [2.], [3.]]).npu()
weight = torch.tensor([1.]).npu()
bias = torch.tensor([10.]).npu()
@@ -29,7 +32,8 @@ class TestBatchNormElemt(TestCase):
expect_out = torch.tensor([[8.], [10.], [12.]])
self.assertRtolEqual(expect_out, out.cpu())
def test_batch_norm_elent_out(self, device="npu"):
@graph_mode
def test_batch_norm_elent_out(self):
input1 = torch.tensor([[1.], [2.], [3.]]).npu()
weight = torch.tensor([1.]).npu()
bias = torch.tensor([10.]).npu()

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