mindspore 2.5.0__cp311-cp311-win_amd64.whl → 2.6.0__cp311-cp311-win_amd64.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 (493) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
  3. mindspore/Newtonsoft.Json.dll +0 -0
  4. mindspore/__init__.py +6 -4
  5. mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
  8. mindspore/_check_jit_forbidden_api.py +3 -0
  9. mindspore/_checkparam.py +3 -33
  10. mindspore/_deprecated/__init__.py +17 -0
  11. mindspore/_deprecated/jit.py +198 -0
  12. mindspore/_extends/builtin_operations.py +1 -1
  13. mindspore/_extends/parse/__init__.py +6 -7
  14. mindspore/_extends/parse/compile_config.py +19 -0
  15. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +22 -3
  16. mindspore/_extends/parse/jit_fallback_modules/__init__.py +0 -0
  17. mindspore/_extends/parse/jit_fallback_modules/check_utils.py +123 -0
  18. mindspore/_extends/parse/jit_fallback_modules/third_party_modules.py +50 -0
  19. mindspore/_extends/parse/parser.py +25 -194
  20. mindspore/_extends/parse/resources.py +1 -5
  21. mindspore/_extends/parse/standard_method.py +109 -75
  22. mindspore/_extends/pijit/__init__.py +2 -2
  23. mindspore/_extends/pijit/pijit_func_white_list.py +16 -11
  24. mindspore/_extends/pijit/tensor_func_list.py +27 -0
  25. mindspore/_extends/utils.py +1 -1
  26. mindspore/amp.py +4 -4
  27. mindspore/atlprov.dll +0 -0
  28. mindspore/avcodec-59.dll +0 -0
  29. mindspore/avdevice-59.dll +0 -0
  30. mindspore/avfilter-8.dll +0 -0
  31. mindspore/avformat-59.dll +0 -0
  32. mindspore/avutil-57.dll +0 -0
  33. mindspore/boost/__init__.py +2 -2
  34. mindspore/boost/base.py +3 -7
  35. mindspore/boost/boost_cell_wrapper.py +2 -2
  36. mindspore/c1.dll +0 -0
  37. mindspore/c1xx.dll +0 -0
  38. mindspore/c2.dll +0 -0
  39. mindspore/common/__init__.py +4 -3
  40. mindspore/common/_grad_function.py +56 -0
  41. mindspore/common/_pijit_context.py +14 -5
  42. mindspore/common/_register_for_tensor.py +1 -1
  43. mindspore/common/_stub_tensor.py +5 -10
  44. mindspore/common/_tensor_cpp_method.py +1 -1
  45. mindspore/common/_tensor_docs.py +2014 -3386
  46. mindspore/common/api.py +386 -355
  47. mindspore/common/auto_dynamic_shape.py +41 -44
  48. mindspore/common/dtype.py +5 -2
  49. mindspore/common/dump.py +7 -5
  50. mindspore/common/file_system.py +3 -0
  51. mindspore/common/generator.py +3 -0
  52. mindspore/common/hook_handle.py +5 -3
  53. mindspore/common/initializer.py +10 -6
  54. mindspore/common/jit_begin_end.py +94 -0
  55. mindspore/common/jit_config.py +6 -1
  56. mindspore/common/jit_context.py +76 -0
  57. mindspore/common/jit_trace.py +378 -0
  58. mindspore/common/lazy_inline.py +2 -2
  59. mindspore/common/mutable.py +5 -4
  60. mindspore/common/parameter.py +106 -39
  61. mindspore/common/seed.py +2 -2
  62. mindspore/common/sparse_tensor.py +23 -17
  63. mindspore/common/tensor.py +332 -714
  64. mindspore/communication/__init__.py +7 -5
  65. mindspore/communication/_comm_helper.py +47 -2
  66. mindspore/communication/comm_func.py +70 -53
  67. mindspore/communication/management.py +83 -17
  68. mindspore/context.py +228 -571
  69. mindspore/dataset/__init__.py +44 -20
  70. mindspore/dataset/audio/__init__.py +2 -8
  71. mindspore/dataset/audio/transforms.py +3 -17
  72. mindspore/dataset/core/config.py +3 -3
  73. mindspore/dataset/engine/cache_client.py +1 -1
  74. mindspore/dataset/engine/datasets.py +102 -120
  75. mindspore/dataset/engine/datasets_audio.py +22 -22
  76. mindspore/dataset/engine/datasets_standard_format.py +43 -24
  77. mindspore/dataset/engine/datasets_text.py +78 -85
  78. mindspore/dataset/engine/datasets_user_defined.py +109 -77
  79. mindspore/dataset/engine/datasets_vision.py +111 -108
  80. mindspore/dataset/engine/iterators.py +5 -3
  81. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +1 -1
  82. mindspore/dataset/engine/samplers.py +279 -57
  83. mindspore/dataset/engine/serializer_deserializer.py +2 -1
  84. mindspore/dataset/engine/validators.py +10 -0
  85. mindspore/dataset/text/__init__.py +7 -6
  86. mindspore/dataset/text/transforms.py +6 -5
  87. mindspore/dataset/text/utils.py +3 -3
  88. mindspore/dataset/transforms/__init__.py +0 -9
  89. mindspore/dataset/transforms/transforms.py +3 -3
  90. mindspore/dataset/utils/browse_dataset.py +1 -1
  91. mindspore/dataset/vision/__init__.py +2 -9
  92. mindspore/dataset/vision/transforms.py +202 -158
  93. mindspore/dataset/vision/utils.py +7 -5
  94. mindspore/device_context/ascend/op_debug.py +60 -1
  95. mindspore/device_context/ascend/op_tuning.py +0 -4
  96. mindspore/device_manager.py +39 -3
  97. mindspore/dnnl.dll +0 -0
  98. mindspore/dpcmi.dll +0 -0
  99. mindspore/experimental/es/embedding_service.py +35 -27
  100. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -2
  101. mindspore/experimental/map_parameter.py +4 -4
  102. mindspore/experimental/optim/adadelta.py +22 -26
  103. mindspore/experimental/optim/adagrad.py +4 -4
  104. mindspore/experimental/optim/adam.py +4 -0
  105. mindspore/experimental/optim/adamax.py +4 -4
  106. mindspore/experimental/optim/adamw.py +4 -0
  107. mindspore/experimental/optim/asgd.py +1 -1
  108. mindspore/experimental/optim/lr_scheduler.py +40 -22
  109. mindspore/experimental/optim/radam.py +5 -5
  110. mindspore/experimental/optim/rprop.py +1 -1
  111. mindspore/experimental/optim/sgd.py +1 -1
  112. mindspore/hal/contiguous_tensors_handle.py +6 -10
  113. mindspore/hal/device.py +55 -81
  114. mindspore/hal/event.py +38 -55
  115. mindspore/hal/memory.py +115 -147
  116. mindspore/hal/stream.py +81 -125
  117. mindspore/include/dataset/constants.h +7 -4
  118. mindspore/include/dataset/execute.h +2 -2
  119. mindspore/jpeg62.dll +0 -0
  120. mindspore/log.py +40 -2
  121. mindspore/mindrecord/__init__.py +20 -7
  122. mindspore/mindspore_backend_common.dll +0 -0
  123. mindspore/mindspore_backend_manager.dll +0 -0
  124. mindspore/mindspore_common.dll +0 -0
  125. mindspore/mindspore_core.dll +0 -0
  126. mindspore/mindspore_dump.dll +0 -0
  127. mindspore/mindspore_frontend.dll +0 -0
  128. mindspore/mindspore_glog.dll +0 -0
  129. mindspore/mindspore_memory_pool.dll +0 -0
  130. mindspore/mindspore_ms_backend.dll +0 -0
  131. mindspore/mindspore_ops.dll +0 -0
  132. mindspore/{mindspore_backend.dll → mindspore_ops_host.dll} +0 -0
  133. mindspore/mindspore_ops_kernel_common.dll +0 -0
  134. mindspore/mindspore_profiler.dll +0 -0
  135. mindspore/mindspore_pyboost.dll +0 -0
  136. mindspore/mindspore_pynative.dll +0 -0
  137. mindspore/mindspore_res_manager.dll +0 -0
  138. mindspore/mindspore_runtime_pipeline.dll +0 -0
  139. mindspore/mint/__init__.py +133 -702
  140. mindspore/mint/distributed/__init__.py +5 -1
  141. mindspore/mint/distributed/distributed.py +198 -113
  142. mindspore/mint/linalg/__init__.py +2 -0
  143. mindspore/mint/nn/__init__.py +280 -18
  144. mindspore/mint/nn/functional.py +282 -64
  145. mindspore/mint/nn/layer/__init__.py +4 -0
  146. mindspore/mint/nn/layer/_functions.py +7 -3
  147. mindspore/mint/nn/layer/activation.py +120 -13
  148. mindspore/mint/nn/layer/conv.py +234 -28
  149. mindspore/mint/nn/layer/normalization.py +15 -16
  150. mindspore/mint/nn/layer/padding.py +1 -1
  151. mindspore/mint/nn/layer/pooling.py +66 -1
  152. mindspore/mint/optim/__init__.py +2 -1
  153. mindspore/mint/optim/sgd.py +171 -0
  154. mindspore/msobj140.dll +0 -0
  155. mindspore/mspdb140.dll +0 -0
  156. mindspore/mspdbcore.dll +0 -0
  157. mindspore/mspdbst.dll +0 -0
  158. mindspore/mspft140.dll +0 -0
  159. mindspore/msvcdis140.dll +0 -0
  160. mindspore/msvcp140_1.dll +0 -0
  161. mindspore/msvcp140_2.dll +0 -0
  162. mindspore/msvcp140_atomic_wait.dll +0 -0
  163. mindspore/msvcp140_codecvt_ids.dll +0 -0
  164. mindspore/nn/__init__.py +4 -1
  165. mindspore/nn/cell.py +1253 -179
  166. mindspore/nn/layer/activation.py +23 -21
  167. mindspore/nn/layer/basic.py +22 -16
  168. mindspore/nn/layer/container.py +1 -1
  169. mindspore/nn/layer/conv.py +53 -42
  170. mindspore/nn/layer/embedding.py +9 -8
  171. mindspore/nn/layer/normalization.py +48 -42
  172. mindspore/nn/layer/pooling.py +75 -31
  173. mindspore/nn/layer/transformer.py +11 -10
  174. mindspore/nn/learning_rate_schedule.py +4 -2
  175. mindspore/nn/loss/loss.py +27 -19
  176. mindspore/nn/optim/ada_grad.py +6 -5
  177. mindspore/nn/optim/adadelta.py +9 -7
  178. mindspore/nn/optim/adafactor.py +1 -1
  179. mindspore/nn/optim/adam.py +18 -14
  180. mindspore/nn/optim/adamax.py +8 -7
  181. mindspore/nn/optim/adasum.py +5 -5
  182. mindspore/nn/optim/asgd.py +3 -1
  183. mindspore/nn/optim/ftrl.py +11 -9
  184. mindspore/nn/optim/lamb.py +1 -1
  185. mindspore/nn/optim/lazyadam.py +12 -10
  186. mindspore/nn/optim/momentum.py +7 -6
  187. mindspore/nn/optim/optimizer.py +2 -2
  188. mindspore/nn/optim/proximal_ada_grad.py +12 -10
  189. mindspore/nn/optim/rmsprop.py +13 -12
  190. mindspore/nn/optim/rprop.py +9 -7
  191. mindspore/nn/optim/sgd.py +9 -6
  192. mindspore/nn/optim/tft_wrapper.py +5 -2
  193. mindspore/nn/probability/bijector/bijector.py +17 -11
  194. mindspore/nn/probability/bijector/gumbel_cdf.py +5 -5
  195. mindspore/nn/probability/bijector/invert.py +2 -2
  196. mindspore/nn/probability/bijector/scalar_affine.py +3 -3
  197. mindspore/nn/probability/bijector/softplus.py +3 -2
  198. mindspore/nn/probability/distribution/beta.py +3 -3
  199. mindspore/nn/probability/distribution/categorical.py +1 -1
  200. mindspore/nn/probability/distribution/cauchy.py +4 -2
  201. mindspore/nn/probability/distribution/exponential.py +6 -7
  202. mindspore/nn/probability/distribution/gamma.py +2 -2
  203. mindspore/nn/probability/distribution/gumbel.py +2 -2
  204. mindspore/nn/probability/distribution/half_normal.py +5 -3
  205. mindspore/nn/probability/distribution/logistic.py +5 -3
  206. mindspore/nn/probability/distribution/poisson.py +1 -1
  207. mindspore/nn/probability/distribution/uniform.py +5 -3
  208. mindspore/nn/reinforcement/_tensors_queue.py +1 -1
  209. mindspore/nn/reinforcement/tensor_array.py +1 -1
  210. mindspore/nn/wrap/__init__.py +6 -6
  211. mindspore/nn/wrap/cell_wrapper.py +178 -117
  212. mindspore/nn/wrap/grad_reducer.py +45 -36
  213. mindspore/nn/wrap/loss_scale.py +3 -3
  214. mindspore/numpy/array_creations.py +3 -3
  215. mindspore/numpy/array_ops.py +1 -1
  216. mindspore/numpy/utils.py +1 -2
  217. mindspore/numpy/utils_const.py +1 -2
  218. mindspore/opencv_core452.dll +0 -0
  219. mindspore/opencv_imgcodecs452.dll +0 -0
  220. mindspore/opencv_imgproc452.dll +0 -0
  221. mindspore/ops/__init__.py +3 -2
  222. mindspore/ops/_grad_experimental/grad_comm_ops.py +18 -3
  223. mindspore/ops/_grad_experimental/grad_debug_ops.py +8 -1
  224. mindspore/ops/_grad_experimental/taylor_rule.py +29 -0
  225. mindspore/ops/_register_for_op.py +0 -11
  226. mindspore/{ops_generate → ops/_utils}/arg_dtype_cast.py +123 -4
  227. mindspore/{ops_generate → ops/_utils}/arg_handler.py +3 -4
  228. mindspore/ops/_vmap/vmap_array_ops.py +32 -6
  229. mindspore/ops/_vmap/vmap_grad_nn_ops.py +2 -1
  230. mindspore/ops/_vmap/vmap_math_ops.py +4 -7
  231. mindspore/ops/_vmap/vmap_nn_ops.py +9 -8
  232. mindspore/ops/auto_generate/__init__.py +4 -3
  233. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +127 -52
  234. mindspore/ops/auto_generate/gen_extend_func.py +286 -208
  235. mindspore/ops/auto_generate/gen_ops_def.py +2783 -2335
  236. mindspore/ops/auto_generate/gen_ops_prim.py +8992 -2686
  237. mindspore/ops/auto_generate/pyboost_inner_prim.py +106 -76
  238. mindspore/ops/composite/__init__.py +2 -1
  239. mindspore/ops/composite/base.py +19 -24
  240. mindspore/ops/composite/math_ops.py +6 -16
  241. mindspore/ops/composite/multitype_ops/__init__.py +5 -2
  242. mindspore/ops/composite/multitype_ops/_compile_utils.py +4 -5
  243. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -2
  244. mindspore/ops/composite/multitype_ops/add_impl.py +2 -1
  245. mindspore/ops/composite/multitype_ops/bitwise_and_impl.py +2 -1
  246. mindspore/ops/composite/multitype_ops/bitwise_or_impl.py +2 -1
  247. mindspore/ops/composite/multitype_ops/bitwise_xor_impl.py +2 -1
  248. mindspore/ops/composite/multitype_ops/div_impl.py +6 -4
  249. mindspore/ops/composite/multitype_ops/equal_impl.py +4 -3
  250. mindspore/ops/composite/multitype_ops/floordiv_impl.py +2 -1
  251. mindspore/ops/composite/multitype_ops/getitem_impl.py +3 -2
  252. mindspore/ops/composite/multitype_ops/greater_equal_impl.py +4 -3
  253. mindspore/ops/composite/multitype_ops/greater_impl.py +4 -3
  254. mindspore/ops/composite/multitype_ops/in_impl.py +2 -1
  255. mindspore/ops/composite/multitype_ops/invert_impl.py +50 -0
  256. mindspore/ops/composite/multitype_ops/left_shift_impl.py +2 -1
  257. mindspore/ops/composite/multitype_ops/less_equal_impl.py +4 -3
  258. mindspore/ops/composite/multitype_ops/less_impl.py +4 -3
  259. mindspore/ops/composite/multitype_ops/logic_not_impl.py +3 -2
  260. mindspore/ops/composite/multitype_ops/logical_and_impl.py +2 -1
  261. mindspore/ops/composite/multitype_ops/logical_or_impl.py +2 -1
  262. mindspore/ops/composite/multitype_ops/mod_impl.py +2 -1
  263. mindspore/ops/composite/multitype_ops/mul_impl.py +3 -2
  264. mindspore/ops/composite/multitype_ops/negative_impl.py +2 -1
  265. mindspore/ops/composite/multitype_ops/not_equal_impl.py +2 -1
  266. mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -1
  267. mindspore/ops/composite/multitype_ops/ones_like_impl.py +18 -0
  268. mindspore/ops/composite/multitype_ops/pow_impl.py +2 -1
  269. mindspore/ops/composite/multitype_ops/right_shift_impl.py +2 -1
  270. mindspore/ops/composite/multitype_ops/setitem_impl.py +2 -1
  271. mindspore/ops/composite/multitype_ops/sub_impl.py +2 -1
  272. mindspore/ops/function/__init__.py +28 -2
  273. mindspore/ops/function/_add_attr_func.py +58 -0
  274. mindspore/ops/function/array_func.py +1631 -2347
  275. mindspore/ops/function/clip_func.py +38 -45
  276. mindspore/ops/function/debug_func.py +36 -44
  277. mindspore/ops/function/grad/__init__.py +1 -0
  278. mindspore/ops/function/grad/grad_func.py +104 -71
  279. mindspore/ops/function/image_func.py +1 -1
  280. mindspore/ops/function/linalg_func.py +46 -78
  281. mindspore/ops/function/math_func.py +3024 -3855
  282. mindspore/ops/function/nn_func.py +678 -274
  283. mindspore/ops/function/other_func.py +159 -1
  284. mindspore/ops/function/parameter_func.py +17 -30
  285. mindspore/ops/function/random_func.py +216 -361
  286. mindspore/ops/function/reshard_func.py +4 -70
  287. mindspore/ops/function/sparse_func.py +3 -3
  288. mindspore/ops/function/sparse_unary_func.py +5 -5
  289. mindspore/ops/function/spectral_func.py +25 -58
  290. mindspore/ops/function/vmap_func.py +26 -18
  291. mindspore/ops/functional.py +8 -5
  292. mindspore/ops/functional_overload.py +655 -4
  293. mindspore/ops/op_info_register.py +32 -244
  294. mindspore/ops/operations/__init__.py +21 -14
  295. mindspore/ops/operations/_custom_ops_utils.py +235 -0
  296. mindspore/ops/operations/_grad_ops.py +1 -10
  297. mindspore/ops/operations/_inner_ops.py +5 -76
  298. mindspore/ops/operations/_ms_kernel.py +4 -10
  299. mindspore/ops/operations/_rl_inner_ops.py +1 -1
  300. mindspore/ops/operations/_scalar_ops.py +3 -2
  301. mindspore/ops/operations/_sequence_ops.py +1 -1
  302. mindspore/ops/operations/_tensor_array.py +1 -1
  303. mindspore/ops/operations/array_ops.py +39 -24
  304. mindspore/ops/operations/comm_ops.py +150 -107
  305. mindspore/ops/operations/custom_ops.py +287 -32
  306. mindspore/ops/operations/debug_ops.py +119 -16
  307. mindspore/ops/operations/inner_ops.py +1 -1
  308. mindspore/ops/operations/linalg_ops.py +1 -58
  309. mindspore/ops/operations/manually_defined/_inner.py +1 -1
  310. mindspore/ops/operations/manually_defined/ops_def.py +746 -79
  311. mindspore/ops/operations/math_ops.py +21 -18
  312. mindspore/ops/operations/nn_ops.py +67 -224
  313. mindspore/ops/operations/other_ops.py +62 -9
  314. mindspore/ops/operations/random_ops.py +13 -7
  315. mindspore/ops/operations/reshard_ops.py +1 -1
  316. mindspore/ops/operations/sparse_ops.py +2 -2
  317. mindspore/ops/primitive.py +43 -32
  318. mindspore/ops/tensor_method.py +243 -17
  319. mindspore/ops_generate/__init__.py +0 -5
  320. mindspore/ops_generate/aclnn/__init__.py +0 -0
  321. mindspore/ops_generate/{aclnn_kernel_register_auto_cc_generator.py → aclnn/aclnn_kernel_register_auto_cc_generator.py} +43 -18
  322. mindspore/ops_generate/{gen_aclnn_implement.py → aclnn/gen_aclnn_implement.py} +49 -51
  323. mindspore/ops_generate/api/__init__.py +0 -0
  324. mindspore/ops_generate/{add_tensor_docs_generator.py → api/add_tensor_docs_generator.py} +9 -7
  325. mindspore/ops_generate/{cpp_create_prim_instance_helper_generator.py → api/cpp_create_prim_instance_helper_generator.py} +6 -9
  326. mindspore/ops_generate/{functional_map_cpp_generator.py → api/functional_map_cpp_generator.py} +25 -12
  327. mindspore/ops_generate/{functional_overload_py_generator.py → api/functional_overload_py_generator.py} +8 -6
  328. mindspore/ops_generate/{functions_cc_generator.py → api/functions_cc_generator.py} +14 -10
  329. mindspore/ops_generate/api/gen_api.py +103 -0
  330. mindspore/ops_generate/{op_api_proto.py → api/op_api_proto.py} +98 -69
  331. mindspore/ops_generate/{tensor_func_reg_cpp_generator.py → api/tensor_func_reg_cpp_generator.py} +82 -43
  332. mindspore/ops_generate/common/__init__.py +0 -0
  333. mindspore/ops_generate/common/gen_constants.py +91 -0
  334. mindspore/ops_generate/{gen_utils.py → common/gen_utils.py} +72 -19
  335. mindspore/ops_generate/{op_proto.py → common/op_proto.py} +64 -1
  336. mindspore/ops_generate/{template.py → common/template.py} +96 -84
  337. mindspore/ops_generate/gen_ops.py +23 -325
  338. mindspore/ops_generate/op_def/__init__.py +0 -0
  339. mindspore/ops_generate/op_def/gen_op_def.py +90 -0
  340. mindspore/ops_generate/{lite_ops_cpp_generator.py → op_def/lite_ops_cpp_generator.py} +47 -11
  341. mindspore/ops_generate/{ops_def_cc_generator.py → op_def/ops_def_cc_generator.py} +18 -10
  342. mindspore/ops_generate/{ops_def_h_generator.py → op_def/ops_def_h_generator.py} +5 -5
  343. mindspore/ops_generate/{ops_name_h_generator.py → op_def/ops_name_h_generator.py} +30 -15
  344. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +125 -0
  345. mindspore/ops_generate/op_def_py/__init__.py +0 -0
  346. mindspore/ops_generate/op_def_py/gen_op_def_py.py +47 -0
  347. mindspore/ops_generate/{op_def_py_generator.py → op_def_py/op_def_py_generator.py} +6 -5
  348. mindspore/ops_generate/{op_prim_py_generator.py → op_def_py/op_prim_py_generator.py} +24 -15
  349. mindspore/ops_generate/pyboost/__init__.py +0 -0
  350. mindspore/ops_generate/{auto_grad_impl_cc_generator.py → pyboost/auto_grad_impl_cc_generator.py} +11 -7
  351. mindspore/ops_generate/{auto_grad_reg_cc_generator.py → pyboost/auto_grad_reg_cc_generator.py} +7 -7
  352. mindspore/ops_generate/{gen_pyboost_func.py → pyboost/gen_pyboost_func.py} +40 -16
  353. mindspore/ops_generate/{op_template_parser.py → pyboost/op_template_parser.py} +105 -24
  354. mindspore/ops_generate/{pyboost_functions_cpp_generator.py → pyboost/pyboost_functions_cpp_generator.py} +55 -18
  355. mindspore/ops_generate/{pyboost_functions_h_generator.py → pyboost/pyboost_functions_h_generator.py} +42 -10
  356. mindspore/ops_generate/{pyboost_functions_py_generator.py → pyboost/pyboost_functions_py_generator.py} +6 -6
  357. mindspore/ops_generate/{pyboost_grad_function_cpp_generator.py → pyboost/pyboost_grad_function_cpp_generator.py} +11 -10
  358. mindspore/ops_generate/{pyboost_inner_prim_generator.py → pyboost/pyboost_inner_prim_generator.py} +8 -7
  359. mindspore/ops_generate/{pyboost_native_grad_functions_generator.py → pyboost/pyboost_native_grad_functions_generator.py} +14 -10
  360. mindspore/ops_generate/{pyboost_op_cpp_code_generator.py → pyboost/pyboost_op_cpp_code_generator.py} +140 -53
  361. mindspore/ops_generate/{pyboost_overload_functions_cpp_generator.py → pyboost/pyboost_overload_functions_cpp_generator.py} +28 -15
  362. mindspore/ops_generate/{pyboost_utils.py → pyboost/pyboost_utils.py} +88 -4
  363. mindspore/ops_generate/resources/__init__.py +0 -0
  364. mindspore/ops_generate/resources/resource_list.py +30 -0
  365. mindspore/ops_generate/resources/resource_loader.py +36 -0
  366. mindspore/ops_generate/resources/resource_manager.py +64 -0
  367. mindspore/ops_generate/resources/yaml_loader.py +88 -0
  368. mindspore/ops_generate/tensor_py_cc_generator.py +122 -0
  369. mindspore/parallel/__init__.py +6 -2
  370. mindspore/parallel/_auto_parallel_context.py +140 -12
  371. mindspore/parallel/_cell_wrapper.py +132 -15
  372. mindspore/parallel/_parallel_serialization.py +95 -4
  373. mindspore/parallel/_ps_context.py +1 -1
  374. mindspore/parallel/_recovery_context.py +7 -2
  375. mindspore/parallel/_tensor.py +142 -18
  376. mindspore/parallel/_utils.py +198 -25
  377. mindspore/parallel/algo_parameter_config.py +3 -3
  378. mindspore/parallel/auto_parallel.py +732 -0
  379. mindspore/parallel/checkpoint_convert.py +159 -0
  380. mindspore/parallel/checkpoint_transform.py +658 -37
  381. mindspore/parallel/cluster/process_entity/_api.py +151 -19
  382. mindspore/parallel/cluster/run.py +1 -1
  383. mindspore/parallel/function/__init__.py +24 -0
  384. mindspore/parallel/function/reshard_func.py +258 -0
  385. mindspore/parallel/nn/__init__.py +25 -0
  386. mindspore/parallel/nn/parallel_cell_wrapper.py +263 -0
  387. mindspore/parallel/nn/parallel_grad_reducer.py +169 -0
  388. mindspore/parallel/parameter_broadcast.py +24 -13
  389. mindspore/parallel/shard.py +137 -62
  390. mindspore/parallel/transform_safetensors.py +288 -95
  391. mindspore/pgodb140.dll +0 -0
  392. mindspore/pgort140.dll +0 -0
  393. mindspore/profiler/__init__.py +9 -5
  394. mindspore/profiler/analysis/parser/ascend_cann_parser.py +6 -2
  395. mindspore/profiler/analysis/parser/ms_framework_parser.py +4 -4
  396. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -4
  397. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +25 -0
  398. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  399. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +241 -86
  400. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +41 -2
  401. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +33 -35
  402. mindspore/profiler/analysis/viewer/ascend_memory_viewer.py +7 -0
  403. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +8 -3
  404. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +141 -30
  405. mindspore/profiler/analysis/viewer/ms_dataset_viewer.py +5 -6
  406. mindspore/profiler/common/ascend_msprof_exporter.py +5 -4
  407. mindspore/profiler/common/constant.py +12 -0
  408. mindspore/profiler/common/msprof_cmd_tool.py +42 -23
  409. mindspore/profiler/common/path_manager.py +24 -0
  410. mindspore/profiler/common/profiler_context.py +26 -2
  411. mindspore/profiler/common/profiler_meta_data.py +74 -0
  412. mindspore/profiler/common/profiler_parameters.py +59 -18
  413. mindspore/profiler/common/profiler_path_manager.py +66 -7
  414. mindspore/profiler/dynamic_profiler.py +112 -79
  415. mindspore/profiler/envprofiler.py +26 -1
  416. mindspore/profiler/experimental_config.py +197 -0
  417. mindspore/profiler/mstx.py +57 -14
  418. mindspore/profiler/platform/npu_profiler.py +33 -7
  419. mindspore/profiler/profiler.py +541 -45
  420. mindspore/profiler/profiler_action_controller.py +1 -1
  421. mindspore/profiler/profiler_interface.py +4 -0
  422. mindspore/profiler/schedule.py +57 -22
  423. mindspore/rewrite/api/node.py +15 -13
  424. mindspore/rewrite/api/symbol_tree.py +1 -1
  425. mindspore/run_check/_check_version.py +25 -14
  426. mindspore/run_check/run_check.py +1 -1
  427. mindspore/runtime/__init__.py +2 -2
  428. mindspore/runtime/executor.py +40 -11
  429. mindspore/runtime/memory.py +37 -13
  430. mindspore/safeguard/rewrite_obfuscation.py +12 -9
  431. mindspore/swresample-4.dll +0 -0
  432. mindspore/swscale-6.dll +0 -0
  433. mindspore/tbbmalloc.dll +0 -0
  434. mindspore/tinyxml2.dll +0 -0
  435. mindspore/train/__init__.py +8 -8
  436. mindspore/train/_utils.py +43 -9
  437. mindspore/train/amp.py +1 -1
  438. mindspore/train/callback/__init__.py +2 -2
  439. mindspore/train/callback/_callback.py +2 -16
  440. mindspore/train/callback/_checkpoint.py +24 -40
  441. mindspore/train/callback/_cluster_monitor.py +14 -18
  442. mindspore/train/callback/_flops_collector.py +2 -3
  443. mindspore/train/callback/_history.py +7 -4
  444. mindspore/train/callback/_lambda_callback.py +2 -2
  445. mindspore/train/callback/_landscape.py +0 -3
  446. mindspore/train/callback/_loss_monitor.py +2 -1
  447. mindspore/train/callback/_on_request_exit.py +6 -5
  448. mindspore/train/callback/_reduce_lr_on_plateau.py +11 -6
  449. mindspore/train/callback/_summary_collector.py +8 -13
  450. mindspore/train/callback/_time_monitor.py +2 -1
  451. mindspore/train/callback/{_tft_register.py → _train_fault_tolerance.py} +204 -105
  452. mindspore/train/data_sink.py +25 -2
  453. mindspore/train/dataset_helper.py +4 -5
  454. mindspore/train/loss_scale_manager.py +8 -7
  455. mindspore/train/metrics/accuracy.py +3 -3
  456. mindspore/train/metrics/confusion_matrix.py +9 -9
  457. mindspore/train/metrics/error.py +3 -3
  458. mindspore/train/metrics/hausdorff_distance.py +4 -4
  459. mindspore/train/metrics/mean_surface_distance.py +3 -3
  460. mindspore/train/metrics/metric.py +0 -12
  461. mindspore/train/metrics/occlusion_sensitivity.py +4 -2
  462. mindspore/train/metrics/precision.py +8 -6
  463. mindspore/train/metrics/recall.py +9 -9
  464. mindspore/train/metrics/root_mean_square_surface_distance.py +2 -2
  465. mindspore/train/mind_ir_pb2.py +19 -12
  466. mindspore/train/model.py +262 -127
  467. mindspore/train/serialization.py +246 -988
  468. mindspore/train/summary/_summary_adapter.py +2 -2
  469. mindspore/train/summary/summary_record.py +1 -1
  470. mindspore/turbojpeg.dll +0 -0
  471. mindspore/utils/__init__.py +3 -2
  472. mindspore/utils/dryrun.py +4 -2
  473. mindspore/utils/hooks.py +81 -0
  474. mindspore/utils/runtime_execution_order_check.py +2 -0
  475. mindspore/utils/utils.py +138 -4
  476. mindspore/vcmeta.dll +0 -0
  477. mindspore/vcruntime140.dll +0 -0
  478. mindspore/vcruntime140_1.dll +0 -0
  479. mindspore/version.py +1 -1
  480. {mindspore-2.5.0.dist-info → mindspore-2.6.0.dist-info}/METADATA +2 -1
  481. {mindspore-2.5.0.dist-info → mindspore-2.6.0.dist-info}/RECORD +485 -440
  482. mindspore/_install_custom.py +0 -43
  483. mindspore/common/_register_for_adapter.py +0 -74
  484. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +0 -252
  485. mindspore/ops/auto_generate/gen_arg_handler.py +0 -136
  486. mindspore/ops/operations/_opaque_predicate_registry.py +0 -41
  487. mindspore/ops_generate/gen_constants.py +0 -190
  488. mindspore/ops_generate/gen_ops_inner_prim.py +0 -131
  489. mindspore/ops_generate/ops_primitive_h_generator.py +0 -81
  490. /mindspore/ops_generate/{base_generator.py → common/base_generator.py} +0 -0
  491. {mindspore-2.5.0.dist-info → mindspore-2.6.0.dist-info}/WHEEL +0 -0
  492. {mindspore-2.5.0.dist-info → mindspore-2.6.0.dist-info}/entry_points.txt +0 -0
  493. {mindspore-2.5.0.dist-info → mindspore-2.6.0.dist-info}/top_level.txt +0 -0
@@ -98,7 +98,7 @@ class ProfilerActionController:
98
98
  # Handle special case for ProfilerAction.RECORD_AND_SAVE to ProfilerAction.RECORD_AND_SAVE transition
99
99
  if start_state == ProfilerAction.RECORD_AND_SAVE and end_state == ProfilerAction.RECORD_AND_SAVE:
100
100
  process_action = [self.prof_interface.stop, self.prof_interface.finalize,
101
- self._trace_ready, self.prof_interface.init,
101
+ self._trace_ready, self.prof_interface.clear, self.prof_interface.init,
102
102
  self.prof_interface.start]
103
103
  else:
104
104
  while start_state != end_state:
@@ -20,7 +20,9 @@ from mindspore.common.api import _pynative_executor
20
20
  from mindspore.profiler.common.registry import PROFILERS
21
21
  from mindspore.profiler.platform.base_profiler import BaseProfiler
22
22
  from mindspore.profiler.common.profiler_context import ProfilerContext
23
+ from mindspore.profiler.common.log import ProfilerLogger
23
24
  from mindspore.profiler.common.profiler_path_manager import ProfilerPathManager
25
+ from mindspore.profiler.common.profiler_meta_data import ProfilerMetaData
24
26
 
25
27
 
26
28
  class ProfilerInterface:
@@ -92,6 +94,7 @@ class ProfilerInterface:
92
94
  logger.warning("ProfilerInterface finalize failed, profiler has not been initialized.")
93
95
  return
94
96
 
97
+ ProfilerMetaData.dump_metadata()
95
98
  for profiler in cls.platform_profilers_set:
96
99
  profiler.finalize()
97
100
  profiler = None
@@ -106,6 +109,7 @@ class ProfilerInterface:
106
109
  return
107
110
  cls.platform_profilers_set.clear()
108
111
  cls.is_initialized = False
112
+ ProfilerLogger.destroy()
109
113
  logger.info("ProfilerInterface clear")
110
114
 
111
115
  @classmethod
@@ -74,10 +74,19 @@ class Schedule:
74
74
 
75
75
  Keyword Args:
76
76
  wait (int): The number of steps to wait before starting the warm-up phase.
77
+ must be greater than or equal to 0. If the wait parameter is not set externally,
78
+ it is set to ``0`` when the schedule class is initialized.
77
79
  active (int): The number of steps to record data during the active phase.
78
- warmup (int, optional): The number of steps to perform the warm-up phase. Default: ``0``.
79
- repeat (int, optional): The number of times to repeat the cycle. Default: ``0``.
80
- skip_first (int, optional): The number of steps to skip at the beginning. Default: ``0``.
80
+ must be greater than or equal to 1. If the active parameter is not set externally,
81
+ it is set to ``1`` when the schedule class is initialized.
82
+ warmup (int, optional): The number of steps to perform the warm-up phase.
83
+ must be greater than or equal to 0. Default value: ``0``.
84
+ repeat (int, optional): The number of times to repeat the cycle.
85
+ If repeat is set to 0, the Profiler will determine the repeat value based on the number of times the model
86
+ is trained, which will generate one more performance data with incomplete collection. The data in the last
87
+ step is abnormal data that users do not need to pay attention to. Default value: ``0``.
88
+ skip_first (int, optional): The number of steps to skip at the beginning. Must be greater than or equal to 0.
89
+ Default value: ``0``
81
90
 
82
91
  Raises:
83
92
  ValueError: When the parameter step is less than 0.
@@ -87,10 +96,10 @@ class Schedule:
87
96
 
88
97
  Examples:
89
98
  >>> import numpy as np
90
- >>> import mindspore as ms
99
+ >>> import mindspore
91
100
  >>> import mindspore.dataset as ds
92
- >>> from mindspore import context, nn, Profiler
93
- >>> from mindspore.profiler import schedule, tensor_board_trace_handler
101
+ >>> from mindspore import context, nn
102
+ >>> from mindspore.profiler import ProfilerLevel, AicoreMetrics, ExportType, ProfilerActivity
94
103
  >>>
95
104
  >>> class Net(nn.Cell):
96
105
  ... def __init__(self):
@@ -108,18 +117,34 @@ class Schedule:
108
117
  ... optimizer = nn.Momentum(test_net.trainable_params(), 1, 0.9)
109
118
  ... loss = nn.SoftmaxCrossEntropyWithLogits(sparse=True)
110
119
  ... data = ds.GeneratorDataset(generator_net(), ["data", "label"])
111
- ... model = ms.train.Model(test_net, loss, optimizer)
120
+ ... model = mindspore.train.Model(test_net, loss, optimizer)
112
121
  ... model.train(1, data)
113
122
  >>>
114
123
  >>> if __name__ == '__main__':
115
- ... context.set_context(mode=ms.PYNATIVE_MODE, device_target="Ascend")
124
+ ... # If the device_target is GPU, set the device_target to "GPU"
125
+ ... context.set_context(mode=mindspore.GRAPH_MODE)
126
+ ... mindspore.set_device("Ascend")
116
127
  ...
128
+ ... # Init Profiler
129
+ ... experimental_config = mindspore.profiler._ExperimentalConfig(
130
+ ... profiler_level=ProfilerLevel.Level0,
131
+ ... aic_metrics=AicoreMetrics.AiCoreNone,
132
+ ... l2_cache=False,
133
+ ... mstx=False,
134
+ ... data_simplification=False,
135
+ ... export_type=[ExportType.Text])
136
+ ... steps = 10
117
137
  ... net = Net()
118
- ... STEP_NUM = 15
138
+ ... # Note that the Profiler should be initialized before model.train
139
+ ... with mindspore.profiler.profile(activities=[ProfilerActivity.CPU, ProfilerActivity.NPU],
140
+ ... schedule=mindspore.profiler.schedule(wait=1, warmup=1, active=2,
141
+ ... repeat=1, skip_first=2),
142
+ ... on_trace_ready=mindspore.profiler.tensorboard_trace_handler("./data"),
143
+ ... profile_memory=False,
144
+ ... experimental_config=experimental_config) as prof:
119
145
  ...
120
- ... with Profiler(schedule=schedule(wait=1, warmup=1, active=2, repeat=1, skip_first=2),
121
- ... on_trace_ready=tensor_board_trace_handler) as prof:
122
- ... for i in range(STEP_NUM):
146
+ ... # Train Model
147
+ ... for step in range(steps):
123
148
  ... train(net)
124
149
  ... prof.step()
125
150
  """
@@ -160,25 +185,35 @@ class Schedule:
160
185
  return ProfilerAction.WARM_UP
161
186
  return ProfilerAction.RECORD if mod_step < num_steps - 1 else ProfilerAction.RECORD_AND_SAVE
162
187
 
188
+ def __repr__(self):
189
+ return (f"Schedule(wait={self.wait!r}, active={self.active!r}, "
190
+ f"warmup={self.warmup!r}, repeat={self.repeat!r}, "
191
+ f"skip_first={self.skip_first!r})")
192
+
163
193
  def _check_params(self):
164
194
  """
165
195
  Verify all parameters in the schedule,
166
196
  and set them to default values if the parameters are not compliant.
167
197
  """
168
- if not isinstance(self.wait, int) or self.wait < 0:
169
- logger.warning("Invalid parameter wait, reset it to 0.")
198
+ if not isinstance(self.wait, int) or isinstance(self.wait, bool) or self.wait < 0:
199
+ logger.warning(f"Parameter 'wait' should be of type int, but got "
200
+ f"{type(self.wait).__name__}. reset to int 0.")
170
201
  self.wait = 0
171
- if not isinstance(self.warmup, int) or self.warmup < 0:
172
- logger.warning("Invalid parameter warmup, reset it to 0.")
202
+ if not isinstance(self.warmup, int) or isinstance(self.warmup, bool) or self.warmup < 0:
203
+ logger.warning(f"Parameter 'warmup' should be of type int, but got "
204
+ f"{type(self.warmup).__name__}. reset to int 0.")
173
205
  self.warmup = 0
174
- if not isinstance(self.active, int) or self.active <= 0:
175
- logger.warning("Invalid parameter active, reset it to 1.")
206
+ if not isinstance(self.active, int) or isinstance(self.active, bool) or self.active <= 0:
207
+ logger.warning(f"Parameter 'active' should be of type int, but got "
208
+ f"{type(self.active).__name__}. reset to int 1.")
176
209
  self.active = 1
177
- if not isinstance(self.repeat, int) or self.repeat < 0:
178
- logger.warning("Invalid parameter repeat, reset it to 0.")
210
+ if not isinstance(self.repeat, int) or isinstance(self.repeat, bool) or self.repeat < 0:
211
+ logger.warning(f"Parameter 'repeat' should be of type int, but got "
212
+ f"{type(self.repeat).__name__}. reset to int 0.")
179
213
  self.repeat = 0
180
- if not isinstance(self.skip_first, int) or self.skip_first < 0:
181
- logger.warning("Invalid parameter skip_first, reset it to 0.")
214
+ if not isinstance(self.skip_first, int) or isinstance(self.skip_first, bool) or self.skip_first < 0:
215
+ logger.warning(f"Parameter 'skip_first' should be of type int, but got "
216
+ f"{type(self.skip_first).__name__}. reset to int 0.")
182
217
  self.skip_first = 0
183
218
  if self.warmup == 0:
184
219
  logger.warning("Profiler won't be using warmup, this can skew profiler results")
@@ -28,9 +28,11 @@ from .scoped_value import ScopedValue
28
28
 
29
29
  class Node:
30
30
  """
31
- A node is a data structure that expresses source code statements in a network.
32
-
33
- Each node usually corresponds to a statement in expanded forward evaluation process.
31
+ A node (Node) can be understood as a basic data structure unit in the computational graph of a neural network,
32
+ which represents an operation or computational step in the network.
33
+ Each node usually corresponds to a statement or expression in the source code,
34
+ which contains the information needed to perform the operation,
35
+ such as the type of operation, input data, output result, and connection relationships with other nodes.
34
36
 
35
37
  Nodes can express a ``Cell`` call statement, a ``Primitive`` call statement, an arithmetic operation statement, a
36
38
  return statements, etc. of the forward calculation process.
@@ -66,9 +68,9 @@ class Node:
66
68
  source code.
67
69
  args (List[ScopedValue]): Indicate input names. Used as args of a call expression of an assign statement in
68
70
  source code. Default: ``None`` , which indicates the `cell` has no args inputs.
69
- kwargs (Dict[str, ScopedValue]): Type of key must be `str` and type of value must be `ScopedValue`.
70
- Indicate keyword input names. Used as kwargs of a call expression of an assign statement in source
71
- code. Default: ``None`` , which indicates the `cell` has no kwargs inputs.
71
+ kwargs (Dict[str, ScopedValue]): Used as kwargs of a call expression of an assign statement in source
72
+ code. Indicate keyword input names. Type of key must be `str` and type of value must be `ScopedValue`.
73
+ Default: ``None`` , which indicates the `cell` has no kwargs inputs.
72
74
  name (str): Indicate the name of node. Used as field name in source code. Default is None. Rewrite will
73
75
  generate name from `cell` when name is None. Rewrite will check and ensure the uniqueness of `name`
74
76
  while node being inserted. Default: ``""`` .
@@ -83,7 +85,7 @@ class Node:
83
85
  TypeError: If `targets` is not `list`.
84
86
  TypeError: If the type of `targets` is not in `[ScopedValue, str]`.
85
87
  TypeError: If arg in `args` is not a `ScopedValue`.
86
- TypeError: If key of `kwarg` is not a str or value of kwarg in `kwargs` is not a `ScopedValue`.
88
+ TypeError: If key of `kwargs` is not a str or value of kwarg in `kwargs` is not a `ScopedValue`.
87
89
 
88
90
  Examples:
89
91
  >>> from mindspore.rewrite import SymbolTree, ScopedValue
@@ -125,9 +127,9 @@ class Node:
125
127
  source code.
126
128
  args (List[ScopedValue]): Indicate input names. Used as args of a call expression of an assign statement in
127
129
  source code. Default: ``None`` , which indicates the `function` has no args inputs.
128
- kwargs (Dict[str, ScopedValue]): Type of key must be `str` and type of value must be `ScopedValue`.
129
- Indicate keyword input names. Used as kwargs of a call expression of an assign statement in source
130
- code. Default: ``None`` , which indicates the `function` has no kwargs inputs.
130
+ kwargs (Dict[str, ScopedValue]): Used as kwargs of a call expression of an assign statement in source
131
+ code. Indicate keyword input names. Type of key must be `str` and type of value must be `ScopedValue`.
132
+ Default: ``None`` , which indicates the `function` has no kwargs inputs.
131
133
 
132
134
  Returns:
133
135
  An instance of `Node`.
@@ -137,7 +139,7 @@ class Node:
137
139
  TypeError: If `targets` is not `list`.
138
140
  TypeError: If the type of `targets` is not in `[ScopedValue, str]`.
139
141
  TypeError: If arg in `args` is not a `ScopedValue`.
140
- TypeError: If key of `kwarg` is not a str or value of kwarg in `kwargs` is not a `ScopedValue`.
142
+ TypeError: If key of `kwargs` is not a str or value of kwarg in `kwargs` is not a `ScopedValue`.
141
143
 
142
144
  Examples:
143
145
  >>> from mindspore.rewrite import SymbolTree, ScopedValue
@@ -476,14 +478,14 @@ class Node:
476
478
  ... self.relu = nn.ReLU()
477
479
  ...
478
480
  ... def construct(self, input):
479
- ... output = self.relu(x=input)
481
+ ... output = self.relu(input=input)
480
482
  ... return output
481
483
  >>>
482
484
  >>> net = ReLUNet()
483
485
  >>> stree = SymbolTree.create(net)
484
486
  >>> node = stree.get_node("relu")
485
487
  >>> print(node.get_kwargs())
486
- {'x': input}
488
+ {'input': input}
487
489
  """
488
490
  return self._node.get_kwargs()
489
491
 
@@ -74,7 +74,7 @@ class SymbolTree:
74
74
 
75
75
  - :class:`mindspore.nn.SequentialCell`
76
76
  - Functions(Excludes Python built-in functions and third-party library functions)
77
- - Control flow statements, such as `if` statements
77
+ - Control flow statements(such as `if` statements)
78
78
 
79
79
  Note:
80
80
  Because the specific execution branch of control flows are still unknown during the rewrite operation
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2022 Huawei Technologies Co., Ltd
1
+ # Copyright 2020-2025 Huawei Technologies Co., Ltd
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@ from packaging import version
26
26
  import numpy as np
27
27
  from mindspore import log as logger
28
28
  from mindspore.log import vlog_print
29
- from mindspore._c_expression import MSContext, ms_ctx_param
30
29
  from ..version import __version__
31
30
 
32
31
 
@@ -259,7 +258,7 @@ class AscendEnvChecker(EnvChecker):
259
258
 
260
259
  def __init__(self, library_path):
261
260
  self.library_path = library_path
262
- self.version = ["7.5", "7.6"]
261
+ self.version = ["7.6", "7.7"]
263
262
 
264
263
  # env
265
264
  self.path = os.getenv("PATH")
@@ -276,6 +275,7 @@ class AscendEnvChecker(EnvChecker):
276
275
  self.python_path_check = "opp/built-in/op_impl/ai_core/tbe"
277
276
  self.ld_lib_path_check_fwk = "/lib64"
278
277
  self.ascend_opp_path_check = "/op"
278
+ self.ascend_opp_kernel_path_check = "/opp_kernel"
279
279
  self.v = ""
280
280
 
281
281
  @staticmethod
@@ -342,27 +342,35 @@ class AscendEnvChecker(EnvChecker):
342
342
  logger.warning(f"MindSpore version {mindspore_version} and \"te\" wheel package version {v} does not "
343
343
  "match. For details, refer to the installation guidelines: "
344
344
  "https://www.mindspore.cn/install")
345
- from hccl import sys_version as hccl_version
346
- v = '.'.join(hccl_version.__sys_version__.split('.')[0:2])
347
- if v not in supported_version:
348
- attention_warning = True
349
- logger.warning(f"MindSpore version {mindspore_version} and \"hccl\" wheel package version {v} does not "
350
- "match. For details, refer to the installation guidelines: "
351
- "https://www.mindspore.cn/install")
352
345
  # DO NOT modify exception type to any other, you DO NOT know what kind of exceptions the te will throw.
353
346
  # pylint: disable=broad-except
354
347
  except Exception as e:
355
348
  logger.error(f"CheckFailed: {e}")
356
- logger.error("MindSpore relies on whl packages of \"te\" and \"hccl\" in the \"latest\" "
357
- "folder of the Ascend AI software package (Ascend Data Center Solution). Please check whether"
358
- " they are installed correctly or not, refer to the match info on: "
359
- "https://www.mindspore.cn/install")
349
+ logger.critical("MindSpore relies on whl packages of \"te\" in the \"latest\" folder of the "
350
+ "Ascend AI software package (Ascend Data Center Solution). Please check whether they are "
351
+ "installed correctly or not, refer to the match info on: https://www.mindspore.cn/install")
360
352
  if attention_warning:
361
353
  warning_countdown = 3
362
354
  for i in range(warning_countdown, 0, -1):
363
355
  logger.warning(f"Please pay attention to the above warning, countdown: {i}")
364
356
  time.sleep(1)
365
357
 
358
+ def check_opp_kernel(self):
359
+ """
360
+ opp kernel install check
361
+ """
362
+ from mindspore._c_expression import MSContext
363
+ soc_version = MSContext.get_instance().get_ascend_soc_version()
364
+ if soc_version == "ascend310":
365
+ return
366
+
367
+ opp_kernel_path = self.ascend_opp_path.replace("opp", "opp_kernel")
368
+ if not os.path.exists(opp_kernel_path):
369
+ logger.critical("MindSpore relies on \"Ascend opp_kernel\" folder of the Ascend AI software package ("
370
+ "Ascend Data Center Solution). Please check whether they are installed correctly or not, "
371
+ "refer to the match info on: https://www.mindspore.cn/install")
372
+ raise Exception("Ascend opp_kernel is not installed")
373
+
366
374
  def set_env(self):
367
375
  curr_path = os.path.realpath(os.path.dirname(__file__))
368
376
  cust_aicpu_path = os.path.realpath(os.path.join(curr_path, "../lib/plugin/ascend/custom_aicpu_ops"))
@@ -391,6 +399,8 @@ class AscendEnvChecker(EnvChecker):
391
399
  # check te version after set te env
392
400
  self.check_deps_version()
393
401
 
402
+ self.check_opp_kernel()
403
+
394
404
  def _check_env(self):
395
405
  """ascend dependence path check"""
396
406
  if self.path is None or self.path_check not in self.path:
@@ -467,6 +477,7 @@ def check_version_and_env_config():
467
477
  logger.warning("Pre-Load Library libgomp.so.1 failed, which might cause TLS memory allocation failure. If "
468
478
  "the failure occurs, please refer to the FAQ for a solution: "
469
479
  "https://www.mindspore.cn/docs/en/master/faq/installation.html.")
480
+ from mindspore._c_expression import MSContext, ms_ctx_param
470
481
  MSContext.get_instance().register_check_env_callback(check_env)
471
482
  MSContext.get_instance().register_set_env_callback(set_env)
472
483
  MSContext.get_instance().set_device_target_inner(MSContext.get_instance().get_param(ms_ctx_param.device_target))
@@ -47,7 +47,7 @@ def _check_mul():
47
47
  def run_check():
48
48
  """
49
49
  Provide a convenient API to check if the installation is successful or failed.
50
- If the version in the check result is not what you expect, use :func:`mindspore.set_context` to set device_target
50
+ If the version in the check result is not as expected, use :func:`mindspore.set_context` to set device_target
51
51
  before run_check().
52
52
 
53
53
  Examples:
@@ -17,7 +17,7 @@
17
17
  The runtime interface.
18
18
  """
19
19
 
20
- from mindspore.runtime.executor import launch_blocking, dispatch_threads_num, set_cpu_affinity
20
+ from mindspore.runtime.executor import launch_blocking, dispatch_threads_num, set_cpu_affinity, set_kernel_launch_group
21
21
  from mindspore.runtime.memory import set_memory, memory_stats, memory_reserved, max_memory_reserved, empty_cache,\
22
22
  reset_peak_memory_stats, memory_summary, memory_allocated,\
23
23
  max_memory_allocated, reset_max_memory_reserved, reset_max_memory_allocated
@@ -27,7 +27,7 @@ from mindspore.runtime.event import Event
27
27
  from .executor import launch_blocking
28
28
 
29
29
  __all__ = [
30
- "launch_blocking", "dispatch_threads_num", "set_cpu_affinity",
30
+ "launch_blocking", "dispatch_threads_num", "set_cpu_affinity", "set_kernel_launch_group",
31
31
  "Stream", "communication_stream", "synchronize", "set_cur_stream", "current_stream", "default_stream", "StreamCtx",
32
32
  "set_memory", "memory_stats", "memory_reserved", "max_memory_reserved", "empty_cache", "reset_peak_memory_stats",
33
33
  "memory_summary", "memory_allocated", "max_memory_allocated", "reset_max_memory_reserved",
@@ -24,18 +24,14 @@ from mindspore import log as logger
24
24
 
25
25
  def launch_blocking():
26
26
  """
27
- Whether to enable synchronous execution.
28
- Default: ``False`` . When the value is set to ``False`` , the operator is executed asynchronously on the
29
- device. When an error occurs in the execution of the operator, the specific error script code location
30
- cannot be located. When this API is called , the value will be changed to true, the operator is executed
31
- synchronously on the device. It will reduce the execution performance of the program. At this time, when
32
- an error occurs in the execution of the operator, the location of the error script code can be located
33
- according to the call stack of the error.
27
+ Indicates that synchronizing the execution of the startup device reduces the execution performance of the program.
34
28
 
35
- Note:
36
- - No parameters are required.
37
- - By default, operations are executed asynchronously.
38
- - Calling this function enables synchronous execution.
29
+ - In the initial state when this interface is not called, the operator executes asynchronously on the device.
30
+ In this case, when an error occurs in the execution of the operator,
31
+ it will not be possible to locate the position of the particular error script code.
32
+ - When this interface is called, the operator is executed in a synchronized manner on the device.
33
+ At this point, when an error occurs in the execution of the operator,
34
+ the location of the erroneous script code can be located based on the error call stack.
39
35
 
40
36
  Examples:
41
37
  >>> import mindspore as ms
@@ -146,3 +142,36 @@ def set_cpu_affinity(enable_affinity, affinity_cpu_list=None):
146
142
  else:
147
143
  RuntimeConf.get_instance().set_thread_bind_core_configured()
148
144
  return
145
+
146
+
147
+ @args_type_check(thread_num=int, kernel_group_num=int)
148
+ def set_kernel_launch_group(thread_num=2, kernel_group_num=8):
149
+ """
150
+ O0 mode supports operator batch parallel delivery interface, supports enabling
151
+ parallel delivery, and configures parallel number.
152
+
153
+ Args:
154
+ thread_num (int, optional): The number of concurrent threads, generally not recommended
155
+ to increase. The `thread_num` and the number of threads configured by the existing interface
156
+ mindspore.runtime.dispatch_threads_num are independent of each other. Default value is ``2``.
157
+ kernel_group_num (int, optional): Total number of operator groups,
158
+ kernel_group_num/thread_num groups per thread. Default value is ``8``.
159
+
160
+ Examples:
161
+ >>> import mindspore as ms
162
+ >>> ms.runtime.set_kernel_launch_group(thread_num=2, kernel_group_num=8)
163
+ """
164
+ if RuntimeConf.get_instance().is_kernel_launch_group_configured():
165
+ raise RuntimeError("The 'kernel_launch_group' can not be set repeatedly.")
166
+
167
+ if thread_num < 1:
168
+ raise ValueError(f"The value of thread_num should be at least 1, but got {thread_num}")
169
+
170
+ if kernel_group_num < 1:
171
+ raise ValueError(f"The value of kernel_group_num should be at least 1, but got {kernel_group_num}")
172
+
173
+ if (kernel_group_num % thread_num) != 0:
174
+ raise ValueError(f"Invalid parameter value, kernel_group_num: {kernel_group_num} cannot "
175
+ f"be evenly divisible by thread_num: {thread_num}")
176
+
177
+ return RuntimeConf.get_instance().set_kernel_launch_group(thread_num, kernel_group_num)
@@ -16,18 +16,26 @@
16
16
  """Memory interfaces."""
17
17
 
18
18
  from mindspore._c_expression import RuntimeConf, DeviceManagerConf, _memory_stats, \
19
- _reset_max_mem_reserved, _reset_max_mem_allocated, DeviceContextManager
19
+ _reset_max_mem_reserved, _reset_max_mem_allocated, DeviceContextManager, _empty_cache
20
20
  from mindspore import _checkparam as Validator
21
21
  from mindspore._checkparam import args_type_check
22
22
  from mindspore import log as logger
23
23
  import mindspore as ms
24
24
 
25
25
  _MEMORY_PATTERN = r'[1-9][0-9]*(\.)?[0-9]*GB|0\.[0-9]*GB'
26
+ _RESERVE_PATTERN = r'[0-9][0-9]*(\.)?[0-9]*GB|0\.[0-9]*GB'
26
27
  _device_context_mgr = DeviceContextManager.get_instance()
27
28
 
28
29
 
29
- @args_type_check(init_size=str, increase_size=str, max_size=str, optimize_level=str)
30
- def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize_level="O0"):
30
+ @args_type_check(
31
+ init_size=str,
32
+ increase_size=str,
33
+ max_size=str,
34
+ optimize_level=str,
35
+ huge_page_reserve_size=str,
36
+ )
37
+ def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize_level="O0",
38
+ huge_page_reserve_size="0GB"):
31
39
  """
32
40
  Set the memory parameters of runtime device memory management that is implemented using a memory pool.
33
41
 
@@ -41,6 +49,7 @@ def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize
41
49
  The actual used memory size is the minimum of the available memory of the device and max_device_memory.
42
50
  The format is "xxGB". Default is the maximum available memory of the device, expressed as ``1024GB``.
43
51
  optimize_level (str): The memory optimize level. The value must be in ['O0', 'O1']. Default: ``O0`` .
52
+ huge_page_reserve_size (str): The reserved size of huge page memory. The format is "xxGB". Default: ``0GB``.
44
53
 
45
54
  Supported Platforms:
46
55
  ``Ascend`` ``GPU`` ``CPU``
@@ -48,7 +57,7 @@ def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize
48
57
  Examples:
49
58
  >>> import mindspore as ms
50
59
  >>> ms.set_device("Ascend", 1)
51
- >>> ms.runtime.set_memory("10GB", "2GB", "60GB", "O1")
60
+ >>> ms.runtime.set_memory("10GB", "2GB", "60GB", "O1", "0GB")
52
61
  """
53
62
  if RuntimeConf.get_instance().is_memory_configured():
54
63
  raise RuntimeError("The 'set_memory' can not be set repeatedly.")
@@ -56,9 +65,11 @@ def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize
56
65
  _check_memory_conf_valid(init_size)
57
66
  _check_memory_conf_valid(increase_size)
58
67
  _check_memory_conf_valid(max_size)
68
+ Validator.check_str_by_regular(huge_page_reserve_size, _RESERVE_PATTERN)
59
69
  init_value = float(init_size[:-2])
60
70
  increase_value = float(increase_size[:-2])
61
71
  max_value = float(max_size[:-2])
72
+ huge_page_reserve_value = float(huge_page_reserve_size[:-2])
62
73
 
63
74
  memory_optimize_levels = ["O0", "O1"]
64
75
  if optimize_level not in memory_optimize_levels:
@@ -68,19 +79,25 @@ def set_memory(init_size="2GB", increase_size="2GB", max_size="1024GB", optimize
68
79
  if optimize_level == "O1":
69
80
  optimize_value = 1
70
81
 
71
- return RuntimeConf.get_instance().set_memory(init_value, increase_value, max_value, optimize_value)
82
+ return RuntimeConf.get_instance().set_memory(
83
+ init_value,
84
+ increase_value,
85
+ max_value,
86
+ optimize_value,
87
+ huge_page_reserve_value,
88
+ )
72
89
 
73
90
 
74
91
  def _check_memory_conf_valid(memory_size):
75
92
  """
76
- Check whether the configuration memory value format is "xxGB" and can not be "0G".
93
+ Check whether the configuration memory value format is "xxGB" and can not be "0GB".
77
94
  """
78
95
  if not Validator.check_str_by_regular(memory_size, _MEMORY_PATTERN):
79
96
  raise ValueError("The memory value should be in correct format!"
80
97
  "It must be a string ending with 'GB', in addition to that, it must contain "
81
98
  "only numbers or decimal points, such as \"5GB\" or \"3.5GB\", but got {}."
82
99
  .format(memory_size))
83
- if memory_size == "0G" or memory_size == "0.0G":
100
+ if memory_size == "0GB" or memory_size == "0.0GB":
84
101
  raise ValueError("The memory value should not be \"0GB\".")
85
102
 
86
103
  def _is_initialized(device_target):
@@ -97,7 +114,7 @@ def memory_stats():
97
114
  Returns status information queried from the memory pool.
98
115
 
99
116
  Note:
100
- - For the `CPU` backend, a dictionary with empty data is always returned.
117
+ For the `CPU` backend, a dictionary with empty data is always returned.
101
118
 
102
119
  Returns:
103
120
  dict, the queried memory information.
@@ -191,14 +208,21 @@ def max_memory_reserved():
191
208
 
192
209
  def empty_cache():
193
210
  """
194
- Release all memory fragments in the memory pool, so that memory arrangement
195
- will be optimized.
211
+ Empty cache in the memory pool.
196
212
 
197
213
  Note:
198
- Currently, the MindSpore memory pool does not have the function of releasing memory fragments.
199
- This interface is reserved but implemented as an empty method and prompted in log mode.
214
+ - Empty cache help reduce the fragmentation of device memory.
215
+ - Support Atlas A2 series products.
216
+
217
+ Supported Platforms:
218
+ ``Ascend``
200
219
  """
201
- logger.warning(f"The empty_cache operation is currently not supported.")
220
+ device_target = ms.context.get_context("device_target")
221
+ if not _is_initialized(device_target):
222
+ logger.warning(f"Backend {device_target} is not initialized yet.")
223
+ return
224
+ release_size = _empty_cache(device_target)
225
+ logger.info(f"The empty_cache operation is executed successfully, release size: {release_size}.")
202
226
 
203
227
 
204
228
  def reset_peak_memory_stats():
@@ -129,7 +129,7 @@ def obfuscate_ckpt(network, ckpt_files, target_modules=None, obf_config=None, sa
129
129
  Args:
130
130
  network (nn.Cell): The original network that need to be obfuscated.
131
131
  ckpt_files (str): The directory path of original ckpt files.
132
- target_modules (list[str]): The target ops that need to be obfuscated in the network. The first string
132
+ target_modules (list[str], optional): The target ops that need to be obfuscated in the network. The first string
133
133
  represents the network path of the target ops in the original network, which should be in form of
134
134
  ``"A/B/C"``. The second string represents the names of multiple target ops in the same path, which
135
135
  should be in form of ``"D|E|F"``. For example, the target_modules of GPT2 can be ``['backbone/blocks
@@ -137,10 +137,11 @@ def obfuscate_ckpt(network, ckpt_files, target_modules=None, obf_config=None, sa
137
137
  format of 'obfuscate_layers:all' or 'obfuscate_layers:int', which represents the number of layers
138
138
  need to be obfuscated of duplicate layers (such as transformer layers or resnet blocks).
139
139
  Default: ``None``.
140
- obf_config (dict): The configuration of model obfuscation polices. Default: ``None``.
141
- saved_path (str): The directory path for saving obfuscated ckpt files. Default: ``'./'``.
142
- obfuscate_scale (Union[float, int]): Obfuscate scale of weights. The generated random obf_ratios will be in
143
- range of (1 / obfuscate_scale, obfuscate_scale). Default: 100.
140
+ obf_config (dict, optional): The configuration of model obfuscation polices. Default: ``None``.
141
+ saved_path (str, optional): The directory path for saving obfuscated ckpt files. Default: ``'./'``.
142
+ obfuscate_scale (Union[float, int], optional): Obfuscate scale of weights.
143
+ The generated random obf_ratios will be in
144
+ range of (1 / obfuscate_scale, obfuscate_scale). Default: ``100``.
144
145
 
145
146
  Returns:
146
147
  dict[str], obf_metadata, which is the necessary data that needs to be load when running obfuscated network.
@@ -371,7 +372,8 @@ def load_obf_params_into_net(network, target_modules=None, obf_ratios=None, obf_
371
372
 
372
373
  Args:
373
374
  network (nn.Cell): The original network that need to be obfuscated.
374
- target_modules (list[str]): The target ops that need to be obfuscated in the network. The first string
375
+ target_modules (list[str], optional): The target ops that need to be obfuscated in the network.
376
+ The first string
375
377
  represents the network path of the target ops in the original network, which should be in form of
376
378
  ``"A/B/C"``. The second string represents the names of multiple target ops in the same path, which
377
379
  should be in form of ``"D|E|F"``. For example, thr target_modules of GPT2 can be ``['backbone
@@ -379,9 +381,10 @@ def load_obf_params_into_net(network, target_modules=None, obf_ratios=None, obf_
379
381
  in the format of 'obfuscate_layers:all' or 'obfuscate_layers:int', which represents the number of
380
382
  layers need to be obfuscated of duplicate layers (such as transformer layers or resnet blocks).
381
383
  Default: ``None``.
382
- obf_ratios (Tensor): The obf ratios generated when execute :func:`mindspore.obfuscate_ckpt`. Default: ``None``.
383
- obf_config (dict): The configuration of model obfuscation polices. Default: ``None``.
384
- data_parallel_num (int): The data parallel number of parallel training. Default: 1.
384
+ obf_ratios (Tensor, optional): The obf ratios generated when execute :func:`mindspore.obfuscate_ckpt`.
385
+ Default: ``None``.
386
+ obf_config (dict, optional): The configuration of model obfuscation polices. Default: ``None``.
387
+ data_parallel_num (int, optional): The data parallel number of parallel training. Default: ``1``.
385
388
  kwargs (dict): Configuration options dictionary.
386
389
 
387
390
  - ignored_func_decorators (list[str]): The name list of function decorators in network's python code.
Binary file
mindspore/swscale-6.dll CHANGED
Binary file
mindspore/tbbmalloc.dll CHANGED
Binary file
mindspore/tinyxml2.dll CHANGED
Binary file