mindspore 2.3.0rc1__cp38-none-any.whl → 2.3.0rc2__cp38-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 (318) 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-38-aarch64-linux-gnu.so +0 -0
  5. mindspore/_c_expression.cpython-38-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-38-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_glog.so.0 +0 -0
  70. mindspore/lib/libmindspore_gpr.so.15 +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/libopencv_imgcodecs.so.4.5 +0 -0
  75. mindspore/lib/libopencv_imgproc.so.4.5 +0 -0
  76. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
  77. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +6 -6
  78. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
  79. mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
  80. mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
  81. mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
  82. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
  83. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
  84. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
  85. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +101787 -98559
  86. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
  87. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
  88. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/base/op_register.h +2 -2
  89. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/mix.h +8 -1
  90. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/norm.h +5 -3
  91. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/params/reduce.h +2 -2
  92. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/backend.h +3 -3
  93. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/backend/rtbackend.h +3 -3
  94. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/base/types.h +0 -1
  95. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/rt/module/module.h +3 -3
  96. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/include/asdops/utils/svector/svector.h +3 -2
  97. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
  98. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
  99. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/tiling/add_tiling.h +9 -9
  100. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +2 -6
  101. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb.h +2 -2
  102. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_base.h +460 -0
  103. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_bf16.h +217 -0
  104. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp16.h +116 -0
  105. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_tiling.h +16 -24
  106. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_value.h +27 -0
  107. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -4
  108. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/FlashAttentionScore_impl.h → flash_attention_score/flash_attention_score_impl.h} +2 -1
  109. 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
  110. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/gelu/tiling/gelu_tiling.h +7 -9
  111. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/lccl/lccl_wrapper.h +58 -0
  112. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +19 -8
  113. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_common_tiling.h +18 -8
  114. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/pp_matmul_info.h +7 -4
  115. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{matmul → matmul_common}/tiling_data.h +44 -6
  116. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_utils.h +65 -0
  117. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +10 -6
  118. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +4 -1
  119. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +41 -0
  120. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention/PagedAttention_impl.h → paged_attention/paged_attention_impl.h} +1 -1
  121. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +63 -0
  122. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/add_param.h +2 -2
  123. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/{attention_param.h → param/attention_param.h} +11 -2
  124. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +37 -0
  125. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +45 -0
  126. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/reshape_and_cache/reshape_and_cache_tiling.h +1 -2
  127. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm.h +23 -0
  128. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_base.h +175 -0
  129. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_normal.h +276 -0
  130. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/rms_norm_split_d.h +280 -0
  131. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/kernel/tiling_data.h +35 -0
  132. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +45 -0
  133. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/kernel/sub_kernel.h +20 -0
  134. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +47 -0
  135. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_tiling.h +25 -0
  136. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +323 -23
  137. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/types.h +15 -4
  138. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +8 -0
  139. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
  140. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
  141. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
  142. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
  143. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
  144. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
  145. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
  146. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
  147. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
  148. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
  149. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
  150. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
  151. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
  152. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
  153. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
  154. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
  155. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
  156. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
  157. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
  158. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
  159. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
  160. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
  161. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
  162. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
  163. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
  164. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal.h +22 -0
  165. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_comm.h +70 -0
  166. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcal_types.h +103 -0
  167. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl.h +47 -0
  168. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lccl_wrapper.h +58 -0
  169. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/include/lcoc.h +154 -0
  170. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
  171. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
  172. mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
  173. mindspore/log.py +2 -2
  174. mindspore/mint/__init__.py +457 -0
  175. mindspore/mint/nn/__init__.py +430 -0
  176. mindspore/mint/nn/functional.py +424 -0
  177. mindspore/mint/optim/__init__.py +24 -0
  178. mindspore/mint/optim/adamw.py +186 -0
  179. mindspore/multiprocessing/__init__.py +4 -0
  180. mindspore/nn/__init__.py +3 -0
  181. mindspore/nn/cell.py +51 -47
  182. mindspore/nn/extend/__init__.py +29 -0
  183. mindspore/nn/extend/basic.py +140 -0
  184. mindspore/nn/extend/embedding.py +143 -0
  185. mindspore/nn/extend/layer/__init__.py +27 -0
  186. mindspore/nn/extend/layer/normalization.py +107 -0
  187. mindspore/nn/extend/pooling.py +117 -0
  188. mindspore/nn/generator.py +297 -0
  189. mindspore/nn/layer/basic.py +109 -1
  190. mindspore/nn/layer/container.py +2 -2
  191. mindspore/nn/layer/conv.py +6 -6
  192. mindspore/nn/layer/embedding.py +1 -1
  193. mindspore/nn/layer/normalization.py +21 -43
  194. mindspore/nn/layer/padding.py +4 -0
  195. mindspore/nn/optim/ada_grad.py +2 -2
  196. mindspore/nn/optim/adadelta.py +1 -1
  197. mindspore/nn/optim/adafactor.py +1 -1
  198. mindspore/nn/optim/adam.py +7 -7
  199. mindspore/nn/optim/adamax.py +2 -2
  200. mindspore/nn/optim/adasum.py +2 -2
  201. mindspore/nn/optim/asgd.py +2 -2
  202. mindspore/nn/optim/ftrl.py +1 -1
  203. mindspore/nn/optim/lamb.py +3 -3
  204. mindspore/nn/optim/lars.py +1 -1
  205. mindspore/nn/optim/lazyadam.py +2 -2
  206. mindspore/nn/optim/momentum.py +2 -2
  207. mindspore/nn/optim/optimizer.py +2 -2
  208. mindspore/nn/optim/proximal_ada_grad.py +2 -2
  209. mindspore/nn/optim/rmsprop.py +2 -2
  210. mindspore/nn/optim/rprop.py +2 -2
  211. mindspore/nn/optim/sgd.py +2 -2
  212. mindspore/nn/optim/thor.py +2 -2
  213. mindspore/nn/wrap/cell_wrapper.py +9 -9
  214. mindspore/nn/wrap/grad_reducer.py +5 -5
  215. mindspore/ops/_grad_experimental/grad_comm_ops.py +4 -2
  216. mindspore/ops/_vmap/vmap_grad_nn_ops.py +41 -2
  217. mindspore/ops/_vmap/vmap_math_ops.py +27 -8
  218. mindspore/ops/_vmap/vmap_nn_ops.py +66 -8
  219. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +73 -1
  220. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +12 -3
  221. mindspore/ops/auto_generate/gen_arg_handler.py +24 -0
  222. mindspore/ops/auto_generate/gen_extend_func.py +274 -0
  223. mindspore/ops/auto_generate/gen_ops_def.py +889 -22
  224. mindspore/ops/auto_generate/gen_ops_prim.py +3541 -253
  225. mindspore/ops/auto_generate/pyboost_inner_prim.py +282 -0
  226. mindspore/ops/composite/multitype_ops/_compile_utils.py +2 -1
  227. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +9 -0
  228. mindspore/ops/extend/__init__.py +9 -1
  229. mindspore/ops/extend/array_func.py +134 -27
  230. mindspore/ops/extend/math_func.py +3 -3
  231. mindspore/ops/extend/nn_func.py +363 -2
  232. mindspore/ops/function/__init__.py +19 -2
  233. mindspore/ops/function/array_func.py +463 -439
  234. mindspore/ops/function/clip_func.py +7 -18
  235. mindspore/ops/function/grad/grad_func.py +5 -5
  236. mindspore/ops/function/linalg_func.py +4 -4
  237. mindspore/ops/function/math_func.py +260 -243
  238. mindspore/ops/function/nn_func.py +825 -62
  239. mindspore/ops/function/random_func.py +73 -4
  240. mindspore/ops/function/sparse_unary_func.py +1 -1
  241. mindspore/ops/function/vmap_func.py +1 -1
  242. mindspore/ops/functional.py +2 -2
  243. mindspore/ops/op_info_register.py +1 -31
  244. mindspore/ops/operations/__init__.py +2 -3
  245. mindspore/ops/operations/_grad_ops.py +2 -107
  246. mindspore/ops/operations/_inner_ops.py +5 -5
  247. mindspore/ops/operations/_sequence_ops.py +2 -2
  248. mindspore/ops/operations/array_ops.py +11 -233
  249. mindspore/ops/operations/comm_ops.py +32 -32
  250. mindspore/ops/operations/custom_ops.py +7 -89
  251. mindspore/ops/operations/manually_defined/ops_def.py +329 -4
  252. mindspore/ops/operations/math_ops.py +13 -163
  253. mindspore/ops/operations/nn_ops.py +9 -316
  254. mindspore/ops/operations/random_ops.py +1 -1
  255. mindspore/ops/operations/sparse_ops.py +3 -3
  256. mindspore/ops/primitive.py +2 -2
  257. mindspore/ops_generate/arg_dtype_cast.py +12 -3
  258. mindspore/ops_generate/arg_handler.py +24 -0
  259. mindspore/ops_generate/gen_ops_inner_prim.py +2 -0
  260. mindspore/ops_generate/gen_pyboost_func.py +13 -6
  261. mindspore/ops_generate/pyboost_utils.py +2 -17
  262. mindspore/parallel/__init__.py +3 -2
  263. mindspore/parallel/_auto_parallel_context.py +106 -1
  264. mindspore/parallel/_parallel_serialization.py +34 -2
  265. mindspore/parallel/_utils.py +16 -0
  266. mindspore/parallel/algo_parameter_config.py +4 -4
  267. mindspore/parallel/checkpoint_transform.py +249 -77
  268. mindspore/parallel/cluster/process_entity/_api.py +1 -1
  269. mindspore/parallel/parameter_broadcast.py +1 -1
  270. mindspore/parallel/shard.py +1 -1
  271. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +1 -0
  272. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +17 -5
  273. mindspore/profiler/parser/ascend_msprof_exporter.py +3 -3
  274. mindspore/profiler/parser/ascend_msprof_generator.py +10 -3
  275. mindspore/profiler/parser/ascend_op_generator.py +26 -9
  276. mindspore/profiler/parser/ascend_timeline_generator.py +7 -4
  277. mindspore/profiler/parser/profiler_info.py +11 -1
  278. mindspore/profiler/profiling.py +13 -5
  279. mindspore/rewrite/api/node.py +12 -12
  280. mindspore/rewrite/api/symbol_tree.py +11 -11
  281. mindspore/run_check/_check_version.py +1 -1
  282. mindspore/safeguard/rewrite_obfuscation.py +2 -2
  283. mindspore/train/amp.py +4 -4
  284. mindspore/train/anf_ir_pb2.py +8 -2
  285. mindspore/train/callback/_backup_and_restore.py +2 -2
  286. mindspore/train/callback/_callback.py +4 -4
  287. mindspore/train/callback/_checkpoint.py +2 -2
  288. mindspore/train/callback/_early_stop.py +2 -2
  289. mindspore/train/callback/_landscape.py +4 -4
  290. mindspore/train/callback/_loss_monitor.py +2 -2
  291. mindspore/train/callback/_on_request_exit.py +2 -2
  292. mindspore/train/callback/_reduce_lr_on_plateau.py +2 -2
  293. mindspore/train/callback/_summary_collector.py +2 -2
  294. mindspore/train/callback/_time_monitor.py +2 -2
  295. mindspore/train/dataset_helper.py +8 -3
  296. mindspore/train/loss_scale_manager.py +2 -2
  297. mindspore/train/metrics/metric.py +3 -3
  298. mindspore/train/mind_ir_pb2.py +22 -17
  299. mindspore/train/model.py +15 -15
  300. mindspore/train/serialization.py +18 -18
  301. mindspore/train/summary/summary_record.py +7 -7
  302. mindspore/train/train_thor/convert_utils.py +3 -3
  303. mindspore/version.py +1 -1
  304. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +1 -1
  305. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +309 -262
  306. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/tiling_data.h +0 -59
  307. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BNSD_mix.o +0 -0
  308. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_bf16_BSH_mix.o +0 -0
  309. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BNSD_mix.o +0 -0
  310. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/FlashAttentionScore_fp16_BSH_mix.o +0 -0
  311. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BNSD_mix.o +0 -0
  312. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_bf16_BSH_mix.o +0 -0
  313. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BNSD_mix.o +0 -0
  314. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/PagedAttention_fp16_BSH_mix.o +0 -0
  315. /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
  316. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
  317. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
  318. {mindspore-2.3.0rc1.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
@@ -30,11 +30,14 @@ from mindspore.ops.primitive import Primitive
30
30
  from mindspore.ops.primitive import PrimitiveWithInfer
31
31
  from mindspore.ops.primitive import PrimitiveWithCheck
32
32
  from mindspore.ops.primitive import prim_attr_register
33
- from ..auto_generate import (CeLU, Flatten, LogSoftmax, ReLU, ReLU6,
34
- Elu, Sigmoid, Softmax, HSwish, HSigmoid, AvgPool, BiasAdd,
33
+ from ..auto_generate import (CeLU, Flatten, LogSoftmax, ReLU, ReLU6, Dense,
34
+ Elu, Sigmoid, Softmax, SoftplusExt, HSwish, HSigmoid, AvgPool, BiasAdd,
35
35
  NLLLoss, OneHot, GeLU, FastGeLU, PReLU,
36
- GridSampler3D, GridSampler2D, LayerNorm, HShrink, AdamWeightDecay, Dropout,
37
- ApplyRotaryPosEmb, PagedAttention, PagedAttentionMask, ReshapeAndCache)
36
+ GridSampler3D, GridSampler2D, LayerNorm, LayerNormExt, HShrink, AdamWeightDecay, Dropout,
37
+ ApplyRotaryPosEmb, PagedAttention, PagedAttentionMask, ReshapeAndCache,
38
+ FlashAttentionScore, Embedding, UpsampleNearest1D, UpsampleNearest2D,
39
+ UpsampleNearest3D, UpsampleTrilinear3D,
40
+ UpsampleBilinear2D, UpsampleLinear1D)
38
41
  from .manually_defined import BatchNorm
39
42
 
40
43
 
@@ -449,7 +452,7 @@ class ReLUV3(Primitive):
449
452
  Inputs:
450
453
  - **input_x** (Tensor) - Tensor of shape :math:`(N, *)`, where :math:`*` means, any number of
451
454
  additional dimensions, data type is
452
- `number <https://www.mindspore.cn/docs/en/r2.3.q1/api_python/mindspore.html#mindspore.dtype>`_.
455
+ `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore.html#mindspore.dtype>`_.
453
456
 
454
457
  Outputs:
455
458
  Tensor of shape :math:`(N, *)`, with the same type and shape as the `input_x`.
@@ -3038,84 +3041,6 @@ class L2Normalize(Primitive):
3038
3041
  self.axis = axis
3039
3042
 
3040
3043
 
3041
- class UpsampleTrilinear3D(Primitive):
3042
- r"""
3043
- Performs upsampling with trilinear interpolation across 3dims for 5dim input Tensor.
3044
-
3045
- This operator scale up the volumetric input with specified `output_size` or `scales` factors,
3046
- using trilinear upscaling algorithm.
3047
-
3048
- Note:
3049
- One of `scales` and `output_size` must be specified. And it is an error if both are specified.
3050
-
3051
- Args:
3052
- align_corners (bool, optional): An optional bool. Default: ``False``.
3053
- If ``True``, the input and output tensors are aligned by the center points of their corner pixels,
3054
- preserving the values at the corner pixels.
3055
- If ``False`` , the input and output tensors are aligned by the corner points of their corner pixels,
3056
- and the interpolation use edge value padding for out of boundary values.
3057
-
3058
- Inputs:
3059
- - **x** (Tensor) - 5D tensor of shape :math:`(N, C, D_{in}, H_{in}, W_{in})`. Supporting types:
3060
- [float16, float32, float64].
3061
- - **output_size** (Union[tuple[int], list[int]]): A tuple or list of 3 int elements
3062
- :math:`(output\_depth, output\_height, output\_width)`. Default: ``None``.
3063
- - **scales** (Union[tuple[float], list[float]]): A tuple or list of 3 float
3064
- elements :math:`(scale\_depth, scale\_height, scale\_width)`. Default: ``None``.
3065
-
3066
- Outputs:
3067
- - **y** (Tensor) - Upsampled output with the same data type as `x`, whose shape is
3068
- :math:`(N, C, D_{out}, H_{out}, W_{out})`.
3069
-
3070
- Raises:
3071
- TypeError: When `output_size` is not ``None`` and `output_size` is not list[int] or tuple[int].
3072
- TypeError: When `scales` is not ``None`` and `scales` is not list[float] or tuple[float].
3073
- TypeError: If dtype of `x` is not in [float16, float32, float64].
3074
- TypeError: If type of `align_corners` is not bool.
3075
- ValueError: If any value of `output_size` is negative or zero when `output_size` is not ``None``.
3076
- ValueError: If any value of `scales` is negative or zero when `scales` is not ``None``.
3077
- ValueError: If shape of `x` is not 5D.
3078
- ValueError: If none of `scales` and `output_size` is specified or both specified.
3079
- ValueError: If size of `scales` is not equal 3 when `scales` is specified.
3080
- ValueError: If size of `output_size` is not equal 3 when `output_size` is specified.
3081
-
3082
- Supported Platforms:
3083
- ``Ascend`` ``GPU`` ``CPU``
3084
-
3085
- Examples:
3086
- >>> import numpy as np
3087
- >>> from mindspore import Tensor, ops
3088
- >>> net = ops.UpsampleTrilinear3D()
3089
- >>> in_x = Tensor(input_data=np.random.randn(2, 3, 4, 512, 256))
3090
- >>> output_size=[4, 64, 48]
3091
- >>> out = net(in_x, output_size, None)
3092
- >>> print(out.shape)
3093
- (2, 3, 4, 64, 48)
3094
- >>>
3095
- >>> net = ops.UpsampleTrilinear3D()
3096
- >>> in_x = Tensor(np.arange(1, 5, dtype=np.float32).reshape((1, 1, 1, 2, 2)))
3097
- >>> output_size=[2, 4, 4]
3098
- >>> out = net(in_x, output_size, None)
3099
- >>> print(out)
3100
- [[[[[1. 1.25 1.75 2. ]
3101
- [1.5 1.75 2.25 2.5 ]
3102
- [2.5 2.75 3.25 3.5 ]
3103
- [3. 3.25 3.75 4. ]]
3104
- [[1. 1.25 1.75 2. ]
3105
- [1.5 1.75 2.25 2.5 ]
3106
- [2.5 2.75 3.25 3.5 ]
3107
- [3. 3.25 3.75 4. ]]]]]
3108
- """
3109
-
3110
- @prim_attr_register
3111
- def __init__(self, align_corners=False):
3112
- """Initialize UpsampleTrilinear3D."""
3113
- self.init_prim_io_names(inputs=['x', 'output_size', 'scales'], outputs=['y'])
3114
- self.align_corners = align_corners
3115
- validator.check_bool(self.align_corners, "align_corners", self.name)
3116
- self.add_prim_attr('align_corners', self.align_corners)
3117
-
3118
-
3119
3044
  class GetNext(Primitive):
3120
3045
  """
3121
3046
  Returns the next element in the dataset queue.
@@ -6378,6 +6303,7 @@ class DynamicRNN(Primitive):
6378
6303
  self.forget_bias = validator.check_value_type("forget_bias", forget_bias, [float], self.name)
6379
6304
  self.use_peephole = validator.check_value_type("use_peephole", use_peephole, [bool], self.name)
6380
6305
  self.time_major = validator.check_value_type("time_major", time_major, [bool], self.name)
6306
+ validator.check("time_major", time_major, "the supported value", True, validator.EQ, self.name)
6381
6307
  self.is_training = validator.check_value_type("is_training", is_training, [bool], self.name)
6382
6308
  validator.check_value_type("cell_type", cell_type, [str], self.name)
6383
6309
  self.cell_type = validator.check_string(cell_type, ['LSTM'], "cell_type", self.name)
@@ -9090,71 +9016,6 @@ class Pdist(Primitive):
9090
9016
  self.init_prim_io_names(inputs=['x'], outputs=['y'])
9091
9017
 
9092
9018
 
9093
- class UpsampleNearest3D(Primitive):
9094
- r"""
9095
- Performs nearest neighbor upsampling operation.
9096
-
9097
- This operator scale up the volumetric input with specified `output_size` or `scales` factors, using nearest
9098
- neighbor algorithm.
9099
-
9100
- One of `output_size` or `scales` must be given, and can not specified both at the same time.
9101
-
9102
- Inputs:
9103
- - **x** (Tensor) - 5D tensor of shape :math:`(N, C, D_{in}, H_{in}, W_{in})`.
9104
- Supporting types: [float16, float32, float64].
9105
- - **output_size** (Union[tuple[int], list[int]]): A tuple or list of int specifying the output volumetric size.
9106
- Default: ``None``.
9107
- - **scales** (Union[tuple[float], list[float]]): A tuple or list of float specifying the upsampling factors.
9108
- Default: ``None``.
9109
-
9110
- Outputs:
9111
- - **y** (Tensor) - Upsampled output with the same type as `x` , whose shape is
9112
- :math:`(N, C, D_{out}, H_{out}, W_{out})`.
9113
-
9114
- Raises:
9115
- TypeError: When `output_size` is not ``None`` and `output_size` is not list[int] or tuple[int].
9116
- TypeError: When `scales` is not ``None`` and `scales` is not list[float] or tuple[float].
9117
- TypeError: If dtype of `x` is not int [uint8, float16, float32, float64].
9118
- ValueError: If any value of `output_size` is negative or zero when `output_size` is not ``None``.
9119
- ValueError: If any value of `scales` is negative or zero when `scales` is not ``None``.
9120
- ValueError: If shape of `x` is not 5D.
9121
- ValueError: If none of `scales` and `output_size` is specified or both specified.
9122
- ValueError: If size of `scales` is not equal 3 when `scales` is specified.
9123
- ValueError: If size of `output_size` is not equal 3 when `output_size` is specified.
9124
-
9125
- Supported Platforms:
9126
- ``Ascend`` ``GPU`` ``CPU``
9127
-
9128
- Examples:
9129
- >>> import numpy as np
9130
- >>> from mindspore import Tensor, ops
9131
- >>> from mindspore import dtype as mstype
9132
- >>> x = Tensor(np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16])
9133
- ... .reshape([1, 1, 2, 2, 4]), mstype.float32)
9134
- >>> output_size = [3, 4, 5]
9135
- >>> net = ops.UpsampleNearest3D()
9136
- >>> output = net(x, output_size, None)
9137
- >>> print(output)
9138
- [[[[[ 1. 1. 2. 3. 4.]
9139
- [ 1. 1. 2. 3. 4.]
9140
- [ 5. 5. 6. 7. 8.]
9141
- [ 5. 5. 6. 7. 8.]]
9142
- [[ 1. 1. 2. 3. 4.]
9143
- [ 1. 1. 2. 3. 4.]
9144
- [ 5. 5. 6. 7. 8.]
9145
- [ 5. 5. 6. 7. 8.]]
9146
- [[ 9. 9. 10. 11. 12.]
9147
- [ 9. 9. 10. 11. 12.]
9148
- [13. 13. 14. 15. 16.]
9149
- [13. 13. 14. 15. 16.]]]]]
9150
- """
9151
-
9152
- @prim_attr_register
9153
- def __init__(self):
9154
- """Initialize UpsampleNearest3D."""
9155
- self.init_prim_io_names(inputs=['x', 'output_size', 'scales'], outputs=['y'])
9156
-
9157
-
9158
9019
  class SparseApplyAdagradDA(Primitive):
9159
9020
  r"""
9160
9021
  Update `var` according to the proximal adagrad scheme.
@@ -9797,54 +9658,6 @@ class MaxPoolWithArgmaxV2(Primitive):
9797
9658
  self.add_prim_attr("ceil_mode", self.ceil_mode)
9798
9659
 
9799
9660
 
9800
- class Dense(Primitive):
9801
- r"""
9802
- The dense connected fusion operator.
9803
-
9804
- Applies dense connected operator for the input. The implement of the operation is as:
9805
-
9806
- .. math::
9807
- output = x @ w ^ T + b,
9808
-
9809
- where :math:`x` is the input tensor, :math:`w` is a weight matrix with the same data type as the :math:`x` ,
9810
- and :math:`b` is a bias vector with the same data type as the :math:`x` (only if `b` is not ``None``).
9811
-
9812
- Inputs:
9813
- - **x** (Tensor) - The shape must meet the following requirement: :math:`len(x.shape)>0`.
9814
- - **w** (Tensor) - The shape must meet the following requirements:
9815
- If :math:`len(x.shape)>1`, :math:`len(w.shape)=2`. If :math:`len(x.shape)=1`, :math:`len(w.shape)=1`.
9816
- :math:`w.shape[-1]=x.shape[-1]`.
9817
- - **b** (Union[Tensor, None]) - If `b` is not ``None``, the shape must meet the following requirements:
9818
- If :math:`len(x.shape)>1`, :math:`len(b.shape)=0` or :math:`len(b.shape)=1` .
9819
- If :math:`len(b.shape)=1`, :math:`b.shape[0]=w.shape[0]`.
9820
- If :math:`len(x.shape)=1`, :math:`len(b.shape)=0`.
9821
-
9822
- Outputs:
9823
- If :math:`len(x.shape)>1`, Tensor of shape :math:`(*x.shape[:-1], w.shape[0])`.
9824
- If :math:`len(x.shape)=1`, Tensor of shape :math:`()`.
9825
-
9826
- Supported Platforms:
9827
- ``Ascend`` ``GPU`` ``CPU``
9828
-
9829
- Examples:
9830
- >>> import numpy as np
9831
- >>> from mindspore import Tensor, ops
9832
- >>> x = Tensor(np.random.random((4, 5, 6, 7)).astype(np.float32))
9833
- >>> weight = Tensor(np.random.random((6, 7)).astype(np.float32))
9834
- >>> bias = Tensor(np.random.random((6,)).astype(np.float32))
9835
- >>> dense = ops.Dense()
9836
- >>> output = dense(x, weight, bias)
9837
- >>> print(output.shape)
9838
- (4, 5, 6, 6)
9839
- """
9840
-
9841
- @prim_attr_register
9842
- def __init__(self):
9843
- """Initialize Dense."""
9844
- self.init_prim_io_names(inputs=['x', 'w', 'b'], outputs=["output"])
9845
- self.add_prim_attr("has_bias", True)
9846
-
9847
-
9848
9661
  class WKV(Primitive):
9849
9662
  r"""
9850
9663
  The WKV computation is similar to AFT(Zhai et al., 2021), but W is now a channel-wise vector multiplied
@@ -10052,115 +9865,6 @@ class IncreFlashAttention(Primitive):
10052
9865
  outputs=["attention_out"])
10053
9866
 
10054
9867
 
10055
- class FlashAttentionScore(Primitive):
10056
- r"""
10057
- FlashAttentionScore.
10058
- .. math::
10059
- \begin{array}{ll} \\
10060
- y = Dropout(Softmax(Mask(scale_value \mul (real_shift + query * key), attn_mask), -1), keep_prob) \\
10061
- \mul value \\
10062
- \end{array}
10063
-
10064
- .. warning::
10065
- This is an experimental API that is subject to change or deletion.
10066
- B -- Batch size
10067
- S1 -- Sequence length of query. The value ranges from 1 to 32768 and is a multiple of 16.
10068
- S2 -- Sequence length of key and value. The value ranges from 1 to 32768 and is a multiple of 16.
10069
- N1 -- Num heads of query
10070
- N2 -- Num heads of key and value, and N2 must be a factor of N1
10071
- D -- Head size. Support value: 64, 80, 96, 120, 128 and 256.
10072
- H1 -- Hidden size of query, which equals to N1 * D
10073
- H2 -- Hidden size of key and value, which equals to N2 * D
10074
- Args:
10075
- head_num (int): The head num of query. Default: 1.
10076
- keep_prob (float): The keep probability of dropout. Default: 1.0.
10077
- scale_value (float): The scale factor of score. Default: 1.0.
10078
- pre_tokens (int): Parameter for sparse computation, represents how many tokens are counted forward.
10079
- When sparse_mode is set to 1, 2, 3, or 5, this parameter does not take effect. Default: 2147483647.
10080
- next_tokens (int): Parameter for sparse computation, represents how many tokens are counted backward.
10081
- When sparse_mode is set to 1, 2, 3, or 5, this parameter does not take effect. Default: 2147483647.
10082
- inner_precise (int): The parameter is reserved and not implemented yet. Default: 0.
10083
- input_layout (str): Specifies the layout of input `query`, key and value. The value can be "BSH" or "BNSD".
10084
- Default: "BSH".
10085
- sparse_mode (int): Indicates sparse mode. Default 0.
10086
-
10087
- - 0: Indicates the defaultMask mode. If attn_mask is not passed, the mask operation is not performed,
10088
- and preTokens and nextTokens(internally assigned as INT_MAX) are ignored. If passed in, the full attn_mask
10089
- matrix (S1 * S2) needs to be passed in, indicating that the part between preTokens and nextTokens needs to
10090
- be calculated.
10091
- - 1: Represents allMask, that is, passing in the complete attn_mask matrix.
10092
- - 2: Representing the leftUpCausal mode corresponds to the lower triangle scenario divided by the left
10093
- vertex, and the optimized attn_mask matrix (2048*2048) is required.
10094
- - 3: Representing the rightDownCausal model corresponds to the lower triangle scene divided by the lower
10095
- right vertex, and the optimized attn_mask matrix (2048*2048) is required.
10096
- - 4: Represents the band scenario, that is, the part between counting preTokens and nextTokens, and the
10097
- optimized attn_mask matrix (2048*2048) is required..
10098
- - 5: Represents the prefix scenario, that is, on the basis of rightDownCasual, a matrix with length S1 and
10099
- width N is added to the left side. The value of N is obtained by the new input prefix, and the N value of
10100
- each Batch axis is different. Not implemented yet.
10101
- - 6: Represents the global scenario, not implemented yet.
10102
- - 7: Represents the dilated scenario, not implemented yet.
10103
- - 8: Represents the block_local scenario, not implemented yet.
10104
-
10105
- Inputs:
10106
- - **query** (Tensor[float16, bfloat16]) - The query tensor.
10107
- Input tensor of shape :math:`(B, S1, H1)` or `(B, N1, S1, D)`.
10108
- - **key** (Tensor[float16, bfloat16]) - The key tensor.
10109
- Input tensor of shape :math:`(B, S2, H2)` or `(B, N2, S2, D)`.
10110
- - **value** (Tensor[float16, bfloat16]) - The value tensor.
10111
- Input tensor of shape :math:`(B, S2, H2)` or `(B, N2, S2, D)`.
10112
- - **real_shift** (Union[Tensor[float16, bfloat16], None]) - The position embedding code. If S is greater than
10113
- 1024 and the mask of the lower triangle is used, enter only the inverse 1024 lines of the lower triangle for
10114
- memory optimization.
10115
- Input tensor of shape :math: `(B, N1, S1, S2)`, `(1, N1, S1, S2)`, `(B, N1, 1024, S2)`, `(1, N1, 1024, S2)`
10116
- or (1024, 1024).
10117
- - **drop_mask** (Union[Tensor[uint8], None]) - The dropout mask tensor.
10118
- Input tensor of shape :math:`(B, N1, S1, S2 // 8) or None`.
10119
- - **padding_mask** (None) - Reserved parameter. Not implemented yet.
10120
- - **attn_mask** (Union[Tensor[uint8], None]) - The attention mask tensor. For each element, 0 indicates
10121
- retention and 1 indicates discard. Input tensor of shape :math:`(B, N1, S1, S2)`, `(B, 1, S1, S2)`, `(S1, S2)`
10122
- or (2048, 2048).
10123
- - **prefix** (Union[Tensor[int64], None]) - N value of each Batch in the prefix sparse calculation scenario.
10124
- Input tensor of shape :math:`(B,)`.
10125
-
10126
- Outputs:
10127
- - **softmax_max** (Tensor[float32]) - (B, N1, S1, 8)
10128
- - **softmax_sum** (Tensor[float32]) - (B, N1, S1, 8)
10129
- - **softmax_out** (Tensor[float16, bfloat16]) - Useless output, ignore it. Output tensor of shape : `()`
10130
- - **attention_out** (Tensor[float16, bfloat16]) - The output of attention, its shape, and data type
10131
- are the same as the query.
10132
-
10133
- Supported Platforms:
10134
- ``Ascend910B``
10135
- """
10136
-
10137
- @prim_attr_register
10138
- def __init__(self, head_num=1, keep_prob=1.0, scale_value=1.0, pre_tokens=2147483647, next_tokens=2147483647,
10139
- inner_precise=0, input_layout="BSH", sparse_mode=0):
10140
- """Initialize FlashAttentionScore"""
10141
- validator.check_value_type('head_num', head_num, [int], self.name)
10142
- validator.check_value_type('keep_prob', keep_prob, [int, float], self.name)
10143
- validator.check_float(keep_prob, 0.0, validator.GE, "keep_prob", self.name)
10144
- validator.check_float(keep_prob, 1.0, validator.LE, "keep_prob", self.name)
10145
- validator.check_value_type('scale_value', scale_value, [float], self.name)
10146
- validator.check_value_type('pre_tokens', pre_tokens, [int], self.name)
10147
- validator.check_value_type('next_tokens', next_tokens, [int], self.name)
10148
- validator.check_value_type('inner_precise', inner_precise, [int], self.name)
10149
- validator.check_value_type('sparse_mode', sparse_mode, [int], self.name)
10150
- valid_sparse_mode = [0, 1, 2, 3, 4]
10151
- if sparse_mode not in valid_sparse_mode:
10152
- raise ValueError(f"Attribute 'sparse_mode' must be one of {valid_sparse_mode}, but got {sparse_mode}")
10153
- if inner_precise not in [0]:
10154
- raise ValueError(f"Attribute 'inner_precise' must be 0, but got {inner_precise}")
10155
- validator.check_value_type('input_layout', input_layout, [str], self.name)
10156
- support_layout = ["BSH", "BNSD"]
10157
- if input_layout not in support_layout:
10158
- raise ValueError(f"Attribute 'input_layout' must be one of {support_layout}, but got {input_layout}")
10159
- self.init_prim_io_names(
10160
- inputs=['query', 'key', 'value', 'real_shift', 'drop_mask', 'padding_mask', 'attn_mask', 'prefix'],
10161
- outputs=['softmax_max', 'softmax_sum', 'softmax_out', 'attention_out'])
10162
-
10163
-
10164
9868
  class RmsNorm(Primitive):
10165
9869
  r"""
10166
9870
  The RmsNorm operator is a normalization operation, and its formula is:
@@ -10196,14 +9900,3 @@ class RmsNorm(Primitive):
10196
9900
  """Initialize Dense."""
10197
9901
  validator.check_value_type("epsilon", epsilon, [float], self.name)
10198
9902
  self.init_prim_io_names(inputs=['x', 'gamma'], outputs=["y", "rstd"])
10199
-
10200
-
10201
- class MatmulQkv(Primitive):
10202
- r"""
10203
- Fuse three matmul ops for q k v attention into one
10204
- """
10205
- @prim_attr_register
10206
- def __init__(self):
10207
- """Initialize"""
10208
- self.init_prim_io_names(inputs=['hidden_states', 'weight_q', 'weight_k', 'weight_v'],
10209
- outputs=["output_q", "output_k", "output_v"])
@@ -20,7 +20,7 @@ from mindspore import _checkparam as Validator
20
20
  from mindspore.common import dtype as mstype
21
21
  from mindspore.ops.primitive import PrimitiveWithInfer, prim_attr_register, Primitive
22
22
  from mindspore.ops._utils import get_broadcast_shape
23
- from ..auto_generate import RandpermV2
23
+ from ..auto_generate import RandpermV2, UniformExt
24
24
 
25
25
 
26
26
  class NonDeterministicInts(Primitive):
@@ -60,7 +60,7 @@ class SparseDenseCwiseAdd(Primitive):
60
60
  ``Ascend`` ``GPU`` ``CPU``
61
61
 
62
62
  Examples:
63
- >>> from mindspore.common.tensor import Tensor
63
+ >>> from mindspore import Tensor
64
64
  >>> from mindspore.common import dtype as ms
65
65
  >>> from mindspore.ops.operations import sparse_ops as ops
66
66
  >>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
@@ -115,7 +115,7 @@ class SparseDenseCwiseMul(Primitive):
115
115
  ``Ascend`` ``GPU`` ``CPU``
116
116
 
117
117
  Examples:
118
- >>> from mindspore.common.tensor import Tensor
118
+ >>> from mindspore import Tensor
119
119
  >>> from mindspore.common import dtype as ms
120
120
  >>> from mindspore.ops.operations import sparse_ops as ops
121
121
  >>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
@@ -170,7 +170,7 @@ class SparseDenseCwiseDiv(Primitive):
170
170
  ``Ascend`` ``GPU``
171
171
 
172
172
  Examples:
173
- >>> from mindspore.common.tensor import Tensor
173
+ >>> from mindspore import Tensor
174
174
  >>> from mindspore.common import dtype as ms
175
175
  >>> from mindspore.ops.operations import sparse_ops as ops
176
176
  >>> x1_indices = Tensor([[0, 0], [2, 2]], dtype=ms.int64)
@@ -548,7 +548,7 @@ class PrimitiveWithCheck(Primitive):
548
548
  the shape and type. Method infer_value() can also be defined (such as PrimitiveWithInfer) for constant propagation.
549
549
 
550
550
  More on how to customize a Op, please refer to `Custom Operators
551
- <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html>`_.
551
+ <https://www.mindspore.cn/tutorials/experts/en/master/operation/op_custom.html>`_.
552
552
 
553
553
  Args:
554
554
  name (str): Name of the current Primitive.
@@ -642,7 +642,7 @@ class PrimitiveWithInfer(Primitive):
642
642
  logic of the shape and type. The infer_value() is used for constant propagation.
643
643
 
644
644
  More on how to customize a Op, please refer to `Custom Operators
645
- <https://www.mindspore.cn/tutorials/experts/en/r2.3.q1/operation/op_custom.html>`_.
645
+ <https://www.mindspore.cn/tutorials/experts/en/master/operation/op_custom.html>`_.
646
646
 
647
647
  Args:
648
648
  name (str): Name of the current Primitive.
@@ -20,17 +20,25 @@ import mindspore as ms
20
20
  from mindspore import ops
21
21
  from mindspore.common.tensor import Tensor
22
22
  from mindspore.ops.operations._sequence_ops import TensorToScalar, TensorToTuple
23
- from mindspore.ops_generate.gen_ops_inner_prim import ListToTuple, TupleToList
23
+ from mindspore.ops_generate.gen_ops_inner_prim import TupleToList
24
24
  from mindspore._c_expression import OpDtype
25
25
 
26
26
  tensor_to_tuple_ = TensorToTuple()
27
- list_to_tuple = ListToTuple()
28
27
  tuple_to_list = TupleToList()
29
28
 
29
+
30
30
  def int_to_float(data):
31
31
  return float(data)
32
32
 
33
33
 
34
+ def list_to_tuple(data):
35
+ # tuple() currently does not support Any from JIT Fallback.
36
+ res = ()
37
+ for element in data:
38
+ res += (element,)
39
+ return res
40
+
41
+
34
42
  def scalar_to_tuple(data):
35
43
  return (data,)
36
44
 
@@ -61,6 +69,7 @@ def tuple_to_tensor(data):
61
69
  def list_to_tensor(data):
62
70
  return ops.tuple_to_array(list_to_tuple(data))
63
71
 
72
+
64
73
  # There will be some problems in using OpDtype.xxx directly in GRAPH_MODE, so convert it to int.
65
74
  # type
66
75
  DT_TYPE_VAL = int(OpDtype.DT_TYPE)
@@ -243,6 +252,6 @@ def type_it(op_name, arg_name, data, src_type, dst_type):
243
252
  dst_type = int(dst_type)
244
253
  if not is_instance_in(data, src_type) and not is_instance_of(data, dst_type):
245
254
  support_list = get_support_dtype_list(src_type, dst_type)
246
- raise TypeError(f"For '{op_name}', the type of '{arg_name}' should be one of '[{support_list}]', " \
255
+ raise TypeError(f"For '{op_name}', the type of '{arg_name}' should be one of '[{support_list}]', "
247
256
  f"but got {type(data)}.")
248
257
  return do_type_cast(data, dst_type)
@@ -79,6 +79,30 @@ def to_dilations(op_name, arg_name, dilation):
79
79
  raise ValueError(arg_invalid_info(op_name, arg_name, dilation))
80
80
 
81
81
 
82
+ def to_output_padding(op_name, arg_name, output_padding):
83
+ """
84
+ convert output_padding: int/tuple[int*4] -> tuple[int*2].
85
+ """
86
+ if isinstance(output_padding, int):
87
+ return (output_padding, output_padding)
88
+ if isinstance(output_padding, (tuple, list)):
89
+ if len(output_padding) == 4:
90
+ return (output_padding[2], output_padding[3])
91
+ return output_padding
92
+ raise ValueError(arg_invalid_info(op_name, arg_name, output_padding))
93
+
94
+
95
+ def to_2d_paddings(op_name, arg_name, pad):
96
+ """
97
+ convert paddings: int -> tuple[int*2].
98
+ """
99
+ if isinstance(pad, int):
100
+ return (pad,) * 2
101
+ if isinstance(pad, (tuple, list)):
102
+ return pad
103
+ raise ValueError(arg_invalid_info(op_name, arg_name, pad))
104
+
105
+
82
106
  def to_paddings(op_name, arg_name, pad):
83
107
  """
84
108
  convert paddings: int -> tuple[int*4].
@@ -68,6 +68,8 @@ class StringToEnum(Primitive):
68
68
 
69
69
  def __call__(self, op_name, arg_name, enum_str):
70
70
  """Run in PyNative mode"""
71
+ if enum_str is None:
72
+ return None
71
73
  if not isinstance(enum_str, str):
72
74
  raise TypeError(f"For '{op_name}', the input '{arg_name}' should be a str, but got {type(enum_str)}.")
73
75
  return op_enum.str_to_enum(op_name, arg_name, enum_str)
@@ -203,10 +203,15 @@ def generate_pyboost_op_source_code(work_path, op_proto, template_paths, convert
203
203
  customize_include = "#include \"plugin/device/gpu/kernel/pyboost/customize/{}.h\"".format(
204
204
  operator_name.lower())
205
205
  elif op_proto.is_view:
206
+ set_output_abs = "SetOutputAbstract();"
207
+ if converter.call_func_outputs == "outputs_":
208
+ set_output_abs = "SetOutputTupleAbstract();"
206
209
  call_impl = view_tpl.replace(op_name=op_proto.class_name,
207
210
  call_args=converter.call_args,
208
211
  call_tensors=call_args_tensor,
209
- input=converter.call_args[0])
212
+ return_values=converter.call_func_outputs,
213
+ input=converter.call_args[0],
214
+ set_output_abs=set_output_abs)
210
215
  customize_include = "#include \"mindspore/core/ops/view/{}_strides_calc.h\"".format(proto_operator_name)
211
216
  else:
212
217
  cast_input_code, real_call_args_tensor = generate_tensor_cpu_cast_input_code(
@@ -799,17 +804,19 @@ def gen_pyboost_inner_prim(work_path, op_yaml_data):
799
804
  gen_header += template.PYBOOST_PY_FUNC_IMPORT_HEADEAR.replace(class_name=op_proto.class_name)
800
805
  args = operator_data.get('args')
801
806
  input_args = []
807
+ processed_args = []
802
808
  process_func = ''
803
809
  for arg_name, arg_info in args.items():
804
810
  arg_handler = arg_info.get('arg_handler')
805
- input_arg = arg_name
811
+ processed_arg = arg_name
806
812
  if arg_handler is not None and arg_handler != 'dtype_to_type_id':
807
813
  process_func += f"""converted_{arg_name} = {arg_handler}({arg_name})\n"""
808
- input_arg = 'converted_' + arg_name
809
- input_args.append(input_arg)
810
-
814
+ processed_arg = 'converted_' + arg_name
815
+ input_args.append(arg_name)
816
+ processed_args.append(processed_arg)
811
817
  gen_py += template.PYTHON_PRIM_TEMPLATE.replace(class_name=op_proto.class_name, input_args=input_args,
812
- process_func=process_func, func_impl_name=operator_name)
818
+ process_func=process_func, func_impl_name=operator_name,
819
+ processed_args=processed_args)
813
820
  dir_path = os.path.join(work_path, "mindspore/python/mindspore/ops/auto_generate")
814
821
  pathlib.Path(dir_path).mkdir(parents=True, exist_ok=True)
815
822
  dst_file_path = os.path.join(dir_path, "pyboost_inner_prim.py")
@@ -50,22 +50,7 @@ def get_index(index: int):
50
50
  :param index:
51
51
  :return: str
52
52
  """
53
- index_map = {
54
- 0: 'kIndex0',
55
- 1: 'kIndex1',
56
- 2: 'kIndex2',
57
- 3: 'kIndex3',
58
- 4: 'kIndex4',
59
- 5: 'kIndex5',
60
- 6: 'kIndex6',
61
- 7: 'kIndex7',
62
- 8: 'kIndex8',
63
- 9: 'kIndex9',
64
- 10: 'kIndex10',
65
- }
66
- if index in index_map:
67
- return index_map[index]
68
- raise TypeError(f"""Unsupported index {index} for index map.""")
53
+ return "kIndex" + str(index)
69
54
 
70
55
 
71
56
  def get_convert_type_str(dtype: str, optional):
@@ -226,7 +211,7 @@ def get_input_dtype(dtype: str, optional):
226
211
 
227
212
 
228
213
  def is_cube(class_name):
229
- cube_set = {'Bmm', 'Baddbmm', 'MatMul'}
214
+ cube_set = {'Bmm', 'Baddbmm', 'MatMulExt', 'Mv'}
230
215
  if class_name in cube_set:
231
216
  return True
232
217
  return False
@@ -18,10 +18,11 @@ from __future__ import absolute_import
18
18
  from mindspore.parallel.algo_parameter_config import get_algo_parameters, reset_algo_parameters, \
19
19
  set_algo_parameters
20
20
  from mindspore.parallel.checkpoint_transform import rank_list_for_transform, transform_checkpoint_by_rank, \
21
- transform_checkpoints, merge_pipeline_strategys, sync_pipeline_shared_parameters
21
+ transform_checkpoints, merge_pipeline_strategys, sync_pipeline_shared_parameters, \
22
+ load_segmented_checkpoints
22
23
  from mindspore.parallel.parameter_broadcast import parameter_broadcast
23
24
  from mindspore.parallel.shard import shard, Layout
24
25
 
25
26
  __all__ = ["set_algo_parameters", "reset_algo_parameters", "get_algo_parameters", "rank_list_for_transform",
26
27
  "transform_checkpoint_by_rank", "transform_checkpoints", "merge_pipeline_strategys", "shard",
27
- "sync_pipeline_shared_parameters", "Layout", "parameter_broadcast"]
28
+ "sync_pipeline_shared_parameters", "Layout", "parameter_broadcast", "load_segmented_checkpoints"]