mindspore 2.7.0rc1__cp310-cp310-win_amd64.whl → 2.7.1__cp310-cp310-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.cp310-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp310-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
@@ -13,94 +13,27 @@
13
13
  # limitations under the License.
14
14
  # ============================================================================
15
15
  """Templates for code auto generation."""
16
- import re
16
+ __all__ = [
17
+ "Template",
18
+ "NEW_LINE",
19
+ "PYTHON_PRIM_TEMPLATE",
20
+ "IMPORT_PYBOOST_PRIM_HEADER",
21
+ "IMPORT_PYBOOST_FUNC_HEADER",
22
+ "PY_LICENSE_STR",
23
+ "OPS_PY_PRIM_HEADER",
24
+ "OPS_PY_DEF_HEADER",
25
+ "CUSTOM_OPS_PY_DEF_HEADER",
26
+ "PRIMITIVE_CLASS_DESC",
27
+ "CC_LICENSE_STR",
28
+ "OP_PROTO_TEMPLATE",
29
+ "OP_PRIM_CLASS_DEFINE_TEMPLATE",
30
+ ]
31
+
17
32
  import os
18
33
  import common.gen_constants as K
19
-
20
-
21
- class Template:
22
- """
23
- template for generate c++/python code
24
- """
25
- regular_str = r"(^[^\n\S]*)?\$([^\d\W]\w*|\{,?[^\d\W]\w*\,?})"
26
- regular_match = re.compile(regular_str, re.MULTILINE)
27
-
28
- def __init__(self, code_pattern):
29
- self.code_pattern = code_pattern
30
-
31
- @staticmethod
32
- def load_from_file(file_path):
33
- with open(file_path, "r") as f:
34
- return Template(f.read())
35
-
36
- def replace(self, **kwargs):
37
- """
38
- replace param.
39
- :param kwargs:
40
- :return:
41
- """
42
-
43
- def find(key: str):
44
- if key in kwargs:
45
- return kwargs[key]
46
- raise TypeError(f"{key} should be in kwargs!")
47
-
48
- def add_indent(indent, var):
49
- return "".join([indent + line + "\n" for data in var for line in str(data).splitlines()]).rstrip()
50
-
51
- def extract_variable(key):
52
- start = ""
53
- end = ""
54
- if key[0] == "{":
55
- key = key[1:-1]
56
- if key[0] == ",":
57
- start = ","
58
- key = key[1:]
59
- if key[-1] == ",":
60
- end = ", "
61
- key = key[:-1]
62
- return find(key), start, end
63
-
64
- def match_rule(match):
65
- indent = match.group(1)
66
- key = match.group(2)
67
- var, start, end = extract_variable(key)
68
- if indent is not None:
69
- if not isinstance(var, list):
70
- return add_indent(indent, [var])
71
- return add_indent(indent, var)
72
- if isinstance(var, list):
73
- code = ", ".join(str(x) for x in var)
74
- if not var:
75
- return code
76
- return start + code + end
77
- return str(var)
78
-
79
- return self.regular_match.sub(match_rule, self.code_pattern)
80
-
81
-
82
- NEW_LINE = "\n"
83
-
84
- PYTHON_PRIM_TEMPLATE = Template("""
85
-
86
- class _Pyboost${class_name}Prim(${class_name}Prim_):
87
- def __call__(self, ${input_args}):
88
- ${process_func}
89
- return super().__call__([${processed_args}])
90
-
91
-
92
- ${func_impl_name}_impl = _Pyboost${class_name}Prim()
93
- """)
94
-
95
- IMPORT_PYBOOST_PRIM_HEADER = f"""
96
- from mindspore.ops._utils.arg_handler import *
97
- """
98
-
99
- IMPORT_PYBOOST_FUNC_HEADER = f"""
100
- from mindspore.common import dtype as mstype
101
- from mindspore.ops.auto_generate.pyboost_inner_prim import *
102
-
103
- """
34
+ from common.template_utils import Template, NEW_LINE, PYTHON_PRIM_TEMPLATE, IMPORT_PYBOOST_PRIM_HEADER, \
35
+ IMPORT_PYBOOST_FUNC_HEADER, PY_LICENSE_STR, OPS_PY_PRIM_HEADER, OPS_PY_DEF_HEADER, CUSTOM_OPS_PY_DEF_HEADER, \
36
+ PRIMITIVE_CLASS_DESC, CC_LICENSE_STR, OP_PROTO_TEMPLATE, OP_PRIM_CLASS_DEFINE_TEMPLATE
104
37
 
105
38
  REGISTER_DEFINE_TEMPLATE = Template(
106
39
  """
@@ -117,13 +50,13 @@ REGISTER_PYBOOST_GRAD_DEFINE_TEMPLATE = Template(
117
50
  REGISTER_PYBOOST_GRAD_TEMPLATE = Template("${register_func}")
118
51
 
119
52
  PYBOOST_FUNCTION_HEADER_TEMPLATE = Template.load_from_file(
120
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_h.tpl'))
53
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_api_h.tpl'))
121
54
 
122
55
  PYBOOST_CORE_HEADER_TEMPLATE = Template.load_from_file(
123
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_header.tpl'))
56
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_header.tpl'))
124
57
  PYBOOST_INTERNAL_OP_HEADER_TEMPLATE = Template.load_from_file(
125
- os.path.join(K.WORK_DIR,
126
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/internal/template/pyboost_internal_header_template.tpl'))
58
+ os.path.join(K.WORK_DIR, K.MS_OPS_KERNEL_PATH,
59
+ f'ascend/aclnn/pyboost_impl/internal/template/pyboost_internal_header_template.tpl'))
127
60
 
128
61
  PYBOOST_INTERNAL_SINGLE_OP_HEADER_TEMPLATE = Template.load_from_file(
129
62
  os.path.join(K.WORK_DIR,
@@ -178,96 +111,112 @@ PYBOOST_INTERNAL_KERNEL_INFO_ADAPTER_SINGLE_CPP_TEMPLATE = Template.load_from_fi
178
111
  f'{K.MS_PLUGIN_INTERNAL_PATH}/pyboost/template/internal_kernel_info_adapter_single_cpp.tpl'))
179
112
 
180
113
  PYBOOST_REGISTRY_BODY_CC_TEMPLATE = Template.load_from_file(
181
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_registry_body_cc.tpl'))
114
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_registry_body_cc.tpl'))
182
115
 
183
116
  PYBOOST_CORE_BODY_TEMPLATE = Template.load_from_file(
184
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body.tpl'))
117
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_body.tpl'))
118
+
119
+ PYBOOST_CORE_BODY_VIEW_TEMPLATE = Template.load_from_file(
120
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_body_view.tpl'))
185
121
 
186
122
  PYBOOST_CORE_BODY_COMM_TEMPLATE = Template.load_from_file(
187
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body_comm.tpl'))
123
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_body_comm.tpl'))
188
124
 
189
125
  PYBOOST_CORE_BODY_SYNC_TEMPLATE = Template.load_from_file(
190
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_body_sync.tpl'))
126
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_body_sync.tpl'))
127
+
128
+ PYBOOST_CORE_BODY_VIEW_SYNC_TEMPLATE = Template.load_from_file(
129
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_body_view_sync.tpl'))
191
130
 
192
131
  PYBOOST_REGISTRY_CC_TEMPLATE = Template.load_from_file(
193
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_registry_cc.tpl'))
132
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_registry_cc.tpl'))
194
133
 
195
134
  PYBOOST_API_CC_TEMPLATE = Template.load_from_file(
196
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_cc.tpl'))
135
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_api_cc.tpl'))
197
136
 
198
137
  PYBOOST_API_BODY_CC_TEMPLATE = Template.load_from_file(
199
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_api_body_cc.tpl'))
138
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_api_body_cc.tpl'))
200
139
 
201
140
  PYBOOST_CORE_CC_TEMPLATE = Template.load_from_file(
202
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_core_cc.tpl'))
141
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_core_cc.tpl'))
203
142
 
204
143
  PYBOOST_OVERLOAD_FUNCTIONS_CC_TEMPLATE = Template.load_from_file(
205
144
  os.path.join(
206
- K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_overload_functions_cc.tpl'))
145
+ K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_overload_functions_cc.tpl'))
207
146
 
208
147
  PYBOOST_MINT_CLASS_DEF = Template.load_from_file(
209
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_mint_class_def.tpl'))
148
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_mint_class_def.tpl'))
210
149
 
211
150
  PYBOOST_OVERLOAD_MINT_CLASS_DEF = Template.load_from_file(
212
151
  os.path.join(
213
- K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/pyboost_overload_mint_class_def.tpl'))
152
+ K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_overload_mint_class_def.tpl'))
214
153
 
215
154
  # template path need to be moved
216
155
  FUNCTIONAL_OVERLOAD_PY_TEMPLATE = Template.load_from_file(
217
156
  os.path.join(
218
- K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/functional_overload_py.tpl')
157
+ K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/functional_overload_py.tpl')
219
158
  )
220
159
 
221
160
  TENSOR_FUNC_CC_REG = Template.load_from_file(
222
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_func_cc_reg.tpl'))
161
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_cc_reg.tpl'))
223
162
 
224
163
  TENSOR_API_HEADER = Template.load_from_file(
225
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_api_header.tpl'))
164
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_api_header.tpl'))
226
165
 
227
166
  TENSOR_API_SOURCE = Template.load_from_file(
228
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_api_source.tpl'))
167
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_api_source.tpl'))
229
168
 
230
169
  TENSOR_FUNC_UTILS = Template.load_from_file(
231
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_func_utils_header.tpl'))
170
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_utils_header.tpl'))
232
171
 
233
172
  TENSOR_FUNC_CALL_BODY = Template.load_from_file(
234
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_func_call_body.tpl'))
173
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_call_body.tpl'))
235
174
 
236
175
  TENSOR_FUNC_OVERLOAD_CALL_BODY = Template.load_from_file(
237
176
  os.path.join(K.WORK_DIR,
238
- './mindspore/ccsrc/pynative/op_function/template/tensor_func_overload_call_body.tpl'))
177
+ './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_overload_call_body.tpl'))
239
178
 
240
179
  TENSOR_FUNC_UT_BODY = Template.load_from_file(
241
180
  os.path.join(K.WORK_DIR,
242
- './mindspore/ccsrc/pynative/op_function/template/tensor_func_ut_body.tpl'))
181
+ './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_ut_body.tpl'))
243
182
 
244
183
  TENSOR_FUNC_UT_OVERLOAD_BODY = Template.load_from_file(
245
184
  os.path.join(K.WORK_DIR,
246
- './mindspore/ccsrc/pynative/op_function/template/tensor_func_ut_overload_body.tpl'))
185
+ './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_ut_overload_body.tpl'))
186
+
187
+ PYBOOST_OVERLOAD_UT_BODY = Template.load_from_file(
188
+ os.path.join(K.WORK_DIR,
189
+ './mindspore/ccsrc/pynative/forward/pyboost/template/pyboost_overload_ut_body.tpl'))
247
190
 
248
191
  TENSOR_CPP_METHOD = Template.load_from_file(
249
192
  os.path.join(K.WORK_DIR,
250
- './mindspore/ccsrc/pynative/op_function/template/tensor_cpp_method.tpl'))
193
+ './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_cpp_method.tpl'))
251
194
 
252
195
  TENSOR_FUNC_CLASS_REG = Template.load_from_file(
253
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_func_class_reg.tpl'))
196
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_func_class_reg.tpl'))
254
197
 
255
198
  PYBOOST_GRAD_FUNCTION_TEMPLATE = Template.load_from_file(
256
199
  os.path.join(K.WORK_DIR, './mindspore/ccsrc/pyboost/grad_functions/template/pyboost_grad_function.tpl'))
257
200
 
201
+ PYBOOST_VIEW_GRAD_FUNCTION_TEMPLATE = Template.load_from_file(
202
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pyboost/grad_functions/template/pyboost_view_grad_function.tpl'))
203
+
258
204
  PYBOOST_GRAD_HEADER_TEMPLATE = Template.load_from_file(
259
205
  os.path.join(K.WORK_DIR, './mindspore/ccsrc/pyboost/grad_functions/template/pyboost_grad_function_header.tpl'))
260
206
 
261
207
  PYBOOST_NATIVE_GRAD_FUNCTION_TEMPLATE = Template.load_from_file(
262
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/grad/function/template/native_grad_function.tpl'))
208
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/backward/op_grad/template/native_grad_function.tpl'))
209
+
210
+ PYBOOST_NATIVE_VIEW_GRAD_FUNCTION_TEMPLATE = Template.load_from_file(
211
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/backward/op_grad/template/native_view_grad_function.tpl'))
263
212
 
264
213
  PYBOOST_NATIVE_GRAD_FUNCTIONS_TEMPLATE = Template.load_from_file(
265
214
  os.path.join(K.WORK_DIR,
266
- './mindspore/ccsrc/pynative/grad/function/template/pyboost_native_grad_functions.tpl'))
215
+ './mindspore/ccsrc/pynative/backward/op_grad/template/pyboost_native_grad_functions.tpl'))
267
216
 
268
217
  PYBOOST_NATIVE_GRAD_FUNCTIONS_HEADER_TEMPLATE = Template.load_from_file(
269
218
  os.path.join(K.WORK_DIR,
270
- './mindspore/ccsrc/pynative/grad/function/template/pyboost_native_grad_functions_header.tpl'))
219
+ './mindspore/ccsrc/pynative/backward/op_grad/template/pyboost_native_grad_functions_header.tpl'))
271
220
 
272
221
  GEN_OPS_DEF_HEADER_TEMPLATE = Template.load_from_file(
273
222
  os.path.join(K.WORK_DIR, './mindspore/python/mindspore/ops_generate/op_def/gen_ops_def_header.tpl'))
@@ -281,33 +230,33 @@ PYBOOST_OP_REGISTER_TEMPLATE = Template.load_from_file(
281
230
  # Ascend op generate
282
231
  PYBOOST_ASCEND_OP_HEADER_TEMPLATE = Template.load_from_file(
283
232
  os.path.join(K.WORK_DIR,
284
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_header_template.tpl'))
233
+ f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/pyboost_impl/template/pyboost_aclnn_header_template.tpl'))
285
234
  PYBOOST_ASCEND_INTERNAL_OP_HEADER_TEMPLATE = Template.load_from_file(
286
- os.path.join(K.WORK_DIR,
287
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/internal/template/pyboost_internal_header_template.tpl')
235
+ os.path.join(K.WORK_DIR, K.MS_OPS_KERNEL_PATH,
236
+ f'ascend/aclnn/pyboost_impl/internal/template/pyboost_internal_header_template.tpl')
288
237
  )
289
238
 
290
239
  PYBOOST_ASCEND_OP_SOURCE_TEMPLATE = Template.load_from_file(
291
240
  os.path.join(K.WORK_DIR,
292
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_source_template.tpl'))
241
+ f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/pyboost_impl/template/pyboost_aclnn_source_template.tpl'))
293
242
 
294
243
  PYBOOST_ASCEND_SINGLE_OP_HEADER_TEMPLATE = Template.load_from_file(
295
- os.path.join(K.WORK_DIR,
296
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_single_op_header_template.tpl'))
244
+ os.path.join(K.WORK_DIR, K.MS_OPS_KERNEL_PATH,
245
+ f'ascend/aclnn/pyboost_impl/template/pyboost_aclnn_single_op_header_template.tpl'))
297
246
 
298
247
  PYBOOST_ASCEND_SINGLE_HCLL_OP_HEADER_TEMPLATE = Template.load_from_file(
299
- os.path.join(K.WORK_DIR,
300
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_single_hccl_op_header_template.tpl'))
248
+ os.path.join(K.WORK_DIR, K.MS_OPS_KERNEL_PATH,
249
+ f'ascend/aclnn/pyboost_impl/template/pyboost_aclnn_single_hccl_op_header_template.tpl'))
301
250
 
302
251
  PYBOOST_CALL_FUNC_TEMPLATE = Template('${return_type} Call(${call_args_with_type}) override;')
303
252
 
304
253
  PYBOOST_ASCEND_SINGLE_OP_SOURCE_TEMPLATE = Template.load_from_file(
305
- os.path.join(K.WORK_DIR,
306
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_aclnn_single_op_source_template.tpl'))
254
+ os.path.join(K.WORK_DIR, K.MS_OPS_KERNEL_PATH,
255
+ f'ascend/aclnn/pyboost_impl/template/pyboost_aclnn_single_op_source_template.tpl'))
307
256
 
308
257
  PYBOOST_ASCEND_CALL_TEMPLATE = Template.load_from_file(
309
258
  os.path.join(K.WORK_DIR,
310
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template/pyboost_ascend_call_template.tpl'))
259
+ f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/pyboost_impl/template/pyboost_ascend_call_template.tpl'))
311
260
 
312
261
  PYBOOST_ASCEND_VIEW_CALL_TEMPLATE = Template.load_from_file(
313
262
  os.path.join(K.WORK_DIR,
@@ -316,7 +265,7 @@ PYBOOST_ASCEND_VIEW_CALL_TEMPLATE = Template.load_from_file(
316
265
 
317
266
  PYBOOST_ASCEND_CUSTOMIZE_CALL_TEMPLATE = Template.load_from_file(
318
267
  os.path.join(K.WORK_DIR,
319
- f'./{K.MS_OPS_KERNEL_PATH}/ascend/pyboost/template'
268
+ f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/pyboost_impl/template'
320
269
  '/pyboost_ascend_customize_call_template.tpl'))
321
270
 
322
271
  # GPU op generate
@@ -390,30 +339,6 @@ def ${func_name}(${func_args}):
390
339
  \"\"\"
391
340
  return ${func_impl_name}_impl(${input_args})\n\n""")
392
341
 
393
- OP_PROTO_TEMPLATE = Template("""
394
- ${func_impl_declaration}
395
- OpDef g${class_name} = {
396
- /*.name_=*/"${class_name}",
397
- /*.args_=*/ {
398
- ${input_args}
399
- },
400
- /* .returns_ = */ {
401
- ${return_args}
402
- },
403
- /*.signatures_ =*/ {
404
- ${signatures}
405
- },
406
- /*.indexes_ =*/ {
407
- ${indexes}
408
- },
409
- /*.func_impl_=*/${func_impl_define},
410
- /*.enable_dispatch_ =*/${enable_dispatch},
411
- /*.is_view_ =*/${is_view},
412
- /*.is_graph_view_ =*/${is_graph_view},
413
- };
414
- REGISTER_PRIMITIVE_OP_DEF(${class_name}, &g${class_name});
415
- """)
416
-
417
342
  MULTI_OUTPUT_TEMPLATE = """
418
343
  ValuePtrList values;
419
344
  (void)std::transform(op->outputs().begin(), op->outputs().end(), std::back_inserter(values),
@@ -421,86 +346,6 @@ ValuePtrList values;
421
346
  auto output_value = std::make_shared<ValueTuple>(values);
422
347
  """
423
348
 
424
- PY_LICENSE_STR = f"""# Copyright 2023 Huawei Technologies Co., Ltd
425
- #
426
- # Licensed under the Apache License, Version 2.0 (the "License");
427
- # you may not use this file except in compliance with the License.
428
- # You may obtain a copy of the License at
429
- #
430
- # http://www.apache.org/licenses/LICENSE-2.0
431
- #
432
- # Unless required by applicable law or agreed to in writing, software
433
- # distributed under the License is distributed on an "AS IS" BASIS,
434
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
435
- # See the License for the specific language governing permissions and
436
- # limitations under the License.
437
- # ============================================================================
438
- """
439
-
440
- OPS_PY_PRIM_HEADER = f"""
441
- \"\"\"Operators definition generated by gen_ops.py, includes primitive classes.\"\"\"
442
-
443
- from mindspore.ops.primitive import Primitive, prim_arg_register
444
- from mindspore.ops import signature as sig
445
- from mindspore.common import dtype as mstype
446
- from mindspore.common._decorator import deprecated
447
- from mindspore.ops._primitive_cache import _get_cache_prim
448
- from mindspore.ops._utils.arg_dtype_cast import type_it
449
- from mindspore.ops._utils.arg_handler import *
450
- from mindspore._c_expression import OpDtype
451
- from mindspore.common.jit_context import jit_context
452
- from mindspore._checkparam import is_stub_tensor
453
- """
454
-
455
- OP_PRIM_CLASS_DEFINE_TEMPLATE = Template("""
456
-
457
- class ${class_name}(Primitive):
458
- ${class_desc}${signature_code}${deprecated_code}
459
- ${init_method}
460
-
461
- ${call_method}""")
462
-
463
- OPS_PY_DEF_HEADER = f"""
464
- \"\"\"Operators definition generated by gen_ops.py, includes functions.\"\"\"
465
-
466
- from .gen_ops_prim import *
467
- from .pyboost_inner_prim import *
468
- from mindspore.ops.operations.manually_defined.ops_def import *
469
- from mindspore.ops._primitive_cache import _get_cache_prim
470
- """
471
-
472
- PRIMITIVE_CLASS_DESC = """ r\"\"\"
473
- .. code-block::
474
-
475
- prim = ops.$class_name($init_args_str)
476
- out = prim($input_args_str)
477
-
478
- is equivalent to
479
-
480
- .. code-block::
481
-
482
- ops.$func_name($args_str)
483
-
484
- Refer to :func:`mindspore.ops.$func_name` for more details.
485
- \"\"\"
486
- """
487
-
488
- CC_LICENSE_STR = f"""/**
489
- * Copyright 2023-2025 Huawei Technologies Co., Ltd
490
- *
491
- * Licensed under the Apache License, Version 2.0 (the "License");
492
- * you may not use this file except in compliance with the License.
493
- * You may obtain a copy of the License at
494
- *
495
- * http://www.apache.org/licenses/LICENSE-2.0
496
- *
497
- * Unless required by applicable law or agreed to in writing, software
498
- * distributed under the License is distributed on an "AS IS" BASIS,
499
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
500
- * See the License for the specific language governing permissions and
501
- * limitations under the License.
502
- */"""
503
-
504
349
  arg_default_value = Template("""
505
350
  \"\"\"Operator labels and args default value.\"\"\"
506
351
  from mindspore.common import dtype as mstype
@@ -539,10 +384,10 @@ op_template = Template("""void ${op_name}::set_${arg_name}(const ${dtype} &${arg
539
384
  """ { return GetValue<${dtype}>(GetAttr("${arg_name}")); }\n\n""")
540
385
 
541
386
  ACLNN_KERNEL_CC_TEMPLATE = Template.load_from_file(
542
- os.path.join(K.WORK_DIR, f'./{K.MS_OPS_KERNEL_PATH}/ascend/opapi/template/aclnn_kernel_cc.tpl'))
387
+ os.path.join(K.WORK_DIR, f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/kernel_mod_impl/template/aclnn_kernel_cc.tpl'))
543
388
 
544
389
  ACLNN_KERNEL_H_TEMPLATE = Template.load_from_file(
545
- os.path.join(K.WORK_DIR, f'./{K.MS_OPS_KERNEL_PATH}/ascend/opapi/template/aclnn_kernel_h.tpl'))
390
+ os.path.join(K.WORK_DIR, f'./{K.MS_OPS_KERNEL_PATH}/ascend/aclnn/kernel_mod_impl/template/aclnn_kernel_h.tpl'))
546
391
 
547
392
  update_output_shape_and_size_template = Template("""
548
393
  void ${kernelmod_name}::UpdateOutputShapeAndSize(const std::vector<KernelTensor *> &,
@@ -562,39 +407,51 @@ TUPLE_TENSOR_NOT_SUPPORTED = Template("""
562
407
 
563
408
  FUNCTIONAL_MAP_CC_TEMPLATE = Template.load_from_file(
564
409
  os.path.join(K.WORK_DIR,
565
- f'./mindspore/ccsrc/pynative/op_function/template/functional_map_cc.tpl'))
410
+ f'./mindspore/ccsrc/pynative/forward/pyboost/template/functional_map_cc.tpl'))
566
411
 
567
412
  FUNCTIONAL_MAP_H_TEMPLATE = Template.load_from_file(
568
413
  os.path.join(K.WORK_DIR,
569
- f'./mindspore/ccsrc/pynative/op_function/template/functional_map_h.tpl'))
414
+ f'./mindspore/ccsrc/pynative/forward/pyboost/template/functional_map_h.tpl'))
570
415
 
571
416
  ADD_TENSOR_DOCS_TEMPLATE = Template.load_from_file(
572
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/tensor_docs_py.tpl'))
417
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/tensor_docs_py.tpl'))
573
418
 
574
419
  AUTO_GRAD_IMPL_CC_TEMPLATE = Template.load_from_file(
575
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/auto_grad_impl_cc.tpl'))
420
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/auto_grad_impl_cc.tpl'))
576
421
 
577
422
  AUTO_GRAD_REG_H_TEMPLATE = Template.load_from_file(
578
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/auto_grad_reg_h.tpl'))
423
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/auto_grad_reg_h.tpl'))
579
424
 
580
425
  FUNCTIONS_CC_TEMPLATE = Template.load_from_file(
581
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/functions_cc.tpl'))
426
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/functions_cc.tpl'))
582
427
 
583
428
  FUNCTION_BODY_TEMPLATE = Template.load_from_file(
584
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/function_body.tpl'))
429
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/function_body.tpl'))
430
+
431
+ FUNCTION_VIEW_BODY_TEMPLATE = Template.load_from_file(
432
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/function_view_body.tpl'))
433
+
434
+ FUNCTION_VIEW_CUSTOMIZE_BODY_TEMPLATE = Template.load_from_file(
435
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/function_view_customize_body.tpl'))
585
436
 
586
437
  FUNCTION_COMM_BODY_TEMPLATE = Template.load_from_file(
587
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/comm_function_body.tpl'))
438
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/comm_function_body.tpl'))
588
439
 
589
440
  FUNCTIONS_H_TEMPLATE = Template.load_from_file(
590
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/functions_h.tpl'))
441
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/functions_h.tpl'))
591
442
 
592
443
  DO_GRAD_FUNCTION_BODY_TEMPLATE = Template.load_from_file(
593
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/op_function/template/do_grad_function.tpl'))
444
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/do_grad_function.tpl'))
445
+
446
+ DO_VIEW_GRAD_FUNCTION_BODY_TEMPLATE = Template.load_from_file(
447
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/do_view_grad_function.tpl'))
448
+
449
+ DO_VIEW_CUSTOMIZE_GRAD_FUNCTION_BODY_TEMPLATE = Template.load_from_file(
450
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pynative/forward/pyboost/template/do_view_customize_grad_function.tpl'))
594
451
 
595
452
  TENSOR_PY_CC_TEMPLATE = Template.load_from_file(
596
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pybind_api/ir/template/tensor_py_gen.tpl'))
453
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pybind_api/ir/tensor/template/tensor_py_gen.tpl'))
597
454
  TENSOR_PY_H_TEMPLATE = Template.load_from_file(
598
- os.path.join(K.WORK_DIR, './mindspore/ccsrc/pybind_api/ir/template/tensor_py_genH.tpl'))
455
+ os.path.join(K.WORK_DIR, './mindspore/ccsrc/pybind_api/ir/tensor/template/tensor_py_genH.tpl'))
599
456
  OP_DEF_INC_HEAD_TEMPLATE = Template(
600
457
  "#include \"mindspore/ops/op_def/auto_generate/gen_ops_primitive_${prefix_char}.h\"")