mindspore 2.3.0rc1__cp37-none-any.whl → 2.3.0rc2__cp37-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mindspore might be problematic. Click here for more details.

Files changed (316) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +1 -1
  3. mindspore/_akg/akg/utils/tbe_codegen_utils.py +13 -3
  4. mindspore/_c_dataengine.cpython-37m-aarch64-linux-gnu.so +0 -0
  5. mindspore/_c_expression.cpython-37m-aarch64-linux-gnu.so +0 -0
  6. mindspore/_checkparam.py +20 -0
  7. mindspore/_extends/parse/parser.py +1 -1
  8. mindspore/_extends/parse/standard_method.py +6 -5
  9. mindspore/_mindspore_offline_debug.cpython-37m-aarch64-linux-gnu.so +0 -0
  10. mindspore/amp.py +5 -5
  11. mindspore/bin/cache_admin +0 -0
  12. mindspore/bin/cache_server +0 -0
  13. mindspore/boost/boost_cell_wrapper.py +1 -1
  14. mindspore/boost/group_loss_scale_manager.py +1 -1
  15. mindspore/common/__init__.py +4 -2
  16. mindspore/common/_register_for_recompute.py +48 -0
  17. mindspore/common/_stub_tensor.py +1 -0
  18. mindspore/common/api.py +56 -4
  19. mindspore/common/dtype.py +5 -3
  20. mindspore/common/dump.py +2 -2
  21. mindspore/common/hook_handle.py +51 -4
  22. mindspore/common/initializer.py +1 -1
  23. mindspore/common/jit_config.py +17 -6
  24. mindspore/common/parameter.py +7 -2
  25. mindspore/common/recompute.py +247 -0
  26. mindspore/common/sparse_tensor.py +2 -2
  27. mindspore/common/symbol.py +1 -1
  28. mindspore/common/tensor.py +74 -36
  29. mindspore/communication/__init__.py +3 -3
  30. mindspore/communication/management.py +30 -30
  31. mindspore/context.py +28 -15
  32. mindspore/dataset/__init__.py +5 -5
  33. mindspore/dataset/audio/__init__.py +2 -2
  34. mindspore/dataset/audio/transforms.py +51 -51
  35. mindspore/dataset/callback/ds_callback.py +2 -2
  36. mindspore/dataset/engine/cache_client.py +1 -1
  37. mindspore/dataset/engine/datasets.py +3 -3
  38. mindspore/dataset/engine/datasets_audio.py +14 -14
  39. mindspore/dataset/engine/datasets_standard_format.py +3 -3
  40. mindspore/dataset/engine/datasets_text.py +38 -38
  41. mindspore/dataset/engine/datasets_user_defined.py +3 -3
  42. mindspore/dataset/engine/datasets_vision.py +68 -68
  43. mindspore/dataset/text/__init__.py +3 -3
  44. mindspore/dataset/text/transforms.py +26 -26
  45. mindspore/dataset/transforms/__init__.py +1 -1
  46. mindspore/dataset/vision/__init__.py +3 -3
  47. mindspore/dataset/vision/transforms.py +92 -92
  48. mindspore/dataset/vision/utils.py +1 -1
  49. mindspore/experimental/optim/adadelta.py +2 -2
  50. mindspore/experimental/optim/adagrad.py +2 -2
  51. mindspore/experimental/optim/adam.py +2 -2
  52. mindspore/experimental/optim/adamax.py +2 -2
  53. mindspore/experimental/optim/adamw.py +2 -2
  54. mindspore/experimental/optim/asgd.py +2 -2
  55. mindspore/experimental/optim/lr_scheduler.py +24 -20
  56. mindspore/experimental/optim/nadam.py +2 -2
  57. mindspore/experimental/optim/optimizer.py +1 -1
  58. mindspore/experimental/optim/radam.py +2 -2
  59. mindspore/experimental/optim/rmsprop.py +2 -2
  60. mindspore/experimental/optim/rprop.py +2 -2
  61. mindspore/experimental/optim/sgd.py +2 -2
  62. mindspore/hal/stream.py +2 -0
  63. mindspore/include/mindapi/base/types.h +5 -0
  64. mindspore/lib/libdnnl.so.2 +0 -0
  65. mindspore/lib/libmindspore.so +0 -0
  66. mindspore/lib/libmindspore_backend.so +0 -0
  67. mindspore/lib/libmindspore_common.so +0 -0
  68. mindspore/lib/libmindspore_core.so +0 -0
  69. mindspore/lib/libmindspore_gpr.so.15 +0 -0
  70. mindspore/lib/libmindspore_grpc++.so.1 +0 -0
  71. mindspore/lib/libmindspore_grpc.so.15 +0 -0
  72. mindspore/lib/libmindspore_shared_lib.so +0 -0
  73. mindspore/lib/libopencv_core.so.4.5 +0 -0
  74. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
  75. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +6 -6
  76. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
  77. mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
  78. mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
  79. mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
  80. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
  81. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
  82. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
  83. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +101787 -98559
  84. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
  85. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
  86. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/base/op_register.h +2 -2
  87. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/mix.h +8 -1
  88. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/norm.h +5 -3
  89. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/reduce.h +2 -2
  90. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/backend.h +3 -3
  91. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/rtbackend.h +3 -3
  92. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/base/types.h +0 -1
  93. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/module/module.h +3 -3
  94. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/svector/svector.h +3 -2
  95. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
  96. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
  97. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/tiling/add_tiling.h +9 -9
  98. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +2 -6
  99. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb.h +2 -2
  100. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_base.h +460 -0
  101. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_bf16.h +217 -0
  102. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp16.h +116 -0
  103. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_tiling.h +16 -24
  104. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_value.h +27 -0
  105. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -4
  106. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/FlashAttentionScore_impl.h → flash_attention_score/flash_attention_score_impl.h} +2 -1
  107. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/bs_attention_tiling.h → flash_attention_score/flash_attention_score_tiling.h} +15 -19
  108. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/gelu/tiling/gelu_tiling.h +7 -9
  109. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/lccl/lccl_wrapper.h +58 -0
  110. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +19 -8
  111. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_common_tiling.h +18 -8
  112. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_info.h +7 -4
  113. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/tiling_data.h +44 -6
  114. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_utils.h +65 -0
  115. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +10 -6
  116. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +4 -1
  117. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +41 -0
  118. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/PagedAttention_impl.h → paged_attention/paged_attention_impl.h} +1 -1
  119. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +63 -0
  120. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/add_param.h +2 -2
  121. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention_param.h → param/attention_param.h} +11 -2
  122. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +37 -0
  123. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +45 -0
  124. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache/reshape_and_cache_tiling.h +1 -2
  125. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm.h +23 -0
  126. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_base.h +175 -0
  127. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_normal.h +276 -0
  128. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_split_d.h +280 -0
  129. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/tiling_data.h +35 -0
  130. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +45 -0
  131. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/kernel/sub_kernel.h +20 -0
  132. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +47 -0
  133. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_tiling.h +25 -0
  134. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +323 -23
  135. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/types.h +15 -4
  136. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +8 -0
  137. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
  138. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
  139. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
  140. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
  141. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
  142. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
  143. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
  144. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
  145. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
  146. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
  147. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
  148. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
  149. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
  150. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
  151. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
  152. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
  153. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
  154. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
  155. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
  156. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
  157. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
  158. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
  159. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
  160. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
  161. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
  162. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal.h +22 -0
  163. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_comm.h +70 -0
  164. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_types.h +103 -0
  165. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl.h +47 -0
  166. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl_wrapper.h +58 -0
  167. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcoc.h +154 -0
  168. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
  169. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
  170. mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
  171. mindspore/log.py +2 -2
  172. mindspore/mint/__init__.py +457 -0
  173. mindspore/mint/nn/__init__.py +430 -0
  174. mindspore/mint/nn/functional.py +424 -0
  175. mindspore/mint/optim/__init__.py +24 -0
  176. mindspore/mint/optim/adamw.py +186 -0
  177. mindspore/multiprocessing/__init__.py +4 -0
  178. mindspore/nn/__init__.py +3 -0
  179. mindspore/nn/cell.py +51 -47
  180. mindspore/nn/extend/__init__.py +29 -0
  181. mindspore/nn/extend/basic.py +140 -0
  182. mindspore/nn/extend/embedding.py +143 -0
  183. mindspore/nn/extend/layer/__init__.py +27 -0
  184. mindspore/nn/extend/layer/normalization.py +107 -0
  185. mindspore/nn/extend/pooling.py +117 -0
  186. mindspore/nn/generator.py +297 -0
  187. mindspore/nn/layer/basic.py +109 -1
  188. mindspore/nn/layer/container.py +2 -2
  189. mindspore/nn/layer/conv.py +6 -6
  190. mindspore/nn/layer/embedding.py +1 -1
  191. mindspore/nn/layer/normalization.py +21 -43
  192. mindspore/nn/layer/padding.py +4 -0
  193. mindspore/nn/optim/ada_grad.py +2 -2
  194. mindspore/nn/optim/adadelta.py +1 -1
  195. mindspore/nn/optim/adafactor.py +1 -1
  196. mindspore/nn/optim/adam.py +7 -7
  197. mindspore/nn/optim/adamax.py +2 -2
  198. mindspore/nn/optim/adasum.py +2 -2
  199. mindspore/nn/optim/asgd.py +2 -2
  200. mindspore/nn/optim/ftrl.py +1 -1
  201. mindspore/nn/optim/lamb.py +3 -3
  202. mindspore/nn/optim/lars.py +1 -1
  203. mindspore/nn/optim/lazyadam.py +2 -2
  204. mindspore/nn/optim/momentum.py +2 -2
  205. mindspore/nn/optim/optimizer.py +2 -2
  206. mindspore/nn/optim/proximal_ada_grad.py +2 -2
  207. mindspore/nn/optim/rmsprop.py +2 -2
  208. mindspore/nn/optim/rprop.py +2 -2
  209. mindspore/nn/optim/sgd.py +2 -2
  210. mindspore/nn/optim/thor.py +2 -2
  211. mindspore/nn/wrap/cell_wrapper.py +9 -9
  212. mindspore/nn/wrap/grad_reducer.py +5 -5
  213. mindspore/ops/_grad_experimental/grad_comm_ops.py +4 -2
  214. mindspore/ops/_vmap/vmap_grad_nn_ops.py +41 -2
  215. mindspore/ops/_vmap/vmap_math_ops.py +27 -8
  216. mindspore/ops/_vmap/vmap_nn_ops.py +66 -8
  217. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +73 -1
  218. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +12 -3
  219. mindspore/ops/auto_generate/gen_arg_handler.py +24 -0
  220. mindspore/ops/auto_generate/gen_extend_func.py +274 -0
  221. mindspore/ops/auto_generate/gen_ops_def.py +889 -22
  222. mindspore/ops/auto_generate/gen_ops_prim.py +3541 -253
  223. mindspore/ops/auto_generate/pyboost_inner_prim.py +282 -0
  224. mindspore/ops/composite/multitype_ops/_compile_utils.py +2 -1
  225. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +9 -0
  226. mindspore/ops/extend/__init__.py +9 -1
  227. mindspore/ops/extend/array_func.py +134 -27
  228. mindspore/ops/extend/math_func.py +3 -3
  229. mindspore/ops/extend/nn_func.py +363 -2
  230. mindspore/ops/function/__init__.py +19 -2
  231. mindspore/ops/function/array_func.py +463 -439
  232. mindspore/ops/function/clip_func.py +7 -18
  233. mindspore/ops/function/grad/grad_func.py +5 -5
  234. mindspore/ops/function/linalg_func.py +4 -4
  235. mindspore/ops/function/math_func.py +260 -243
  236. mindspore/ops/function/nn_func.py +825 -62
  237. mindspore/ops/function/random_func.py +73 -4
  238. mindspore/ops/function/sparse_unary_func.py +1 -1
  239. mindspore/ops/function/vmap_func.py +1 -1
  240. mindspore/ops/functional.py +2 -2
  241. mindspore/ops/op_info_register.py +1 -31
  242. mindspore/ops/operations/__init__.py +2 -3
  243. mindspore/ops/operations/_grad_ops.py +2 -107
  244. mindspore/ops/operations/_inner_ops.py +5 -5
  245. mindspore/ops/operations/_sequence_ops.py +2 -2
  246. mindspore/ops/operations/array_ops.py +11 -233
  247. mindspore/ops/operations/comm_ops.py +32 -32
  248. mindspore/ops/operations/custom_ops.py +7 -89
  249. mindspore/ops/operations/manually_defined/ops_def.py +329 -4
  250. mindspore/ops/operations/math_ops.py +13 -163
  251. mindspore/ops/operations/nn_ops.py +9 -316
  252. mindspore/ops/operations/random_ops.py +1 -1
  253. mindspore/ops/operations/sparse_ops.py +3 -3
  254. mindspore/ops/primitive.py +2 -2
  255. mindspore/ops_generate/arg_dtype_cast.py +12 -3
  256. mindspore/ops_generate/arg_handler.py +24 -0
  257. mindspore/ops_generate/gen_ops_inner_prim.py +2 -0
  258. mindspore/ops_generate/gen_pyboost_func.py +13 -6
  259. mindspore/ops_generate/pyboost_utils.py +2 -17
  260. mindspore/parallel/__init__.py +3 -2
  261. mindspore/parallel/_auto_parallel_context.py +106 -1
  262. mindspore/parallel/_parallel_serialization.py +34 -2
  263. mindspore/parallel/_utils.py +16 -0
  264. mindspore/parallel/algo_parameter_config.py +4 -4
  265. mindspore/parallel/checkpoint_transform.py +249 -77
  266. mindspore/parallel/cluster/process_entity/_api.py +1 -1
  267. mindspore/parallel/parameter_broadcast.py +1 -1
  268. mindspore/parallel/shard.py +1 -1
  269. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +1 -0
  270. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +17 -5
  271. mindspore/profiler/parser/ascend_msprof_exporter.py +3 -3
  272. mindspore/profiler/parser/ascend_msprof_generator.py +10 -3
  273. mindspore/profiler/parser/ascend_op_generator.py +26 -9
  274. mindspore/profiler/parser/ascend_timeline_generator.py +7 -4
  275. mindspore/profiler/parser/profiler_info.py +11 -1
  276. mindspore/profiler/profiling.py +13 -5
  277. mindspore/rewrite/api/node.py +12 -12
  278. mindspore/rewrite/api/symbol_tree.py +11 -11
  279. mindspore/run_check/_check_version.py +1 -1
  280. mindspore/safeguard/rewrite_obfuscation.py +2 -2
  281. mindspore/train/amp.py +4 -4
  282. mindspore/train/anf_ir_pb2.py +8 -2
  283. mindspore/train/callback/_backup_and_restore.py +2 -2
  284. mindspore/train/callback/_callback.py +4 -4
  285. mindspore/train/callback/_checkpoint.py +2 -2
  286. mindspore/train/callback/_early_stop.py +2 -2
  287. mindspore/train/callback/_landscape.py +4 -4
  288. mindspore/train/callback/_loss_monitor.py +2 -2
  289. mindspore/train/callback/_on_request_exit.py +2 -2
  290. mindspore/train/callback/_reduce_lr_on_plateau.py +2 -2
  291. mindspore/train/callback/_summary_collector.py +2 -2
  292. mindspore/train/callback/_time_monitor.py +2 -2
  293. mindspore/train/dataset_helper.py +8 -3
  294. mindspore/train/loss_scale_manager.py +2 -2
  295. mindspore/train/metrics/metric.py +3 -3
  296. mindspore/train/mind_ir_pb2.py +22 -17
  297. mindspore/train/model.py +15 -15
  298. mindspore/train/serialization.py +18 -18
  299. mindspore/train/summary/summary_record.py +7 -7
  300. mindspore/train/train_thor/convert_utils.py +3 -3
  301. mindspore/version.py +1 -1
  302. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +1 -1
  303. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +307 -260
  304. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/tiling_data.h +0 -59
  305. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BNSD_mix.o +0 -0
  306. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BSH_mix.o +0 -0
  307. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BNSD_mix.o +0 -0
  308. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BSH_mix.o +0 -0
  309. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BNSD_mix.o +0 -0
  310. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BSH_mix.o +0 -0
  311. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BNSD_mix.o +0 -0
  312. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BSH_mix.o +0 -0
  313. /mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/bs_attention_mix_hwsync.h → flash_attention_score/kernel/flash_attention_score_mix_hwsync.h} +0 -0
  314. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
  315. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
  316. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
@@ -28,14 +28,17 @@ from mindspore.common.tensor import Tensor
28
28
  from mindspore.ops.operations.random_ops import RandomShuffle, RandomChoiceWithMask
29
29
  from mindspore.common.api import _function_forbid_reuse
30
30
  from mindspore.ops.auto_generate import randperm
31
+ from mindspore.nn.generator import default_generator
32
+ from mindspore.ops.auto_generate import UniformExt, NormalExt
31
33
 
32
-
34
+ normal_ext_op = NormalExt()
33
35
  cast_ = P.Cast()
34
36
  log_ = P.Log()
35
37
  real_div_ = P.RealDiv()
36
38
  reshape_ = P.Reshape()
37
39
  shape_ = P.Shape()
38
40
  top_k_ = P.TopK()
41
+ uniform_ = UniformExt()
39
42
 
40
43
  @constexpr
41
44
  def _set_prim_op_user_data(prim, key, value):
@@ -234,6 +237,37 @@ def multinomial_with_replacement(x, seed, offset, numsamples, replacement=False)
234
237
  return multinomial_with_replacement_(x, seed, offset)
235
238
 
236
239
 
240
+ @_function_forbid_reuse
241
+ def uniform_ext(tensor, a, b, generator=None):
242
+ """
243
+ Generates random numbers in the half-open interval [a, b).
244
+
245
+ Args:
246
+ tensor (Tensor): The origin input tensor.
247
+ a (float): The lower bound of the interval.
248
+ b (float): The upper bound of the interval.
249
+ generator (Generator, optional): The random seed. Default: None.
250
+
251
+ Raises:
252
+ TypeError: If `a` is larger than `b`.
253
+
254
+ Returns:
255
+ Tensor, with the same shape as tensor.
256
+
257
+ Examples:
258
+ >>> from mindspore import Tensor, ops
259
+ >>> import mindspore
260
+ >>> import numpy as np
261
+ >>> x = mindspore.ops.ones(4, 2)
262
+ >>> output = ops.uniform_ext(x, 1., 2.)
263
+ >>> print(result)
264
+ """
265
+ if generator is None:
266
+ generator = default_generator()
267
+ seed, offset = generator(1)
268
+ return uniform_(tensor, a, b, seed, offset)
269
+
270
+
237
271
  @_function_forbid_reuse
238
272
  def uniform(shape, minval, maxval, seed=None, dtype=mstype.float32):
239
273
  """
@@ -628,6 +662,41 @@ def is_cpu_backend():
628
662
  """Check if the CPU is used"""
629
663
  return context.get_context('device_target') == 'CPU'
630
664
 
665
+ def normal_ext(mean, std, generator=None):
666
+ r"""
667
+ Generates random numbers according to the standard Normal (or Gaussian) random number distribution.
668
+
669
+ Args:
670
+ - **mean** (Union[float, Tensor]) - The mean is a tensor with the mean of each output
671
+ element's normal distribution.
672
+ - **std** (Union[float, Tensor]) - The tensor of per-element standard deviations.
673
+ - **generator** (Generator, optional) - Mindspore generator.
674
+
675
+ Returns:
676
+ - **output** (Tensor) - With the same type and shape as the 'mean'.
677
+
678
+ Raises:
679
+ TypeError: If `mean` or `std` is not Union[float, Tensor].
680
+
681
+ Supported Platforms:
682
+ ``Ascend``
683
+
684
+ Examples:
685
+ >>> import mindspore
686
+ >>> import numpy as np
687
+ >>> import mindspore.ops as ops
688
+ >>> from mindspore import Tensor
689
+ >>> mean = Tensor(np.array([1.0, 2.0, 3.0]), mindspore.float32)
690
+ >>> std = Tensor(np.array([1.0, 2.0, 3.0]), mindspore.float32)
691
+ >>> output = ops.normal_ext(mean, std)
692
+ >>> print(output.shape)
693
+ (3,)
694
+ """
695
+ if generator is None:
696
+ generator = default_generator()
697
+ seed, offset = generator(1)
698
+ return normal_ext_op(mean, std, seed, offset)
699
+
631
700
 
632
701
  @_function_forbid_reuse
633
702
  def normal(shape, mean, stddev, seed=None):
@@ -1329,9 +1398,9 @@ def _check_param(op_name, param_name, param_value):
1329
1398
 
1330
1399
 
1331
1400
  __all__ = [
1332
- 'standard_laplace', 'random_categorical', 'uniform', 'standard_normal', 'random_gamma',
1401
+ 'standard_laplace', 'random_categorical', 'uniform', 'uniform_ext', 'standard_normal', 'random_gamma',
1333
1402
  'uniform_candidate_sampler', 'random_poisson', 'log_uniform_candidate_sampler', 'shuffle', 'choice_with_mask',
1334
- 'normal', 'laplace', 'gamma', 'poisson', 'multinomial', 'rand', 'rand_like', 'randn', 'randn_like', 'randint',
1335
- 'randint_like', 'multinomial_with_replacement', 'randperm'
1403
+ 'normal_ext', 'normal', 'laplace', 'gamma', 'poisson', 'multinomial', 'rand', 'rand_like', 'randn', 'randn_like',
1404
+ 'randint', 'randint_like', 'multinomial_with_replacement', 'randperm'
1336
1405
  ]
1337
1406
  __all__.sort()
@@ -375,7 +375,7 @@ def coo_relu(x: COOTensor) -> COOTensor:
375
375
  Args:
376
376
  x (COOTensor): Input COOTensor with shape :math:`(N, *)`, where :math:`*`
377
377
  means any number of additional dimensions. Its dtype is
378
- `number <https://www.mindspore.cn/docs/en/r2.3.q1/api_python/mindspore.html#mindspore.dtype>`_.
378
+ `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_.
379
379
 
380
380
  Returns:
381
381
  COOTensor, has the same shape and dtype as the `x`.
@@ -27,7 +27,7 @@ def vmap(fn, in_axes=0, out_axes=0):
27
27
  Vmap is pioneered by Jax and it removes the restriction of batch dimension on the operator, and provides a
28
28
  more convenient and unified operator expression. Moreover, it allows users to composite with other functional
29
29
  modules such as :func:`mindspore.grad`, to improve the development efficiency, please refer to the
30
- `Automatic Vectorization (Vmap) <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/vmap/vmap.html>`_ tutorial
30
+ `Automatic Vectorization (Vmap) <https://www.mindspore.cn/tutorials/experts/en/master/vmap/vmap.html>`_ tutorial
31
31
  for more detail. In addition, the vectorizing map does not execute loops outside the function, but sinks loops
32
32
  into the primitive operations of the function for better performance. When combined with `Graph Kernel Fusion`,
33
33
  operational efficiency would be further improved.
@@ -20,7 +20,7 @@ from mindspore.common._register_for_tensor import tensor_operator_registry
20
20
  from mindspore.ops import _constants
21
21
  from mindspore.ops.function import *
22
22
  from mindspore.ops.function.array_func import narrow, flatten
23
- from mindspore.ops.function.math_func import all
23
+ from mindspore.ops.function.math_func import all, argmax
24
24
  from mindspore.ops import operations as P
25
25
  from mindspore.ops.operations import array_ops
26
26
  from mindspore.ops.operations._sequence_ops import TensorToTuple
@@ -36,7 +36,7 @@ from mindspore.ops import auto_generate
36
36
  from mindspore.ops_generate.gen_ops_inner_prim import DtypeToEnum
37
37
  from mindspore.ops.operations.manually_defined.ops_def import scalar_div, scalar_mod, scalar_add, scalar_mul,\
38
38
  scalar_sub, scalar_gt, scalar_ge, scalar_le, scalar_lt, scalar_eq, scalar_floordiv, scalar_log, scalar_pow,\
39
- scalar_uadd, scalar_usub
39
+ scalar_uadd, scalar_usub, flash_attention_score
40
40
 
41
41
  typeof = Primitive('typeof')
42
42
  hastype = Primitive('hastype')
@@ -235,7 +235,7 @@ class _CustomInstaller:
235
235
  # generate and copy reg info file
236
236
  op_info = self._gen_ai_core_reg_info(imply_path, self.func.__name__)
237
237
  self._copy_file(imply_path, self.ai_core_impl_dir)
238
- for arc_name in ["ascend910", "ascend910b", "ascend910c"]:
238
+ for arc_name in ["ascend910", "ascend910b", "ascend910c", "ascend310p"]:
239
239
  arc_dir = os.path.join(self.ai_core_config_dir, arc_name)
240
240
  _CustomInstaller._create_dir(arc_dir)
241
241
  self._save_op_info(arc_dir, "aic-{}-ops-info.json".format(arc_name), op_info)
@@ -1047,11 +1047,6 @@ class CustomRegOp(RegOp):
1047
1047
  TypeError: If `index` is neither int nor None.
1048
1048
  TypeError: If `name` is neither str nor None.
1049
1049
  TypeError: If `param_type` is neither str nor None.
1050
-
1051
- Tutorial Examples:
1052
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1053
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1054
- defining-custom-operator-of-aicpu-type>`_
1055
1050
  """
1056
1051
  param_list = [index, name, param_type]
1057
1052
  key_list = ["index", "name", "paramType"]
@@ -1087,11 +1082,6 @@ class CustomRegOp(RegOp):
1087
1082
  TypeError: If `index` is neither int nor None.
1088
1083
  TypeError: If `name` is neither str nor None.
1089
1084
  TypeError: If `param_type` is neither str nor None.
1090
-
1091
- Tutorial Examples:
1092
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1093
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1094
- defining-custom-operator-of-aicpu-type>`_
1095
1085
  """
1096
1086
  param_list = [index, name, param_type]
1097
1087
  key_list = ["index", "name", "paramType"]
@@ -1115,11 +1105,6 @@ class CustomRegOp(RegOp):
1115
1105
 
1116
1106
  Raises:
1117
1107
  ValueError: If the size of `args` not equal to the sum of input tensors and output tensors.
1118
-
1119
- Tutorial Examples:
1120
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1121
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1122
- defining-custom-operator-of-aicpu-type>`_
1123
1108
  """
1124
1109
  io_nums = len(self.inputs) + len(self.outputs)
1125
1110
  if len(args) != io_nums:
@@ -1172,11 +1157,6 @@ class CustomRegOp(RegOp):
1172
1157
  TypeError: If `param_type` is neither str nor None.
1173
1158
  TypeError: If `value_type` is neither str nor None.
1174
1159
  TypeError: If `default_value` is neither str nor None.
1175
-
1176
- Tutorial Examples:
1177
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1178
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1179
- defining-custom-operator-of-aicpu-type>`_
1180
1160
  """
1181
1161
  param_list = [name, param_type, value_type, default_value]
1182
1162
  key_list = ["name", "paramType", "type", "defaultValue"]
@@ -1198,11 +1178,6 @@ class CustomRegOp(RegOp):
1198
1178
 
1199
1179
  Raises:
1200
1180
  TypeError: If `target` is neither str nor None.
1201
-
1202
- Tutorial Examples:
1203
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1204
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1205
- defining-custom-operator-of-aicpu-type>`_
1206
1181
  """
1207
1182
  if target is not None:
1208
1183
  self._is_string(target)
@@ -1213,11 +1188,6 @@ class CustomRegOp(RegOp):
1213
1188
  """
1214
1189
  Return the generated registration information as a dict. This function should be invoked at last on the
1215
1190
  `CustomRegOp` instance as shown in the above example.
1216
-
1217
- Tutorial Examples:
1218
- - `Custom Operators (Custom-based) - Defining Custom Operator of aicpu Type
1219
- <https://mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html#
1220
- defining-custom-operator-of-aicpu-type>`_
1221
1191
  """
1222
1192
  op_info = {}
1223
1193
  for k, v in self.__dict__.items():
@@ -22,13 +22,13 @@ A collection of operators to build neural networks or to compute functions.
22
22
  from ._embedding_cache_ops import (CacheSwapTable, UpdateCache, MapCacheIdx, SubAndFilter,
23
23
  MapUniform, DynamicAssign, PadAndShift)
24
24
  from ._inner_ops import (MatmulDDS, DSDMatmul, Cummin, ExtractImagePatches, SelectView, CopyWithSlice)
25
+ from ._ms_kernel import (ms_kernel, kernel)
25
26
  from ._quant_ops import *
26
27
  from ._thor_ops import (CusBatchMatMul, CusCholeskyTrsm, CusFusedAbsMax1, CusImg2Col, CusMatMulCubeDenseLeft,
27
28
  CusMatMulCubeFraczRightMul, CusMatMulCube, CusMatrixCombine, CusTranspose02314,
28
29
  CusMatMulCubeDenseRight, CusMatMulCubeFraczLeftCast, NewIm2Col,
29
30
  LoadIm2Col, UpdateThorGradient, CholeskyTrsm,
30
31
  DetTriangle, ProdForceSeA)
31
- from ._ms_kernel import (ms_kernel, kernel)
32
32
  from .array_ops import (ArgMaxWithValue, ArgMinWithValue, Argmax, Argmin, BatchToSpace,
33
33
  BatchToSpaceNDV2, BroadcastTo, Cast, Coalesce, Concat, Cummax, DType, DepthToSpace, Diag,
34
34
  DiagPart, EditDistance, EmbeddingLookup, ExpandDims, ExtractVolumePatches,
@@ -118,7 +118,7 @@ from .nn_ops import (LSTM, SGD, Adam, AdamWeightDecay, FusedSparseAdam, FusedSpa
118
118
  FractionalMaxPool, FractionalMaxPool3DWithFixedKsize, FractionalMaxPoolWithFixedKsize,
119
119
  GridSampler2D, TripletMarginLoss, UpsampleNearest3D, UpsampleTrilinear3D, PadV3, ChannelShuffle,
120
120
  GLU, MaxUnpool3D, Pdist, RmsNorm, PagedAttention, PagedAttentionMask, ReshapeAndCache,
121
- ApplyRotaryPosEmb, MatmulQkv)
121
+ ApplyRotaryPosEmb)
122
122
  from .other_ops import (Assign, IOU, BoundingBoxDecode, BoundingBoxEncode,
123
123
  ConfusionMatrix, UpdateState, Load, StopGradient, Reusing,
124
124
  CheckValid, Partial, Depend, Push, Pull, PyExecute, PyFunc, _DynamicLossScale,
@@ -695,7 +695,6 @@ __all__ = [
695
695
  "ReshapeAndCache",
696
696
  "ApplyRotaryPosEmb",
697
697
  "RmsNorm",
698
- "MatmulQkv"
699
698
  ]
700
699
 
701
700
  __custom__ = [
@@ -34,7 +34,8 @@ from ..auto_generate import (AbsGrad, ACosGrad, LogitGrad, AcoshGrad, AsinGrad,
34
34
  GatherDGradV2, ResizeBilinearGrad, ResizeLinear1DGrad, ResizeNearestNeighborV2Grad,
35
35
  SigmoidGrad, HSwishGrad, NLLLossGrad, AtanGrad, GridSampler3DGrad, GridSampler2DGrad,
36
36
  ResizeBicubicGrad, HSigmoidGrad, CholeskyGrad, ResizeNearestNeighborGrad, LayerNormGrad,
37
- HShrinkGrad, LayerNormGradGrad, SiLUGrad, MaximumGrad, MaximumGradGrad)
37
+ HShrinkGrad, LayerNormGradGrad, SiLUGrad, MaximumGrad, MaximumGradGrad,
38
+ FlashAttentionScoreGrad, UpsampleTrilinear3DGrad, UpsampleNearest3DGrad)
38
39
 
39
40
 
40
41
  class SparseFillEmptyRowsGrad(Primitive):
@@ -1534,40 +1535,6 @@ class RandomGammaGrad(Primitive):
1534
1535
  self.add_prim_attr("side_effect_hidden", True)
1535
1536
 
1536
1537
 
1537
- class UpsampleNearest3DGrad(Primitive):
1538
- """
1539
- Upsample the 3-D gradient data with the nearest neighbor interpolation algorithm.
1540
-
1541
- Note:
1542
- Only one of 'scales' and 'output_size' can be specified, and it is an error if both are specified.
1543
-
1544
- Inputs:
1545
- - **dy** (Tensor) - Tensor of shape [N, C, D, H, W], Must be one of the following types:
1546
- float16, float32, float64.
1547
- - **input_size** (listInt): An required listInt, which contain 5 elements:
1548
- [min_batch, channels, depth, height, width].
1549
- Must: input_size[0] == dy_tensor_size[0], input_size[1] == dy_tensor_size[1].
1550
- - **output_size** (listInt): An optional listInt. Default: ``None``.
1551
- It contains 3 elements: depth, height, width, whose elements should be the same as `dy`.
1552
- Must:
1553
- dy_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0],
1554
- dy_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1],
1555
- dy_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
1556
- - **scales** (listFloat): An optional listFloat. Default: ``None``.
1557
- The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
1558
- The number of elements of 'scales' should be the same as the rank of `dy`.
1559
-
1560
- Outputs:
1561
- - **dx**- (Tensor) - A 5-D tensor. Has the same type as `dy`, shape depends on `input_size`.
1562
- """
1563
- @prim_attr_register
1564
- def __init__(self):
1565
- """Initialize UpsampleNearest3DGrad."""
1566
- self.init_prim_io_names(
1567
- inputs=['dy', 'input_size', 'output_size', 'scales'],
1568
- outputs=['dx'])
1569
-
1570
-
1571
1538
  class ROIAlignGrad(Primitive):
1572
1539
  """
1573
1540
  ROIAlignGrad operator.
@@ -2499,45 +2466,6 @@ class MultiMarginLossGrad(Primitive):
2499
2466
  return super().__call__(y_grad, x, target, weight)
2500
2467
 
2501
2468
 
2502
- class UpsampleTrilinear3DGrad(Primitive):
2503
- r"""
2504
- Upsample the 3-D gradient data with trilinear interpolation algorithm.
2505
-
2506
- Note:
2507
- One of 'scales' and 'output_size' must be specified. And it is an error if both are specified.
2508
-
2509
- Args:
2510
- align_corners (bool): An optional bool. Default: ``False``.
2511
-
2512
- Inputs:
2513
- - **dy** (Tensor) - Tensor of shape [N, C, D, H, W]. Must be one of the following types:
2514
- float16, float32, float64.
2515
- - **input_size** (Union[tuple[int], list[int]]): An required listInt which contains 5 elements:
2516
- [batch, channels, depth, height, width]. Must:
2517
- input_size[0] == dy_tensor_size[0]
2518
- input_size[1] == dy_tensor_size[1].
2519
- - **output_size** (Union[tuple[int], list[int]]): An optional listInt. Default: ``None``.
2520
- It contains 3 elements: depth, height, width, whose elements should be the same as `dy`. Must:
2521
- dy_tensor_size[2] == floor(input_size[2] * scales[0]) == output_size[0]
2522
- dy_tensor_size[3] == floor(input_size[3] * scales[1]) == output_size[1]
2523
- dy_tensor_size[4] == floor(input_size[4] * scales[2]) == output_size[2].
2524
- - **scales** (Union[tuple[float], list[float]]): An optional listFloat. Default: ``None``.
2525
- The scale array along each dimension, contain 3 elements: scale_depth, scale_height, scale_width.
2526
- The number of elements of 'scales' should be the same as the rank of input `dy`.
2527
-
2528
- Outputs:
2529
- - **dx** (Tensor) - A Tensor with shape depending on intput_size, and its' dtype is the same as `dy`.
2530
- """
2531
- @prim_attr_register
2532
- def __init__(self, align_corners=False):
2533
- """Initialize UpsampleTrilinear3DGrad."""
2534
- self.init_prim_io_names(
2535
- inputs=['dy', 'input_size', 'output_size', 'scales'],
2536
- outputs=['dx'])
2537
- self.align_corners = align_corners
2538
- self.add_prim_attr('align_corners', self.align_corners)
2539
-
2540
-
2541
2469
  class SparseSegmentMeanGrad(Primitive):
2542
2470
  """
2543
2471
  Compute gradients for SparseSegmentMeanGrad operation.
@@ -3131,39 +3059,6 @@ class WKVGrad(Primitive):
3131
3059
  outputs=["gw", "gu", "gk", "gv"])
3132
3060
 
3133
3061
 
3134
- class FlashAttentionScoreGrad(Primitive):
3135
- r"""
3136
- Calculates the gradient of FlashAttentionScore operation.
3137
- .. warning::
3138
- This is an experimental API that is subject to change or deletion.
3139
-
3140
- Supported Platforms:
3141
- ``Ascend``
3142
- """
3143
- @prim_attr_register
3144
- def __init__(self, head_num, keep_prob=1.0, scale_value=1.0, pre_tokens=65536, next_tokens=65536, inner_precise=1,
3145
- input_layout='BSH', sparse_mode=0):
3146
- """Initialize FlashAttentionScoreGrad."""
3147
- validator.check_value_type('head_num', head_num, [int], self.name)
3148
- validator.check_value_type('keep_prob', keep_prob, [int, float], self.name)
3149
- validator.check_float(keep_prob, 0.0, validator.GE, "keep_prob", self.name)
3150
- validator.check_float(keep_prob, 1.0, validator.LE, "keep_prob", self.name)
3151
- validator.check_value_type('scale_value', scale_value, [float], self.name)
3152
- validator.check_value_type('pre_tokens', pre_tokens, [int], self.name)
3153
- validator.check_value_type('next_tokens', next_tokens, [int], self.name)
3154
- validator.check_value_type('inner_precise', inner_precise, [int], self.name)
3155
- validator.check_value_type('sparse_mode', sparse_mode, [int], self.name)
3156
- if inner_precise not in [0, 1]:
3157
- raise ValueError(f"Attribute 'inner_precise' must be either 0 or 1, but got {inner_precise}")
3158
- validator.check_value_type('input_layout', input_layout, [str], self.name)
3159
- if input_layout not in ["BSH", "BNSD"]:
3160
- raise ValueError(f"Attribute 'input_layout' must be either 'BSH' or 'BNSD', but got {input_layout}")
3161
- self.init_prim_io_names(inputs=['query', 'key', 'value', 'dy', 'pse_shift', 'drop_mask', "padding_mask",
3162
- 'attn_mask', 'softmax_max', 'softmax_sum', 'softmax_out', 'attention_in',
3163
- 'prefix'],
3164
- outputs=['dq', 'dk', 'dv', 'dpse'])
3165
-
3166
-
3167
3062
  class RmsNormGrad(Primitive):
3168
3063
  r"""
3169
3064
  Calculates the gradient of RmsNorm operation.
@@ -2655,10 +2655,10 @@ class FFN(Primitive):
2655
2655
  >>> h = 1024
2656
2656
  >>> h_f = 4 * h
2657
2657
  >>> e = 16
2658
- >>> x = Tensor(np.random.randn(b * s, h).astype(np.float16))
2658
+ >>> x = Tensor(np.random.randn(s, h).astype(np.float16))
2659
2659
  >>> w1 = Tensor(np.random.randn(e, h, h_f).astype(np.float16))
2660
2660
  >>> w2 = Tensor(np.random.randn(e, h_f, h).astype(np.float16))
2661
- >>> expert_tokens = Tensor(np.random.randn(e).astype(np.int64))
2661
+ >>> expert_tokens = Tensor(np.full(e, 8))
2662
2662
  >>> bias1 = Tensor(np.random.randn(e, h_f).astype(np.float16))
2663
2663
  >>> bias2 = Tensor(np.random.randn(e, h).astype(np.float16))
2664
2664
  >>> ffn = _inner_ops.FFN("fastgelu", 1)
@@ -2818,14 +2818,14 @@ class CollectiveGather(Primitive):
2818
2818
 
2819
2819
  For the Ascend devices, users need to prepare the rank table, set rank_id and device_id.
2820
2820
  Please see the `rank table Startup
2821
- <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/parallel/rank_table.html>`_
2821
+ <https://www.mindspore.cn/tutorials/experts/en/master/parallel/rank_table.html>`_
2822
2822
  for more details.
2823
2823
 
2824
2824
  For the GPU devices, users need to prepare the host file and mpi, please see the `mpirun Startup
2825
- <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/parallel/mpirun.html>`_ .
2825
+ <https://www.mindspore.cn/tutorials/experts/en/master/parallel/mpirun.html>`_ .
2826
2826
 
2827
2827
  For the CPU device, users need to write a dynamic cluster startup script, please see the `Dynamic Cluster
2828
- Startup <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/parallel/dynamic_cluster.html>`_ .
2828
+ Startup <https://www.mindspore.cn/tutorials/experts/en/master/parallel/dynamic_cluster.html>`_ .
2829
2829
 
2830
2830
  This example should be run with 4 devices.
2831
2831
 
@@ -440,7 +440,7 @@ class TensorToTuple(PrimitiveWithCheck):
440
440
  def infer_value(self, x):
441
441
  """Infer_value TensorToTuple"""
442
442
  value = None
443
- if x is not None and isinstance(x, (Tensor, Tensor_)):
443
+ if x is not None and isinstance(x, (Tensor, Tensor_)) and len(x.asnumpy().shape) <= 1:
444
444
  value = tuple(x.asnumpy().tolist())
445
445
  return value
446
446
 
@@ -477,7 +477,7 @@ class TensorToList(PrimitiveWithCheck):
477
477
  def infer_value(self, x):
478
478
  """infer_value TensorToList"""
479
479
  value = None
480
- if x is not None and isinstance(x, (Tensor, Tensor_)):
480
+ if x is not None and isinstance(x, (Tensor, Tensor_)) and len(x.asnumpy().shape) <= 1:
481
481
  value = x.asnumpy().tolist()
482
482
  return value
483
483