mindspore 2.7.0rc1__cp311-cp311-win_amd64.whl → 2.7.1__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 (370) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +5 -2
  3. mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
  6. mindspore/_checkparam.py +2 -2
  7. mindspore/_extends/builtin_operations.py +3 -3
  8. mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
  9. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  10. mindspore/_extends/parse/__init__.py +3 -3
  11. mindspore/_extends/parse/compile_config.py +24 -1
  12. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +6 -3
  13. mindspore/_extends/parse/parser.py +28 -22
  14. mindspore/_extends/parse/resources.py +1 -1
  15. mindspore/_extends/parse/standard_method.py +23 -2
  16. mindspore/_extends/parse/trope.py +2 -1
  17. mindspore/_extends/pijit/pijit_func_white_list.py +9 -27
  18. mindspore/amp.py +0 -18
  19. mindspore/avcodec-59.dll +0 -0
  20. mindspore/avdevice-59.dll +0 -0
  21. mindspore/avfilter-8.dll +0 -0
  22. mindspore/avformat-59.dll +0 -0
  23. mindspore/avutil-57.dll +0 -0
  24. mindspore/boost/base.py +29 -2
  25. mindspore/common/__init__.py +18 -12
  26. mindspore/common/_decorator.py +3 -2
  27. mindspore/common/_grad_function.py +3 -1
  28. mindspore/common/_tensor_cpp_method.py +1 -1
  29. mindspore/common/_tensor_docs.py +371 -96
  30. mindspore/common/_utils.py +7 -43
  31. mindspore/common/api.py +434 -135
  32. mindspore/common/dtype.py +98 -57
  33. mindspore/common/dump.py +7 -108
  34. mindspore/common/dynamic_shape/__init__.py +0 -0
  35. mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +15 -23
  36. mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
  37. mindspore/common/file_system.py +59 -9
  38. mindspore/common/hook_handle.py +82 -3
  39. mindspore/common/jit_config.py +5 -1
  40. mindspore/common/jit_trace.py +27 -12
  41. mindspore/common/lazy_inline.py +5 -3
  42. mindspore/common/np_dtype.py +3 -3
  43. mindspore/common/parameter.py +17 -127
  44. mindspore/common/recompute.py +4 -13
  45. mindspore/common/tensor.py +50 -217
  46. mindspore/communication/_comm_helper.py +11 -1
  47. mindspore/communication/comm_func.py +138 -4
  48. mindspore/communication/management.py +85 -1
  49. mindspore/config/op_info.config +0 -15
  50. mindspore/context.py +20 -106
  51. mindspore/dataset/__init__.py +1 -1
  52. mindspore/dataset/audio/transforms.py +1 -1
  53. mindspore/dataset/core/config.py +35 -1
  54. mindspore/dataset/engine/datasets.py +338 -319
  55. mindspore/dataset/engine/datasets_user_defined.py +38 -22
  56. mindspore/dataset/engine/datasets_vision.py +1 -1
  57. mindspore/dataset/engine/validators.py +1 -15
  58. mindspore/dataset/transforms/c_transforms.py +2 -2
  59. mindspore/dataset/transforms/transforms.py +3 -3
  60. mindspore/dataset/vision/__init__.py +1 -1
  61. mindspore/dataset/vision/py_transforms.py +8 -8
  62. mindspore/dataset/vision/transforms.py +17 -5
  63. mindspore/dataset/vision/utils.py +632 -21
  64. mindspore/device_context/ascend/op_tuning.py +35 -1
  65. mindspore/dnnl.dll +0 -0
  66. mindspore/{profiler/common/validator → graph}/__init__.py +9 -1
  67. mindspore/graph/custom_pass.py +55 -0
  68. mindspore/include/api/cell.h +28 -4
  69. mindspore/include/api/cfg.h +24 -7
  70. mindspore/include/api/context.h +1 -0
  71. mindspore/include/api/delegate.h +0 -2
  72. mindspore/include/api/dual_abi_helper.h +100 -19
  73. mindspore/include/api/graph.h +14 -1
  74. mindspore/include/api/kernel.h +16 -3
  75. mindspore/include/api/kernel_api.h +9 -1
  76. mindspore/include/api/metrics/accuracy.h +9 -0
  77. mindspore/include/api/model.h +5 -1
  78. mindspore/include/api/model_group.h +4 -0
  79. mindspore/include/api/model_parallel_runner.h +2 -0
  80. mindspore/include/api/status.h +48 -10
  81. mindspore/include/api/types.h +6 -1
  82. mindspore/include/dataset/constants.h +9 -0
  83. mindspore/include/dataset/execute.h +2 -2
  84. mindspore/jpeg62.dll +0 -0
  85. mindspore/mindrecord/__init__.py +3 -3
  86. mindspore/mindrecord/common/exceptions.py +1 -0
  87. mindspore/mindrecord/config.py +1 -1
  88. mindspore/{parallel/mpi → mindrecord/core}/__init__.py +4 -1
  89. mindspore/mindrecord/{shardheader.py → core/shardheader.py} +2 -1
  90. mindspore/mindrecord/{shardindexgenerator.py → core/shardindexgenerator.py} +1 -1
  91. mindspore/mindrecord/{shardreader.py → core/shardreader.py} +2 -1
  92. mindspore/mindrecord/{shardsegment.py → core/shardsegment.py} +2 -2
  93. mindspore/mindrecord/{shardutils.py → core/shardutils.py} +1 -1
  94. mindspore/mindrecord/{shardwriter.py → core/shardwriter.py} +1 -1
  95. mindspore/mindrecord/filereader.py +4 -4
  96. mindspore/mindrecord/filewriter.py +5 -5
  97. mindspore/mindrecord/mindpage.py +2 -2
  98. mindspore/mindrecord/tools/cifar10.py +4 -3
  99. mindspore/mindrecord/tools/cifar100.py +1 -1
  100. mindspore/mindrecord/tools/cifar100_to_mr.py +1 -1
  101. mindspore/mindrecord/tools/cifar10_to_mr.py +6 -6
  102. mindspore/mindrecord/tools/csv_to_mr.py +1 -1
  103. mindspore/mindrecord/tools/imagenet_to_mr.py +1 -1
  104. mindspore/mindrecord/tools/mnist_to_mr.py +1 -1
  105. mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -1
  106. mindspore/mindspore_backend_common.dll +0 -0
  107. mindspore/mindspore_backend_manager.dll +0 -0
  108. mindspore/mindspore_cluster.dll +0 -0
  109. mindspore/mindspore_common.dll +0 -0
  110. mindspore/mindspore_core.dll +0 -0
  111. mindspore/mindspore_cpu.dll +0 -0
  112. mindspore/mindspore_dump.dll +0 -0
  113. mindspore/mindspore_frontend.dll +0 -0
  114. mindspore/mindspore_glog.dll +0 -0
  115. mindspore/mindspore_hardware_abstract.dll +0 -0
  116. mindspore/mindspore_memory_pool.dll +0 -0
  117. mindspore/mindspore_ms_backend.dll +0 -0
  118. mindspore/mindspore_ops.dll +0 -0
  119. mindspore/{mindspore_ops_host.dll → mindspore_ops_cpu.dll} +0 -0
  120. mindspore/mindspore_profiler.dll +0 -0
  121. mindspore/mindspore_pyboost.dll +0 -0
  122. mindspore/mindspore_pynative.dll +0 -0
  123. mindspore/mindspore_runtime_pipeline.dll +0 -0
  124. mindspore/mindspore_runtime_utils.dll +0 -0
  125. mindspore/mindspore_tools.dll +0 -0
  126. mindspore/mint/__init__.py +15 -10
  127. mindspore/mint/distributed/__init__.py +4 -0
  128. mindspore/mint/distributed/distributed.py +392 -69
  129. mindspore/mint/nn/__init__.py +2 -16
  130. mindspore/mint/nn/functional.py +4 -110
  131. mindspore/mint/nn/layer/__init__.py +0 -2
  132. mindspore/mint/nn/layer/_functions.py +1 -2
  133. mindspore/mint/nn/layer/activation.py +0 -6
  134. mindspore/mint/nn/layer/basic.py +0 -47
  135. mindspore/mint/nn/layer/conv.py +10 -10
  136. mindspore/mint/nn/layer/normalization.py +11 -16
  137. mindspore/mint/nn/layer/pooling.py +0 -4
  138. mindspore/nn/__init__.py +1 -3
  139. mindspore/nn/cell.py +231 -239
  140. mindspore/nn/layer/activation.py +4 -2
  141. mindspore/nn/layer/basic.py +56 -14
  142. mindspore/nn/layer/container.py +16 -0
  143. mindspore/nn/layer/embedding.py +4 -169
  144. mindspore/nn/layer/image.py +1 -1
  145. mindspore/nn/layer/normalization.py +2 -1
  146. mindspore/nn/layer/thor_layer.py +4 -85
  147. mindspore/nn/optim/ada_grad.py +0 -1
  148. mindspore/nn/optim/adafactor.py +0 -1
  149. mindspore/nn/optim/adam.py +32 -127
  150. mindspore/nn/optim/adamax.py +0 -1
  151. mindspore/nn/optim/asgd.py +0 -1
  152. mindspore/nn/optim/ftrl.py +8 -102
  153. mindspore/nn/optim/lamb.py +1 -4
  154. mindspore/nn/optim/lars.py +0 -3
  155. mindspore/nn/optim/lazyadam.py +25 -218
  156. mindspore/nn/optim/momentum.py +5 -43
  157. mindspore/nn/optim/optimizer.py +6 -55
  158. mindspore/nn/optim/proximal_ada_grad.py +0 -1
  159. mindspore/nn/optim/rmsprop.py +0 -1
  160. mindspore/nn/optim/rprop.py +0 -1
  161. mindspore/nn/optim/sgd.py +0 -1
  162. mindspore/nn/optim/tft_wrapper.py +2 -4
  163. mindspore/nn/optim/thor.py +0 -2
  164. mindspore/nn/probability/bijector/bijector.py +7 -8
  165. mindspore/nn/probability/bijector/gumbel_cdf.py +2 -2
  166. mindspore/nn/probability/bijector/power_transform.py +20 -21
  167. mindspore/nn/probability/bijector/scalar_affine.py +5 -5
  168. mindspore/nn/probability/bijector/softplus.py +13 -14
  169. mindspore/nn/probability/distribution/_utils/utils.py +2 -2
  170. mindspore/nn/wrap/cell_wrapper.py +39 -5
  171. mindspore/nn/wrap/grad_reducer.py +4 -89
  172. mindspore/numpy/array_creations.py +4 -4
  173. mindspore/numpy/fft.py +9 -9
  174. mindspore/numpy/utils_const.py +1 -1
  175. mindspore/{nn/reinforcement → onnx}/__init__.py +5 -8
  176. mindspore/onnx/onnx_export.py +137 -0
  177. mindspore/opencv_core4110.dll +0 -0
  178. mindspore/opencv_imgcodecs4110.dll +0 -0
  179. mindspore/{opencv_imgproc452.dll → opencv_imgproc4110.dll} +0 -0
  180. mindspore/ops/__init__.py +2 -0
  181. mindspore/ops/_grad_experimental/grad_comm_ops.py +38 -2
  182. mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
  183. mindspore/ops/_op_impl/aicpu/__init__.py +0 -10
  184. mindspore/ops/_op_impl/cpu/__init__.py +1 -5
  185. mindspore/ops/_op_impl/cpu/{buffer_append.py → joinedstr_op.py} +8 -8
  186. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +28 -24
  187. mindspore/ops/auto_generate/gen_extend_func.py +6 -11
  188. mindspore/ops/auto_generate/gen_ops_def.py +385 -154
  189. mindspore/ops/auto_generate/gen_ops_prim.py +5676 -5167
  190. mindspore/ops/communication.py +97 -0
  191. mindspore/ops/composite/__init__.py +5 -2
  192. mindspore/ops/composite/base.py +16 -2
  193. mindspore/ops/composite/multitype_ops/__init__.py +3 -1
  194. mindspore/ops/composite/multitype_ops/_compile_utils.py +150 -8
  195. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  196. mindspore/ops/composite/multitype_ops/add_impl.py +7 -0
  197. mindspore/ops/composite/multitype_ops/mod_impl.py +27 -0
  198. mindspore/ops/function/__init__.py +2 -0
  199. mindspore/ops/function/array_func.py +24 -18
  200. mindspore/ops/function/comm_func.py +3883 -0
  201. mindspore/ops/function/debug_func.py +7 -6
  202. mindspore/ops/function/grad/grad_func.py +4 -12
  203. mindspore/ops/function/math_func.py +89 -86
  204. mindspore/ops/function/nn_func.py +92 -313
  205. mindspore/ops/function/random_func.py +9 -18
  206. mindspore/ops/functional.py +4 -1
  207. mindspore/ops/functional_overload.py +377 -30
  208. mindspore/ops/operations/__init__.py +2 -5
  209. mindspore/ops/operations/_custom_ops_utils.py +7 -9
  210. mindspore/ops/operations/_inner_ops.py +12 -50
  211. mindspore/ops/operations/_rl_inner_ops.py +0 -933
  212. mindspore/ops/operations/array_ops.py +5 -50
  213. mindspore/ops/operations/comm_ops.py +95 -17
  214. mindspore/ops/operations/custom_ops.py +237 -22
  215. mindspore/ops/operations/debug_ops.py +33 -35
  216. mindspore/ops/operations/manually_defined/ops_def.py +39 -318
  217. mindspore/ops/operations/math_ops.py +5 -5
  218. mindspore/ops/operations/nn_ops.py +3 -3
  219. mindspore/ops/operations/sparse_ops.py +0 -83
  220. mindspore/ops/primitive.py +4 -27
  221. mindspore/ops/tensor_method.py +88 -10
  222. mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +5 -5
  223. mindspore/ops_generate/aclnn/gen_aclnn_implement.py +8 -8
  224. mindspore/ops_generate/api/functions_cc_generator.py +53 -4
  225. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +25 -11
  226. mindspore/ops_generate/common/gen_constants.py +11 -10
  227. mindspore/ops_generate/common/op_proto.py +18 -1
  228. mindspore/ops_generate/common/template.py +102 -245
  229. mindspore/ops_generate/common/template_utils.py +212 -0
  230. mindspore/ops_generate/gen_custom_ops.py +69 -0
  231. mindspore/ops_generate/op_def/ops_def_cc_generator.py +78 -7
  232. mindspore/ops_generate/op_def_py/base_op_prim_py_generator.py +360 -0
  233. mindspore/ops_generate/op_def_py/custom_op_prim_py_generator.py +140 -0
  234. mindspore/ops_generate/op_def_py/op_def_py_generator.py +54 -7
  235. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -312
  236. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +74 -17
  237. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +22 -5
  238. mindspore/ops_generate/pyboost/gen_pyboost_func.py +0 -16
  239. mindspore/ops_generate/pyboost/op_template_parser.py +3 -2
  240. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +21 -5
  241. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +2 -2
  242. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +30 -10
  243. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +10 -3
  244. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +1 -1
  245. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +19 -9
  246. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +71 -28
  247. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +10 -9
  248. mindspore/ops_generate/pyboost/pyboost_utils.py +27 -16
  249. mindspore/ops_generate/resources/yaml_loader.py +13 -0
  250. mindspore/ops_generate/tensor_py_cc_generator.py +2 -2
  251. mindspore/parallel/_auto_parallel_context.py +5 -15
  252. mindspore/parallel/_cell_wrapper.py +1 -1
  253. mindspore/parallel/_parallel_serialization.py +4 -6
  254. mindspore/parallel/_ps_context.py +2 -2
  255. mindspore/parallel/_utils.py +34 -17
  256. mindspore/parallel/auto_parallel.py +23 -9
  257. mindspore/parallel/checkpoint_transform.py +20 -2
  258. mindspore/parallel/cluster/process_entity/_api.py +28 -33
  259. mindspore/parallel/cluster/process_entity/_utils.py +9 -5
  260. mindspore/parallel/cluster/run.py +5 -3
  261. mindspore/{experimental/llm_boost/ascend_native → parallel/distributed}/__init__.py +21 -22
  262. mindspore/parallel/distributed/distributed_data_parallel.py +393 -0
  263. mindspore/parallel/distributed/flatten_grad_buffer.py +295 -0
  264. mindspore/parallel/function/reshard_func.py +6 -5
  265. mindspore/parallel/nn/parallel_cell_wrapper.py +40 -3
  266. mindspore/parallel/nn/parallel_grad_reducer.py +0 -8
  267. mindspore/parallel/shard.py +7 -21
  268. mindspore/parallel/strategy.py +336 -0
  269. mindspore/parallel/transform_safetensors.py +127 -20
  270. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +13 -9
  271. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
  272. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +1 -1
  273. mindspore/profiler/common/constant.py +5 -0
  274. mindspore/profiler/common/file_manager.py +9 -0
  275. mindspore/profiler/common/msprof_cmd_tool.py +40 -4
  276. mindspore/profiler/common/path_manager.py +65 -24
  277. mindspore/profiler/common/profiler_context.py +27 -14
  278. mindspore/profiler/common/profiler_info.py +3 -3
  279. mindspore/profiler/common/profiler_meta_data.py +1 -0
  280. mindspore/profiler/common/profiler_op_analyse.py +10 -6
  281. mindspore/profiler/common/profiler_path_manager.py +13 -0
  282. mindspore/profiler/common/util.py +30 -3
  283. mindspore/profiler/dynamic_profiler.py +91 -46
  284. mindspore/profiler/envprofiler.py +30 -5
  285. mindspore/profiler/experimental_config.py +18 -2
  286. mindspore/profiler/platform/cpu_profiler.py +10 -4
  287. mindspore/profiler/platform/npu_profiler.py +34 -7
  288. mindspore/profiler/profiler.py +193 -145
  289. mindspore/profiler/profiler_action_controller.py +1 -1
  290. mindspore/profiler/profiler_interface.py +2 -2
  291. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  292. mindspore/run_check/_check_version.py +108 -24
  293. mindspore/runtime/__init__.py +9 -6
  294. mindspore/runtime/executor.py +35 -0
  295. mindspore/runtime/memory.py +113 -0
  296. mindspore/runtime/thread_bind_core.py +1 -1
  297. mindspore/swresample-4.dll +0 -0
  298. mindspore/swscale-6.dll +0 -0
  299. mindspore/tinyxml2.dll +0 -0
  300. mindspore/{experimental/llm_boost → tools}/__init__.py +5 -5
  301. mindspore/tools/data_dump.py +130 -0
  302. mindspore/tools/sdc_detect.py +91 -0
  303. mindspore/tools/stress_detect.py +63 -0
  304. mindspore/train/__init__.py +6 -6
  305. mindspore/train/_utils.py +8 -21
  306. mindspore/train/amp.py +6 -7
  307. mindspore/train/callback/_callback.py +2 -1
  308. mindspore/train/callback/_checkpoint.py +1 -17
  309. mindspore/train/callback/_flops_collector.py +10 -6
  310. mindspore/train/callback/_train_fault_tolerance.py +72 -25
  311. mindspore/train/data_sink.py +5 -9
  312. mindspore/train/dataset_helper.py +5 -5
  313. mindspore/train/model.py +41 -230
  314. mindspore/train/serialization.py +160 -401
  315. mindspore/train/train_thor/model_thor.py +2 -2
  316. mindspore/turbojpeg.dll +0 -0
  317. mindspore/utils/__init__.py +6 -3
  318. mindspore/utils/dlpack.py +92 -0
  319. mindspore/utils/dryrun.py +1 -1
  320. mindspore/utils/runtime_execution_order_check.py +10 -0
  321. mindspore/utils/sdc_detect.py +14 -12
  322. mindspore/utils/stress_detect.py +43 -0
  323. mindspore/utils/utils.py +152 -16
  324. mindspore/version.py +1 -1
  325. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/METADATA +3 -2
  326. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/RECORD +330 -344
  327. mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
  328. mindspore/communication/_hccl_management.py +0 -297
  329. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -207
  330. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +0 -52
  331. mindspore/experimental/llm_boost/atb/__init__.py +0 -23
  332. mindspore/experimental/llm_boost/atb/boost_base.py +0 -385
  333. mindspore/experimental/llm_boost/atb/llama_boost.py +0 -137
  334. mindspore/experimental/llm_boost/atb/qwen_boost.py +0 -124
  335. mindspore/experimental/llm_boost/register.py +0 -130
  336. mindspore/experimental/llm_boost/utils.py +0 -31
  337. mindspore/include/OWNERS +0 -7
  338. mindspore/mindspore_cpu_res_manager.dll +0 -0
  339. mindspore/mindspore_ops_kernel_common.dll +0 -0
  340. mindspore/mindspore_res_manager.dll +0 -0
  341. mindspore/nn/optim/_dist_optimizer_registry.py +0 -111
  342. mindspore/nn/reinforcement/_batch_read_write.py +0 -142
  343. mindspore/nn/reinforcement/_tensors_queue.py +0 -152
  344. mindspore/nn/reinforcement/tensor_array.py +0 -145
  345. mindspore/opencv_core452.dll +0 -0
  346. mindspore/opencv_imgcodecs452.dll +0 -0
  347. mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +0 -113
  348. mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +0 -96
  349. mindspore/ops/_op_impl/aicpu/sparse_cross.py +0 -42
  350. mindspore/ops/_op_impl/cpu/buffer_get.py +0 -28
  351. mindspore/ops/_op_impl/cpu/buffer_sample.py +0 -28
  352. mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +0 -42
  353. mindspore/ops/operations/_tensor_array.py +0 -359
  354. mindspore/ops/operations/rl_ops.py +0 -288
  355. mindspore/parallel/_offload_context.py +0 -275
  356. mindspore/parallel/_recovery_context.py +0 -115
  357. mindspore/parallel/_transformer/__init__.py +0 -35
  358. mindspore/parallel/_transformer/layers.py +0 -765
  359. mindspore/parallel/_transformer/loss.py +0 -251
  360. mindspore/parallel/_transformer/moe.py +0 -693
  361. mindspore/parallel/_transformer/op_parallel_config.py +0 -222
  362. mindspore/parallel/_transformer/transformer.py +0 -3124
  363. mindspore/parallel/mpi/_mpi_config.py +0 -116
  364. mindspore/profiler/common/validator/validate_path.py +0 -84
  365. mindspore/train/memory_profiling_pb2.py +0 -298
  366. mindspore/utils/hooks.py +0 -81
  367. /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
  368. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/WHEEL +0 -0
  369. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/entry_points.txt +0 -0
  370. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/top_level.txt +0 -0
@@ -81,7 +81,7 @@ def gen_custom_op_files(config_dir, dsl_dir):
81
81
  f.write(json.dumps(ops_info, indent=4))
82
82
 
83
83
  # custom akg op dsl file
84
- custom_py = os.path.join(cur_path, "../../../../../lite/tools/kernel_builder/ascend/akg/custom.py")
84
+ custom_py = os.path.join(cur_path, "custom.py")
85
85
  if not os.path.isfile(custom_py):
86
86
  raise RuntimeError("custom.py path is invalid: {}".format(custom_py))
87
87
  shutil.copy(custom_py, dsl_dir)
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2024 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.
@@ -30,7 +30,7 @@ from .parser import (Parser, create_instance, is_supported_create_instance_type,
30
30
  get_obj_defined_from_obj_type, is_from_third_party_library, get_const_abs, get_const_round,
31
31
  get_const_len, convert_to_namedtuple, check_attrs, generate_lambda_object,
32
32
  check_is_subclass, check_attr_is_property, get_method_info, can_constant_fold,
33
- convert_to_mutable, get_ast_augassign_namespace_symbol)
33
+ convert_to_mutable, get_ast_augassign_namespace_symbol, hook_wrapper)
34
34
 
35
35
  __all__ = ['Parser', 'create_instance', 'is_supported_create_instance_type', 'generate_scope', 'get_attr_from_object',
36
36
  'get_bprop_method_of_class', 'get_class_instance_type', 'get_class_member_namespace_symbol',
@@ -45,4 +45,4 @@ __all__ = ['Parser', 'create_instance', 'is_supported_create_instance_type', 'ge
45
45
  'is_class_member_recursive', 'get_obj_defined_from_obj_type',
46
46
  'is_from_third_party_library', 'get_const_abs', 'get_const_round', 'get_const_len', 'get_method_info',
47
47
  'convert_to_namedtuple', 'check_attrs', 'generate_lambda_object', 'check_is_subclass', 'check_attr_is_property',
48
- 'can_constant_fold', 'convert_to_mutable', 'get_ast_augassign_namespace_symbol']
48
+ 'can_constant_fold', 'convert_to_mutable', 'get_ast_augassign_namespace_symbol', 'hook_wrapper']
@@ -362,6 +362,27 @@ Value Range:
362
362
  """
363
363
  JIT_ENABLE_AUGASSIGN_INPLACE = '0'
364
364
 
365
+ """
366
+ Name: ENABLE_VIEW_INPLACE_GRAD_SCHEME_CHOOSE
367
+ Function: Whether enable new method for view inplace grad
368
+ Value Range:
369
+ 0: Choose old or new scheme based on specific control flow scenarios.
370
+ 1: Choose old scheme.
371
+ 2: Choose new scheme.
372
+ Default: 2
373
+ """
374
+ ENABLE_VIEW_INPLACE_GRAD_SCHEME_CHOOSE = '2'
375
+
376
+ """
377
+ Name: GRAD_JIT_FILTER
378
+ Function: Whether to filter grad jit graph.
379
+ Value Range:
380
+ 1: Enable filter grad jit output
381
+ 2: Enable filter grad jit input and output. May cause error when input gradient information changed.
382
+ Default: Disable.
383
+ """
384
+ GRAD_JIT_FILTER = '1'
385
+
365
386
  __all__ = [
366
387
  "COMPILE_PROFILE",
367
388
  "COMPILE_PROFILE_FINISH_ACTION",
@@ -400,5 +421,7 @@ __all__ = [
400
421
  "PUT_ALL_CNODE_INTO_ORDER_LIST",
401
422
  "CHECK_PASS_NODE_SCOPE",
402
423
  "CHECK_INVALID_VIEW_INPLACE_DOUT_LEVEL",
403
- "JIT_ENABLE_AUGASSIGN_INPLACE"
424
+ "JIT_ENABLE_AUGASSIGN_INPLACE",
425
+ "ENABLE_VIEW_INPLACE_GRAD_SCHEME_CHOOSE",
426
+ "GRAD_JIT_FILTER"
404
427
  ]
@@ -179,7 +179,7 @@ deprecated_tensor_method_map = {
179
179
  # 80 outer
180
180
  "outer": "deprecated_tensor_outer",
181
181
  # 81 permute
182
-
182
+ "permute": "deprecated_tensor_permute",
183
183
  # 82 pow
184
184
  "pow": "deprecated_tensor_pow",
185
185
  # 83 prod
@@ -221,7 +221,7 @@ deprecated_tensor_method_map = {
221
221
  # 100 square
222
222
 
223
223
  # 101 squeeze
224
-
224
+ "squeeze": "tensor_squeeze",
225
225
  # 102 std
226
226
  "std": "deprecated_tensor_std",
227
227
  # 103 sub
@@ -338,7 +338,6 @@ deprecated_tensor_method_map = {
338
338
  "atan": "deprecated_tensor_atan",
339
339
  "arctan": "deprecated_tensor_arctan",
340
340
  "dot": "deprecated_tensor_dot",
341
- "copy_": "deprecated_tensor_copy_",
342
341
 
343
342
  # 153
344
343
  "logsumexp": "deprecated_tensor_logsumexp",
@@ -391,4 +390,8 @@ deprecated_tensor_method_map = {
391
390
  "count_nonzero": "deprecated_tensor_count_nonzero",
392
391
  # 1028
393
392
  "var": "deprecated_tensor_var",
393
+ # 1029
394
+ "real": "tensor_real",
395
+ # 1030
396
+ "imag": "tensor_imag",
394
397
  }
@@ -1,6 +1,6 @@
1
1
  # This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
2
2
  #
3
- # Copyright 2020-2024 Huawei Technologies Co., Ltd
3
+ # Copyright 2020-2025 Huawei Technologies Co., Ltd
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -103,17 +103,6 @@ parse_expr_statement_white_list = (
103
103
  "append", "insert", "clear", "reverse", "extend", "update", "register_hook",
104
104
  )
105
105
 
106
- # Methods that need to reorder after it's caller is used before
107
- # e.g. We need to reorder `x.register_hook` after x is used in `out = x + 1` when `register_hook` is called.
108
- # def construct(x):
109
- # out = x + 1
110
- # x.register_hook(hook_fn)
111
- # return out
112
- # equals to:
113
- # def construct(x):
114
- # x = x.register_hook(hook_fn) # register_hook will return itself when it is called in the graph (in `GRAPH_MODE`).
115
- # out = x + 1
116
- # return out
117
106
  _need_reorder_methods = (
118
107
  "register_hook",
119
108
  )
@@ -125,10 +114,6 @@ _unsupported_python_builtin_type = (
125
114
  set, dict, slice, complex, reversed, type,
126
115
  )
127
116
 
128
- # Unsupported python builtin type in JIT Fallback.
129
- _fallback_unsupported_python_builtin_type = (
130
- compile, eval, exec
131
- )
132
117
 
133
118
  _global_params = {}
134
119
 
@@ -197,10 +182,7 @@ def get_parse_method_of_class(obj, parse_method=None):
197
182
  if parse_method is not None:
198
183
  method_name = parse_method
199
184
  elif isinstance(obj, nn.Cell):
200
- if obj._backward_hook:
201
- method_name = "_backward_hook_construct"
202
- else:
203
- method_name = "construct"
185
+ method_name = "construct"
204
186
 
205
187
  return get_attr_from_object(obj, method_name)
206
188
 
@@ -805,6 +787,12 @@ def eval_script(exp_str, params):
805
787
  local_params = params[1]
806
788
  try:
807
789
  local_params = _convert_python_data(local_params)
790
+ # There are two sources of scripts:
791
+ # 1. The user's original Python script code, which is directly passed back to Python for execution,
792
+ # and its behavior is guaranteed by the user.
793
+ # 2. Internally provided Python expression code, similar to
794
+ # `__iternal_sequence_input__[__internal_sequence_index__]`.
795
+ # In addition, MindIR load and export do not involve the use of the `eval_script` function.
808
796
  res = eval(exp_str, global_params, local_params)
809
797
  except Exception as e:
810
798
  error_info = f"When eval '{exp_str}' by using JIT Fallback feature, an error occurred: " + str(e)
@@ -911,6 +899,26 @@ def can_constant_fold(obj):
911
899
  return obj in constant_fold_functions
912
900
 
913
901
 
902
+ def hook_wrapper(hook_fn):
903
+ """
904
+ Decorator wrapper for gradient hook functions.
905
+ Handles custom logic when the hook returns None to ensure execution dependencies.
906
+
907
+ Args:
908
+ hook_fn (function): The original hook function to be wrapped.
909
+
910
+ Returns:
911
+ function: Wrapped inner hook function with dependency handling logic.
912
+ """
913
+ def inner(dout):
914
+ fdout = hook_fn(dout)
915
+ if fdout is None:
916
+ dout = ops.Depend()(dout, fdout)
917
+ return dout
918
+ return fdout
919
+ return inner
920
+
921
+
914
922
  class Parser:
915
923
  """
916
924
  Parser python code to ast tree.
@@ -944,8 +952,6 @@ class Parser:
944
952
  """To check if not supported for namespace"""
945
953
  unsupported = isinstance(value, _builtin_function_or_method_type) and value not in convert_object_map
946
954
  logger.debug(f"'{value}' unsupported: {unsupported}.")
947
- if unsupported and value in _fallback_unsupported_python_builtin_type:
948
- raise TypeError(f"'{value}' is not supported both in JIT Fallback and graph mode.")
949
955
  return unsupported
950
956
 
951
957
  @staticmethod
@@ -83,8 +83,8 @@ parse_augassign_object_map = {
83
83
  ast.Mult: (trope_ns, 'augassign_mul', '*='),
84
84
  ast.Div: (trope_ns, 'augassign_div', '/='),
85
85
  ast.FloorDiv: (trope_ns, 'augassign_floordiv', '//='),
86
+ ast.Mod: (trope_ns, 'augassign_mod', '%='),
86
87
 
87
- ast.Mod: (trope_ns, 'mod', '%'),
88
88
  ast.Pow: (trope_ns, 'pow', '**'),
89
89
  ast.MatMult: (trope_ns, 'matmul', '@'),
90
90
  ast.LShift: (trope_ns, 'lshift', '<<'),
@@ -28,7 +28,7 @@ from mindspore.ops.composite.base import _append, _insert, _pop, _list_clear, _r
28
28
  _extend, _dict_setitem, _dict_clear, _haskey, _update, _fromkeys
29
29
  from mindspore.ops.operations._sequence_ops import TensorToTuple
30
30
  from mindspore.ops.auto_generate import trace_v2_op, inplace_addmm_op, inplace_index_put_op, inplace_normal_op, \
31
- inplace_index_add_op
31
+ inplace_index_add_op, inplace_sign_op
32
32
  from mindspore.ops.auto_generate import inplace_copy_op, inplace_uniform_op, inplace_erfinv_op
33
33
  from mindspore.ops.auto_generate import inplace_scatter_add as inplace_scatter_add_
34
34
  from mindspore.ops.auto_generate import inplace_exponential_op
@@ -1114,7 +1114,7 @@ def copy_(self, src, non_blocking=False):
1114
1114
  """
1115
1115
  Copies the elements from src into self tensor and returns self.
1116
1116
  """
1117
- return inplace_copy_op(self, src)
1117
+ return inplace_copy_op(self, src, non_blocking)
1118
1118
 
1119
1119
 
1120
1120
  def max(input, axis=None, keepdims=False, *, initial=None, # pylint: disable=redefined-builtin
@@ -3709,6 +3709,13 @@ def bernoulli(input, *, generator=None):
3709
3709
  return F.bernoulli_ext(input, generator=generator)
3710
3710
 
3711
3711
 
3712
+ def bernoulli_(input, p=0.5, *, generator=None):
3713
+ """
3714
+ Randomly draws binary numbers from a Bernoulli distribution.
3715
+ """
3716
+ return F.bernoulli_(input, p, generator=generator)
3717
+
3718
+
3712
3719
  def gather_nd(input_x, indices):
3713
3720
  r"""
3714
3721
  Gathers slices from a tensor by indices.
@@ -4356,6 +4363,13 @@ def sign(x):
4356
4363
  return F.sign(x)
4357
4364
 
4358
4365
 
4366
+ def sign_(input):
4367
+ r"""
4368
+ In-place version of :func:`mindspore.mint.sign`.
4369
+ """
4370
+ return inplace_sign_op(input)
4371
+
4372
+
4359
4373
  def signbit(x):
4360
4374
  """
4361
4375
  For details, please refer to :func:`mindspore.ops.signbit`.
@@ -4535,6 +4549,13 @@ def index_put(input, indices, values, accumulate=False):
4535
4549
  return _index_put(input, values, indices)
4536
4550
 
4537
4551
 
4552
+ def move_to(input, to, blocking=True):
4553
+ r"""
4554
+ Copy Tensor to target device synchronously or asynchronously, default synchronously. only support PyNative mode.
4555
+ """
4556
+ raise ValueError(f"The method 'move_to' is not supported in jit.")
4557
+
4558
+
4538
4559
  def index_put_(input, indices, values, accumulate=False):
4539
4560
  r"""
4540
4561
  For details, please refer to :func:`mindspore.Tensor.index_put_`.
@@ -42,6 +42,7 @@ from mindspore.ops.composite.multitype_ops.sub_impl import augassign_sub
42
42
  from mindspore.ops.composite.multitype_ops.mul_impl import augassign_mul
43
43
  from mindspore.ops.composite.multitype_ops.div_impl import augassign_div
44
44
  from mindspore.ops.composite.multitype_ops.floordiv_impl import augassign_floordiv
45
+ from mindspore.ops.composite.multitype_ops.mod_impl import augassign_mod
45
46
 
46
47
  from ...common import mutable
47
48
 
@@ -51,7 +52,7 @@ __all__ = ['add', 'sub', 'mul', 'truediv', 'floordiv', 'mod', 'eq', 'ne', 'lt',
51
52
  'bool', 'getattr', 'setattr', 'hasattr', 'len', 'iter', 'next', 'pow', 'range', 'map', 'zip',
52
53
  'partial', 'print', 'enumerate', 'isinstance', 'filter', 'abs', 'round', 'mutable',
53
54
  'max', 'min', 'sum', 'list', 'tuple',
54
- 'augassign_add', 'augassign_sub', 'augassign_mul', 'augassign_div', 'augassign_floordiv']
55
+ 'augassign_add', 'augassign_sub', 'augassign_mul', 'augassign_div', 'augassign_floordiv', 'augassign_mod']
55
56
 
56
57
 
57
58
  def MakeTuple(*elts): # pragma: no cover
@@ -37,7 +37,7 @@ from mindspore.common.initializer import Zero
37
37
  from mindspore.ops.function import array_func
38
38
  from mindspore.ops import operations as P
39
39
  from mindspore.ops import functional as F
40
- from mindspore._c_expression.np_dtypes import np_version_valid
40
+ from mindspore._c_expression.np_dtypes import np_dtype_valid
41
41
  from mindspore.common.dtype import type_size_in_bytes
42
42
  from mindspore.communication._comm_helper import _is_initialized, _get_rank_helper, _get_local_rank_helper, \
43
43
  _get_size_helper, _get_local_size_helper, _get_world_rank_from_group_rank_helper, _get_group_ranks, \
@@ -53,7 +53,6 @@ from mindspore.train.serialization import _exec_save, load, export_split_mindir,
53
53
  _generate_front_info_for_param_data_file, _get_data_file, _encrypt_data, _split_save, _save_mindir_together, \
54
54
  _load_into_param_dict
55
55
  from mindspore.parallel import _cost_model_context
56
- from mindspore.parallel._offload_context import offload_context
57
56
  from mindspore.parallel._utils import _is_in_data_parallel_mode
58
57
  from mindspore.run_check._check_version import check_version_and_env_config
59
58
  from mindspore.dataset.callback.ds_callback import DSCallback, WaitedDSCallback
@@ -129,7 +128,6 @@ from mindspore.dataset.vision.transforms import AdjustBrightness, AdjustContrast
129
128
  ResizeWithBBox as VResizeWithBBox, Rotate as VRotate, SlicePatches as VSlicePatches, Solarize, ToTensor,\
130
129
  TrivialAugmentWide, UniformAugment as VUniformAugment, VerticalFlip as VVerticalFlip
131
130
  from mindspore.profiler.profiler import Profiler
132
- from mindspore.communication._hccl_management import get_rank_size, get_rank_id
133
131
  from mindspore.communication._comm_helper import _create_group_helper, _destroy_group_helper
134
132
  from mindspore.communication.management import _set_rank_from_mpi, init as cinit, release as crelease
135
133
  from mindspore.hal.stream import Stream, synchronize, set_cur_stream, current_stream, default_stream
@@ -137,17 +135,13 @@ from mindspore.hal.event import Event
137
135
  from mindspore.hal.memory import memory_stats, memory_reserved, max_memory_allocated, reset_peak_memory_stats, \
138
136
  memory_summary, memory_allocated, max_memory_reserved, reset_max_memory_allocated, reset_max_memory_reserved
139
137
  from mindspore.multiprocessing import Process
140
- from mindspore.mindrecord.shardsegment import ShardSegment
141
- from mindspore.mindrecord.shardreader import ShardReader
142
- from mindspore.mindrecord.shardindexgenerator import ShardIndexGenerator
143
- from mindspore.mindrecord.shardwriter import ShardWriter
144
- from mindspore.mindrecord.shardheader import ShardHeader
145
138
  from mindspore.mindrecord.config import encrypt, decrypt
146
- from mindspore.parallel.mpi._mpi_config import _MpiConfig
139
+ from mindspore.mindrecord import FileWriter
140
+ from mindspore.mindrecord import FileReader
141
+ from mindspore.mindrecord import MindPage
147
142
  from mindspore.parallel._ps_context import ps_context
148
143
  from mindspore.parallel.algo_parameter_config import _AlgoParameterConfig
149
- from mindspore.parallel._utils import _reset_op_id, _reset_op_id_with_offset
150
- from mindspore.parallel._recovery_context import recovery_context
144
+ from mindspore.parallel._utils import _reset_op_id
151
145
  from mindspore.parallel._auto_parallel_context import _AutoParallelContext
152
146
  from mindspore.common.api import ms_memory_recycle
153
147
  from mindspore.context import _Context
@@ -462,10 +456,6 @@ _func_map = {
462
456
  function_id(dict.items): FUNC_KEY_DICT_ITEMS,
463
457
 
464
458
  # instancemethod
465
- function_id(Tensor_._flatten_tensors): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
466
- function_id(Tensor_._is_flattened): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
467
- function_id(Tensor_._get_flattened_tensors): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
468
- function_id(Tensor_._get_fusion_size): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
469
459
  function_id(Tensor_._is_test_stub): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
470
460
  function_id(Tensor_.__str__): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
471
461
  function_id(Tensor_.__repr__): FUNC_KEY_BUILTIN_FUNC, # pylint: disable=protected-access
@@ -492,14 +482,11 @@ _func_map = {
492
482
  function_id(validator.check_is_int): FUNC_KEY_PIJIT_CONSTEXPR,
493
483
  function_id(validator.check_is_number): FUNC_KEY_PIJIT_CONSTEXPR,
494
484
  function_id(validator.check_positive_int_sequence): FUNC_KEY_PIJIT_CONSTEXPR,
495
- function_id(np_version_valid): FUNC_KEY_PIJIT_CONSTEXPR,
485
+ function_id(np_dtype_valid): FUNC_KEY_PIJIT_CONSTEXPR,
496
486
  function_id(_is_initialized): FUNC_KEY_PIJIT_CONSTEXPR,
497
487
  function_id(_set_elegant_exit_handle): FUNC_KEY_PIJIT_CONSTEXPR,
498
488
  function_id(_cost_model_context.get_cost_model_context): FUNC_KEY_PIJIT_CONSTEXPR,
499
489
  function_id(Stream.__repr__): FUNC_KEY_PIJIT_CONSTEXPR,
500
- function_id(get_rank_size): FUNC_KEY_PIJIT_CONSTEXPR,
501
- function_id(get_rank_id): FUNC_KEY_PIJIT_CONSTEXPR,
502
- function_id(offload_context): FUNC_KEY_PIJIT_CONSTEXPR,
503
490
  function_id(_is_in_data_parallel_mode): FUNC_KEY_PIJIT_CONSTEXPR,
504
491
  function_id(check_version_and_env_config): FUNC_KEY_PIJIT_CONSTEXPR,
505
492
  function_id(Tensor.tolist): FUNC_KEY_PIJIT_CONSTEXPR,
@@ -575,19 +562,14 @@ _func_map = {
575
562
  function_id(reset_max_memory_allocated): FUNC_KEY_PIJIT_FORBIDDEN,
576
563
  function_id(Process.run): FUNC_KEY_PIJIT_FORBIDDEN,
577
564
  function_id(Process.start): FUNC_KEY_PIJIT_FORBIDDEN,
578
- function_id(ShardSegment.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
579
- function_id(ShardReader.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
580
- function_id(ShardIndexGenerator.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
581
- function_id(ShardWriter.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
582
- function_id(ShardHeader.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
583
565
  function_id(encrypt): FUNC_KEY_PIJIT_FORBIDDEN,
584
566
  function_id(decrypt): FUNC_KEY_PIJIT_FORBIDDEN,
585
- function_id(_MpiConfig.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
567
+ function_id(FileWriter.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
568
+ function_id(FileReader.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
569
+ function_id(MindPage.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
586
570
  function_id(ps_context): FUNC_KEY_PIJIT_FORBIDDEN,
587
571
  function_id(_AlgoParameterConfig.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
588
572
  function_id(_reset_op_id): FUNC_KEY_PIJIT_FORBIDDEN,
589
- function_id(_reset_op_id_with_offset): FUNC_KEY_PIJIT_FORBIDDEN,
590
- function_id(recovery_context): FUNC_KEY_PIJIT_FORBIDDEN,
591
573
  function_id(_AutoParallelContext.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
592
574
  function_id(ms_memory_recycle): FUNC_KEY_PIJIT_FORBIDDEN,
593
575
  function_id(_Context.__init__): FUNC_KEY_PIJIT_FORBIDDEN,
mindspore/amp.py CHANGED
@@ -167,9 +167,6 @@ def all_finite(inputs):
167
167
  >>> x = (Tensor(np.array([np.log(-1), 1, np.log(0)])), Tensor(np.array([1.0])))
168
168
  >>> output = amp.all_finite(x)
169
169
 
170
- Tutorial Examples:
171
- - `Automatic Mix Precision - Loss Scaling
172
- <https://mindspore.cn/tutorials/en/master/beginner/mixed_precision.html#loss-scaling>`_
173
170
  """
174
171
  inputs = mutable(inputs)
175
172
  _check_overflow_mode = os.environ.get('MS_ASCEND_CHECK_OVERFLOW_MODE')
@@ -185,9 +182,6 @@ class LossScaler(ABC):
185
182
  to scale and unscale the loss value and gradients to avoid overflow, `adjust` is used to update the
186
183
  loss scale value.
187
184
 
188
- For more information, refer to the `tutorials <https://mindspore.cn/tutorials/en/master/beginner/
189
- mixed_precision.html#loss-scaling>`_.
190
-
191
185
  .. warning::
192
186
  This is an experimental API that is subject to change or deletion.
193
187
 
@@ -377,10 +371,6 @@ class DynamicLossScaler(LossScaler):
377
371
 
378
372
  Returns:
379
373
  Union(Tensor, tuple(Tensor)), the scaled value.
380
-
381
- Tutorial Examples:
382
- - `Automatic Mix Precision - Loss Scaling
383
- <https://mindspore.cn/tutorials/en/master/beginner/mixed_precision.html#loss-scaling>`_
384
374
  """
385
375
  inputs = mutable(inputs)
386
376
  return _grad_scale_map(self.scale_value, inputs)
@@ -394,10 +384,6 @@ class DynamicLossScaler(LossScaler):
394
384
 
395
385
  Returns:
396
386
  Union(Tensor, tuple(Tensor)), the unscaled value.
397
-
398
- Tutorial Examples:
399
- - `Automatic Mix Precision - Loss Scaling
400
- <https://mindspore.cn/tutorials/en/master/beginner/mixed_precision.html#loss-scaling>`_
401
387
  """
402
388
  inputs = mutable(inputs)
403
389
  return _grad_unscale_map(self.scale_value, inputs)
@@ -408,10 +394,6 @@ class DynamicLossScaler(LossScaler):
408
394
 
409
395
  Args:
410
396
  grads_finite (Tensor): a scalar bool Tensor indicating whether the grads are finite.
411
-
412
- Tutorial Examples:
413
- - `Automatic Mix Precision - Loss Scaling
414
- <https://mindspore.cn/tutorials/en/master/beginner/mixed_precision.html#loss-scaling>`_
415
397
  """
416
398
  one = ops.ones((), self.scale_value.dtype)
417
399
  scale_mul_factor = self.scale_value * self.scale_factor
mindspore/avcodec-59.dll CHANGED
Binary file
mindspore/avdevice-59.dll CHANGED
Binary file
mindspore/avfilter-8.dll CHANGED
Binary file
mindspore/avformat-59.dll CHANGED
Binary file
mindspore/avutil-57.dll CHANGED
Binary file
mindspore/boost/base.py CHANGED
@@ -16,6 +16,7 @@
16
16
  from __future__ import absolute_import
17
17
 
18
18
  import os
19
+ import re
19
20
  import time
20
21
  import math
21
22
  import copy
@@ -29,7 +30,6 @@ from mindspore.communication.management import get_rank, get_group_size
29
30
  from mindspore.train.serialization import load_checkpoint
30
31
  from mindspore.boost.less_batch_normalization import CommonHeadLastFN
31
32
 
32
-
33
33
  __all__ = ["OptimizerProcess", "ParameterProcess"]
34
34
 
35
35
 
@@ -65,6 +65,7 @@ class OptimizerProcess:
65
65
  >>> optimizer_process.add_grad_centralization(network)
66
66
  >>> optimizer = optimizer_process.generate_new_optimizer()
67
67
  """
68
+
68
69
  def __init__(self, opt):
69
70
  if isinstance(opt, LARS):
70
71
  self.is_lars = True
@@ -116,7 +117,7 @@ class OptimizerProcess:
116
117
  if 'beta' not in param.name and 'gamma' not in param.name and 'bias' not in param.name:
117
118
  param_cell = params_dict[id(param)]
118
119
  if (isinstance(param_cell, nn.Conv2d) and param_cell.group > 1) or \
119
- isinstance(param_cell, CommonHeadLastFN):
120
+ isinstance(param_cell, CommonHeadLastFN):
120
121
  params_value.append(param)
121
122
  else:
122
123
  params_gc_value.append(param)
@@ -203,6 +204,7 @@ class ParameterProcess:
203
204
  >>> new_parameter = network.trainable_params()[:1]
204
205
  >>> group_params = ParameterProcess.generate_group_params(new_parameter, network.trainable_params())
205
206
  """
207
+
206
208
  def __init__(self):
207
209
  self._parameter_indices = 1
208
210
 
@@ -486,6 +488,30 @@ def _svd_flip(u, v, transpose=True):
486
488
  return u, v
487
489
 
488
490
 
491
+ def _check_path(path):
492
+ """check if the path is valid"""
493
+ path_white_list_regex = re.compile(r"[^_A-Za-z0-9/.-]")
494
+ if not isinstance(path, str):
495
+ raise TypeError('Path must be str, not {}.'.format(type(path).__name__))
496
+ if not path:
497
+ raise ValueError("The value of the path cannot be empty.")
498
+ if path_white_list_regex.search(path):
499
+ raise ValueError(
500
+ "Input path contains invalid characters.")
501
+ path = os.path.expanduser(path) # Consider paths starting with "~"
502
+ if os.path.islink(os.path.abspath(path)): # when checking link, get rid of the "/" at the path tail if any
503
+ raise ValueError("The value of the path cannot be soft link: {}.".format(path))
504
+
505
+ real_path = os.path.realpath(path)
506
+
507
+ if len(real_path) > 4096:
508
+ raise ValueError("The length of file path should be less than 4096.")
509
+
510
+ if real_path != path and path_white_list_regex.search(real_path):
511
+ raise ValueError(
512
+ "Input path contains invalid characters.")
513
+
514
+
489
515
  def _save_local_pca_mat(pca_mat, full_pca_mat_path, n_component):
490
516
  """
491
517
  save pca mat.
@@ -495,6 +521,7 @@ def _save_local_pca_mat(pca_mat, full_pca_mat_path, n_component):
495
521
  full_pca_mat_path (str): the path of full pca mat.
496
522
  n_component (int): pca component.
497
523
  """
524
+ _check_path(full_pca_mat_path)
498
525
  rank_size = get_group_size()
499
526
  local_dim = math.ceil(n_component // rank_size)
500
527
  for rank_id in range(rank_size):
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2024 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.
@@ -17,14 +17,15 @@ from __future__ import absolute_import
17
17
  from mindspore.common import dtype
18
18
  from mindspore.common.api import ms_memory_recycle, jit, jit_class, _no_grad, \
19
19
  flops_collection, set_recursion_limit
20
- from mindspore.common.dtype import Type, int8, byte, int16, short, int32, intc, int64, intp, \
20
+ from mindspore.common.dtype import Type, int8, byte, int16, short, int, int32, intc, long, int64, intp, \
21
21
  uint8, ubyte, uint16, ushort, uint32, uintc, uint64, uintp, float16, half, \
22
- float32, single, float64, bfloat16, double, bool_, float_, list_, tuple_, int_, \
22
+ float, float32, single, float64, bfloat16, double, bool, bool_, float_, list_, tuple_, int_, \
23
23
  uint, number, tensor_type, string, type_none, TensorType, Int, \
24
- complex64, complex128, dtype_to_nptype, _null, _NullType, \
24
+ cfloat, complex64, cdouble, complex128, dtype_to_nptype, _null, _NullType, \
25
25
  dtype_to_pytype, pytype_to_dtype, get_py_obj_dtype, QuantDtype, qint4x2, \
26
26
  float8_e4m3fn, float8_e5m2, hifloat8
27
27
  from mindspore.common.dump import set_dump
28
+ from mindspore.common.file_system import set_mindio_server_info, mindio_preload
28
29
  from mindspore.common.parameter import Parameter, ParameterTuple
29
30
  from mindspore.common.seed import set_seed, get_seed
30
31
  from mindspore.common.tensor import Tensor, tensor
@@ -41,6 +42,7 @@ from mindspore.common.generator import (
41
42
  Generator, default_generator, seed, manual_seed, initial_seed, get_rng_state, set_rng_state)
42
43
  from mindspore.ops.function.array_func import is_tensor, from_numpy
43
44
  from mindspore.common._grad_function import _Function
45
+ from mindspore.common.dynamic_shape.enable_dynamic import enable_dynamic
44
46
 
45
47
  try:
46
48
  import triton
@@ -66,11 +68,13 @@ except ImportError:
66
68
  pass
67
69
 
68
70
  # symbols from dtype
71
+ # bool, int, float are not defined in __all__ to avoid conflict with built-in types.
69
72
  __all__ = [
73
+ "bool_",
70
74
  "int8", "byte",
71
75
  "int16", "short",
72
76
  "int32", "intc",
73
- "int64", "intp",
77
+ "int64", "long", "intp",
74
78
  "uint8", "ubyte",
75
79
  "uint16", "ushort",
76
80
  "uint32", "uintc",
@@ -78,20 +82,20 @@ __all__ = [
78
82
  "float16", "half",
79
83
  "float32", "single",
80
84
  "float64", "double",
81
- "bool_", "float_",
82
- "list_", "tuple_",
85
+ "float_", "list_", "tuple_",
83
86
  "int_", "uint",
84
87
  "number", "tensor_type",
85
88
  "string", "type_none",
86
89
  "_null",
87
90
  "TensorType", "QuantDtype",
88
91
  "Type", "Int", "_NullType",
89
- "complex64", "complex128",
92
+ "complex64", "cfloat",
93
+ "complex128", "cdouble",
94
+ "bfloat16", "qint4x2",
95
+ "float8_e4m3fn", "float8_e5m2", "hifloat8",
90
96
  # __method__ from dtype
91
97
  "dtype_to_nptype", "dtype_to_pytype",
92
- "pytype_to_dtype", "get_py_obj_dtype",
93
- "bfloat16", "qint4x2",
94
- "float8_e4m3fn", "float8_e5m2", "hifloat8"
98
+ "pytype_to_dtype", "get_py_obj_dtype"
95
99
  ]
96
100
 
97
101
  __all__.extend([
@@ -104,11 +108,13 @@ __all__.extend([
104
108
  "ms_memory_recycle",
105
109
  "set_recursion_limit",
106
110
  "mutable", "JitConfig",
111
+ "enable_dynamic",
107
112
  "flops_collection",
108
113
  "lazy_inline", "load_mindir", "save_mindir",
109
114
  "no_inline",
110
115
  "Symbol",
111
116
  "recompute",
112
- "is_tensor", "from_numpy", "_Function"
117
+ "is_tensor", "from_numpy", "_Function",
118
+ "set_mindio_server_info", "mindio_preload"
113
119
  ])
114
120
  __all__.extend(generator.__all__)
@@ -22,13 +22,14 @@ from mindspore import log
22
22
  DEPRECATE_SET = set()
23
23
 
24
24
 
25
- def deprecated(version, substitute, use_substitute_name=False):
25
+ def deprecated(version, substitute, use_substitute_name=False, module_prefix=""):
26
26
  """deprecated warning
27
27
 
28
28
  Args:
29
29
  version (str): version that the operator or function is deprecated.
30
30
  substitute (str): the substitute name for deprecated operator or function.
31
31
  use_substitute_name (bool): flag for whether to use substitute name for deprecated operator or function
32
+ module_prefix (str): the module prefix of the deprecated api, such as 'mindspore.'.
32
33
  """
33
34
 
34
35
  def decorate(func):
@@ -37,7 +38,7 @@ def deprecated(version, substitute, use_substitute_name=False):
37
38
  cls = getattr(args[0], "__class__", None) if args else None
38
39
  name = cls.__name__ if cls else func.__name__
39
40
  if name + version not in DEPRECATE_SET:
40
- log.warning(f"'{name}' is deprecated from version {version} and "
41
+ log.warning(f"'{module_prefix}{name}' is deprecated from version {version} and "
41
42
  f"will be removed in a future version, use '{substitute}' instead.")
42
43
  DEPRECATE_SET.add(name + version)
43
44
  if cls and use_substitute_name:
@@ -24,7 +24,9 @@ from mindspore.common.tensor import Tensor
24
24
 
25
25
  class _Function(FunctionBase_):
26
26
  """
27
- A Class provides the ability to custom autograd function.
27
+ A Class provides the ability to custom autograd function. The api refers
28
+ to the following files from pytorch:
29
+ https://github.com/pytorch/pytorch/blob/main/torch/autograd/function.py
28
30
 
29
31
  Note:
30
32
  It is only supported in pynative mode.