mindspore 2.6.0__cp310-cp310-win_amd64.whl → 2.7.0__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 (455) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Microsoft.VisualStudio.Telemetry.dll +0 -0
  3. mindspore/Newtonsoft.Json.dll +0 -0
  4. mindspore/__init__.py +2 -2
  5. mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
  8. mindspore/_checkparam.py +42 -11
  9. mindspore/_extends/builtin_operations.py +3 -3
  10. mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
  11. mindspore/_extends/optimize/cell_utils.py +96 -0
  12. mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
  13. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  14. mindspore/_extends/parse/__init__.py +3 -3
  15. mindspore/_extends/parse/compile_config.py +44 -22
  16. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -2
  17. mindspore/_extends/parse/parser.py +64 -83
  18. mindspore/_extends/parse/resources.py +39 -0
  19. mindspore/_extends/parse/standard_method.py +47 -14
  20. mindspore/_extends/parse/trope.py +8 -1
  21. mindspore/_extends/pijit/__init__.py +1 -2
  22. mindspore/_extends/pijit/pijit_func_white_list.py +2 -5
  23. mindspore/amp.py +4 -22
  24. mindspore/atlprov.dll +0 -0
  25. mindspore/avcodec-59.dll +0 -0
  26. mindspore/avdevice-59.dll +0 -0
  27. mindspore/avfilter-8.dll +0 -0
  28. mindspore/avformat-59.dll +0 -0
  29. mindspore/avutil-57.dll +0 -0
  30. mindspore/boost/adasum.py +1 -1
  31. mindspore/boost/boost_cell_wrapper.py +4 -4
  32. mindspore/c1.dll +0 -0
  33. mindspore/c1xx.dll +0 -0
  34. mindspore/c2.dll +0 -0
  35. mindspore/common/__init__.py +43 -12
  36. mindspore/common/_grad_function.py +2 -1
  37. mindspore/common/_pijit_context.py +28 -7
  38. mindspore/common/_stub_tensor.py +1 -209
  39. mindspore/common/_tensor_cpp_method.py +1 -1
  40. mindspore/common/_tensor_docs.py +177 -52
  41. mindspore/common/_utils.py +9 -1
  42. mindspore/common/api.py +338 -208
  43. mindspore/common/dtype.py +108 -57
  44. mindspore/common/dump.py +11 -16
  45. mindspore/common/dynamic_shape/__init__.py +0 -0
  46. mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +17 -23
  47. mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
  48. mindspore/common/file_system.py +59 -9
  49. mindspore/common/generator.py +2 -3
  50. mindspore/common/hook_handle.py +33 -5
  51. mindspore/common/jit_config.py +1 -1
  52. mindspore/common/jit_trace.py +84 -105
  53. mindspore/common/np_dtype.py +3 -3
  54. mindspore/common/parameter.py +27 -29
  55. mindspore/common/recompute.py +5 -7
  56. mindspore/common/sparse_tensor.py +0 -3
  57. mindspore/common/symbol.py +0 -1
  58. mindspore/common/tensor.py +84 -133
  59. mindspore/communication/_comm_helper.py +46 -4
  60. mindspore/communication/management.py +79 -7
  61. mindspore/context.py +47 -38
  62. mindspore/dataset/__init__.py +1 -1
  63. mindspore/dataset/audio/transforms.py +1 -1
  64. mindspore/dataset/core/config.py +38 -4
  65. mindspore/dataset/engine/datasets.py +350 -322
  66. mindspore/dataset/engine/datasets_user_defined.py +69 -23
  67. mindspore/dataset/engine/iterators.py +2 -2
  68. mindspore/dataset/engine/obs/config_loader.py +2 -2
  69. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
  70. mindspore/dataset/transforms/c_transforms.py +2 -2
  71. mindspore/dataset/transforms/py_transforms.py +7 -3
  72. mindspore/dataset/transforms/transforms.py +10 -6
  73. mindspore/dataset/vision/__init__.py +1 -1
  74. mindspore/dataset/vision/py_transforms.py +8 -8
  75. mindspore/dataset/vision/transforms.py +17 -5
  76. mindspore/dataset/vision/utils.py +632 -21
  77. mindspore/dataset/vision/validators.py +1 -0
  78. mindspore/device_context/ascend/device.py +1 -1
  79. mindspore/device_context/ascend/op_tuning.py +35 -1
  80. mindspore/device_context/gpu/__init__.py +2 -2
  81. mindspore/device_context/gpu/device.py +1 -1
  82. mindspore/device_context/gpu/op_precision.py +4 -2
  83. mindspore/device_context/gpu/op_tuning.py +6 -3
  84. mindspore/device_manager.py +16 -9
  85. mindspore/dnnl.dll +0 -0
  86. mindspore/dpcmi.dll +0 -0
  87. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +5 -4
  88. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  89. mindspore/experimental/optim/adadelta.py +13 -20
  90. mindspore/experimental/optim/adagrad.py +15 -22
  91. mindspore/experimental/optim/adam.py +17 -24
  92. mindspore/experimental/optim/adamax.py +14 -22
  93. mindspore/experimental/optim/adamw.py +28 -34
  94. mindspore/experimental/optim/asgd.py +15 -25
  95. mindspore/experimental/optim/lr_scheduler.py +27 -45
  96. mindspore/experimental/optim/nadam.py +14 -24
  97. mindspore/experimental/optim/optimizer.py +13 -23
  98. mindspore/experimental/optim/radam.py +18 -24
  99. mindspore/experimental/optim/rmsprop.py +14 -25
  100. mindspore/experimental/optim/rprop.py +15 -26
  101. mindspore/experimental/optim/sgd.py +9 -19
  102. mindspore/hal/__init__.py +4 -4
  103. mindspore/hal/contiguous_tensors_handle.py +2 -2
  104. mindspore/hal/memory.py +1 -0
  105. mindspore/include/api/cell.h +65 -5
  106. mindspore/include/api/cfg.h +24 -7
  107. mindspore/include/api/context.h +1 -0
  108. mindspore/include/api/delegate.h +10 -2
  109. mindspore/include/api/dual_abi_helper.h +100 -19
  110. mindspore/include/api/graph.h +14 -1
  111. mindspore/include/api/kernel.h +16 -3
  112. mindspore/include/api/kernel_api.h +9 -1
  113. mindspore/include/api/metrics/accuracy.h +9 -0
  114. mindspore/include/api/model.h +8 -1
  115. mindspore/include/api/model_group.h +4 -0
  116. mindspore/include/api/model_parallel_runner.h +2 -0
  117. mindspore/include/api/status.h +48 -10
  118. mindspore/include/api/types.h +8 -3
  119. mindspore/include/c_api/model_c.h +0 -58
  120. mindspore/include/c_api/tensor_c.h +0 -26
  121. mindspore/include/dataset/constants.h +9 -0
  122. mindspore/include/dataset/vision_ascend.h +1 -1
  123. mindspore/jpeg62.dll +0 -0
  124. mindspore/mindrecord/tools/cifar10.py +61 -11
  125. mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
  126. mindspore/mindspore_backend_common.dll +0 -0
  127. mindspore/mindspore_backend_manager.dll +0 -0
  128. mindspore/mindspore_common.dll +0 -0
  129. mindspore/mindspore_core.dll +0 -0
  130. mindspore/mindspore_cpu_res_manager.dll +0 -0
  131. mindspore/mindspore_dump.dll +0 -0
  132. mindspore/mindspore_frontend.dll +0 -0
  133. mindspore/mindspore_glog.dll +0 -0
  134. mindspore/mindspore_memory_pool.dll +0 -0
  135. mindspore/mindspore_ms_backend.dll +0 -0
  136. mindspore/mindspore_ops.dll +0 -0
  137. mindspore/mindspore_ops_host.dll +0 -0
  138. mindspore/mindspore_ops_kernel_common.dll +0 -0
  139. mindspore/mindspore_profiler.dll +0 -0
  140. mindspore/mindspore_pyboost.dll +0 -0
  141. mindspore/mindspore_pynative.dll +0 -0
  142. mindspore/mindspore_res_manager.dll +0 -0
  143. mindspore/mindspore_runtime_pipeline.dll +0 -0
  144. mindspore/mint/__init__.py +4 -44
  145. mindspore/mint/distributed/__init__.py +5 -0
  146. mindspore/mint/distributed/distributed.py +425 -19
  147. mindspore/mint/nn/__init__.py +1 -1
  148. mindspore/mint/nn/functional.py +53 -6
  149. mindspore/mint/nn/layer/_functions.py +163 -294
  150. mindspore/mint/nn/layer/activation.py +8 -6
  151. mindspore/mint/nn/layer/conv.py +125 -101
  152. mindspore/mint/nn/layer/normalization.py +11 -25
  153. mindspore/mint/optim/adam.py +19 -18
  154. mindspore/mint/optim/adamw.py +14 -8
  155. mindspore/mint/optim/sgd.py +5 -5
  156. mindspore/msobj140.dll +0 -0
  157. mindspore/mspdb140.dll +0 -0
  158. mindspore/mspdbcore.dll +0 -0
  159. mindspore/mspdbst.dll +0 -0
  160. mindspore/mspft140.dll +0 -0
  161. mindspore/msvcdis140.dll +0 -0
  162. mindspore/msvcp140_1.dll +0 -0
  163. mindspore/msvcp140_2.dll +0 -0
  164. mindspore/msvcp140_atomic_wait.dll +0 -0
  165. mindspore/msvcp140_codecvt_ids.dll +0 -0
  166. mindspore/nn/cell.py +488 -620
  167. mindspore/nn/grad/cell_grad.py +11 -12
  168. mindspore/nn/layer/activation.py +36 -36
  169. mindspore/nn/layer/basic.py +74 -77
  170. mindspore/nn/layer/channel_shuffle.py +4 -4
  171. mindspore/nn/layer/combined.py +4 -2
  172. mindspore/nn/layer/conv.py +86 -85
  173. mindspore/nn/layer/dense.py +9 -7
  174. mindspore/nn/layer/embedding.py +50 -52
  175. mindspore/nn/layer/image.py +38 -40
  176. mindspore/nn/layer/math.py +111 -112
  177. mindspore/nn/layer/normalization.py +56 -44
  178. mindspore/nn/layer/pooling.py +58 -63
  179. mindspore/nn/layer/rnn_cells.py +33 -33
  180. mindspore/nn/layer/rnns.py +56 -56
  181. mindspore/nn/layer/thor_layer.py +74 -73
  182. mindspore/nn/layer/transformer.py +11 -1
  183. mindspore/nn/learning_rate_schedule.py +20 -20
  184. mindspore/nn/loss/loss.py +79 -81
  185. mindspore/nn/optim/adam.py +2 -4
  186. mindspore/nn/optim/adasum.py +2 -2
  187. mindspore/nn/optim/lamb.py +1 -3
  188. mindspore/nn/optim/optimizer.py +1 -1
  189. mindspore/nn/optim/tft_wrapper.py +2 -3
  190. mindspore/nn/optim/thor.py +2 -2
  191. mindspore/nn/probability/distribution/_utils/utils.py +2 -2
  192. mindspore/nn/probability/distribution/exponential.py +2 -1
  193. mindspore/nn/probability/distribution/poisson.py +2 -1
  194. mindspore/nn/sparse/sparse.py +3 -3
  195. mindspore/nn/wrap/cell_wrapper.py +73 -42
  196. mindspore/nn/wrap/grad_reducer.py +37 -52
  197. mindspore/nn/wrap/loss_scale.py +72 -74
  198. mindspore/numpy/array_creations.py +7 -7
  199. mindspore/numpy/fft.py +1 -1
  200. mindspore/numpy/math_ops.py +1 -1
  201. mindspore/numpy/utils_const.py +1 -1
  202. mindspore/opencv_core452.dll +0 -0
  203. mindspore/opencv_imgcodecs452.dll +0 -0
  204. mindspore/opencv_imgproc452.dll +0 -0
  205. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  206. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  207. mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
  208. mindspore/ops/_op_impl/cpu/__init__.py +1 -0
  209. mindspore/{experimental/es/__init__.py → ops/_op_impl/cpu/joinedstr_op.py} +12 -6
  210. mindspore/ops/_vmap/vmap_array_ops.py +6 -13
  211. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  212. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +29 -10
  213. mindspore/ops/auto_generate/gen_extend_func.py +5 -55
  214. mindspore/ops/auto_generate/gen_ops_def.py +753 -273
  215. mindspore/ops/auto_generate/gen_ops_prim.py +1687 -958
  216. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  217. mindspore/ops/composite/__init__.py +10 -0
  218. mindspore/ops/composite/base.py +9 -5
  219. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  220. mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
  221. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  222. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  223. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  224. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  225. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  226. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  227. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  228. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  229. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  230. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  231. mindspore/ops/function/__init__.py +4 -1
  232. mindspore/ops/function/_add_attr_func.py +11 -6
  233. mindspore/ops/function/array_func.py +17 -100
  234. mindspore/ops/function/debug_func.py +8 -5
  235. mindspore/ops/function/grad/grad_func.py +5 -13
  236. mindspore/ops/function/math_func.py +65 -399
  237. mindspore/ops/function/nn_func.py +44 -61
  238. mindspore/ops/function/other_func.py +4 -1
  239. mindspore/ops/function/random_func.py +31 -4
  240. mindspore/ops/functional.py +2 -3
  241. mindspore/ops/functional_overload.py +486 -18
  242. mindspore/ops/op_info_register.py +21 -0
  243. mindspore/ops/operations/__init__.py +5 -2
  244. mindspore/ops/operations/_custom_ops_utils.py +675 -8
  245. mindspore/ops/operations/_inner_ops.py +14 -18
  246. mindspore/ops/operations/_sequence_ops.py +1 -1
  247. mindspore/ops/operations/array_ops.py +4 -50
  248. mindspore/ops/operations/comm_ops.py +186 -41
  249. mindspore/ops/operations/custom_ops.py +244 -175
  250. mindspore/ops/operations/debug_ops.py +55 -4
  251. mindspore/ops/operations/image_ops.py +13 -13
  252. mindspore/ops/operations/manually_defined/ops_def.py +27 -28
  253. mindspore/ops/operations/math_ops.py +8 -9
  254. mindspore/ops/operations/nn_ops.py +6 -7
  255. mindspore/ops/primitive.py +9 -20
  256. mindspore/ops/tensor_method.py +52 -11
  257. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  258. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  259. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  260. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  261. mindspore/ops_generate/common/base_generator.py +14 -0
  262. mindspore/ops_generate/common/gen_constants.py +7 -2
  263. mindspore/ops_generate/common/gen_utils.py +0 -19
  264. mindspore/ops_generate/common/op_proto.py +11 -4
  265. mindspore/ops_generate/common/template.py +88 -11
  266. mindspore/ops_generate/gen_ops.py +1 -1
  267. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  268. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  269. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  270. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  271. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  272. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  273. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -16
  274. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  275. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  276. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  277. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  278. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  279. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  280. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  281. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  282. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  283. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  284. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  285. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  286. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  287. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  288. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  289. mindspore/parallel/_auto_parallel_context.py +9 -17
  290. mindspore/parallel/_cell_wrapper.py +106 -40
  291. mindspore/parallel/_parallel_serialization.py +4 -3
  292. mindspore/parallel/_ps_context.py +4 -6
  293. mindspore/parallel/_tensor.py +167 -12
  294. mindspore/parallel/_transformer/moe.py +1 -1
  295. mindspore/parallel/_transformer/transformer.py +17 -12
  296. mindspore/parallel/_utils.py +5 -11
  297. mindspore/parallel/auto_parallel.py +33 -12
  298. mindspore/parallel/checkpoint_convert.py +3 -3
  299. mindspore/parallel/checkpoint_transform.py +5 -1
  300. mindspore/parallel/cluster/process_entity/_api.py +88 -49
  301. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  302. mindspore/parallel/cluster/run.py +48 -7
  303. mindspore/parallel/function/__init__.py +8 -1
  304. mindspore/parallel/function/reshard_func.py +7 -6
  305. mindspore/parallel/nn/__init__.py +15 -2
  306. mindspore/parallel/nn/parallel_cell_wrapper.py +50 -14
  307. mindspore/parallel/nn/parallel_grad_reducer.py +7 -14
  308. mindspore/parallel/shard.py +9 -23
  309. mindspore/parallel/transform_safetensors.py +468 -174
  310. mindspore/pgodb140.dll +0 -0
  311. mindspore/pgort140.dll +0 -0
  312. mindspore/profiler/__init__.py +2 -1
  313. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  314. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  315. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
  316. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  317. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  318. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  319. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  320. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  321. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  322. mindspore/profiler/analysis/task_manager.py +1 -1
  323. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  324. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  325. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +10 -9
  326. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +43 -23
  327. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  328. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  329. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  330. mindspore/profiler/common/constant.py +16 -0
  331. mindspore/profiler/common/msprof_cmd_tool.py +2 -2
  332. mindspore/profiler/common/path_manager.py +9 -0
  333. mindspore/profiler/common/profiler_context.py +50 -29
  334. mindspore/profiler/common/profiler_info.py +0 -16
  335. mindspore/profiler/common/profiler_meta_data.py +1 -0
  336. mindspore/profiler/common/profiler_op_analyse.py +239 -0
  337. mindspore/profiler/common/profiler_output_path.py +23 -8
  338. mindspore/profiler/common/profiler_parameters.py +128 -35
  339. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  340. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  341. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  342. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  343. mindspore/profiler/dynamic_profiler.py +374 -338
  344. mindspore/profiler/envprofiler.py +42 -12
  345. mindspore/profiler/experimental_config.py +112 -7
  346. mindspore/profiler/mstx.py +33 -12
  347. mindspore/profiler/platform/__init__.py +2 -3
  348. mindspore/profiler/platform/cpu_profiler.py +10 -4
  349. mindspore/profiler/platform/npu_profiler.py +30 -20
  350. mindspore/profiler/profiler.py +218 -154
  351. mindspore/profiler/profiler_action_controller.py +65 -77
  352. mindspore/profiler/profiler_interface.py +2 -2
  353. mindspore/profiler/schedule.py +10 -4
  354. mindspore/rewrite/common/config.py +1 -0
  355. mindspore/rewrite/common/namer.py +1 -0
  356. mindspore/rewrite/common/namespace.py +1 -0
  357. mindspore/rewrite/node/node.py +31 -11
  358. mindspore/rewrite/parsers/assign_parser.py +1 -1
  359. mindspore/rewrite/symbol_tree/symbol_tree.py +2 -2
  360. mindspore/run_check/_check_version.py +7 -10
  361. mindspore/runtime/__init__.py +8 -6
  362. mindspore/runtime/event.py +10 -4
  363. mindspore/runtime/executor.py +87 -45
  364. mindspore/runtime/memory.py +22 -30
  365. mindspore/runtime/thread_bind_core.py +299 -165
  366. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  367. mindspore/swresample-4.dll +0 -0
  368. mindspore/swscale-6.dll +0 -0
  369. mindspore/tbbmalloc.dll +0 -0
  370. mindspore/tinyxml2.dll +0 -0
  371. mindspore/train/_utils.py +9 -5
  372. mindspore/train/amp.py +43 -23
  373. mindspore/train/callback/__init__.py +5 -5
  374. mindspore/train/callback/_callback.py +2 -1
  375. mindspore/train/callback/_checkpoint.py +4 -14
  376. mindspore/train/callback/_flops_collector.py +11 -7
  377. mindspore/train/callback/_landscape.py +0 -1
  378. mindspore/train/callback/_train_fault_tolerance.py +72 -18
  379. mindspore/train/data_sink.py +15 -6
  380. mindspore/train/dataset_helper.py +14 -5
  381. mindspore/train/model.py +49 -47
  382. mindspore/train/serialization.py +168 -126
  383. mindspore/train/summary/summary_record.py +13 -2
  384. mindspore/train/train_thor/model_thor.py +2 -2
  385. mindspore/turbojpeg.dll +0 -0
  386. mindspore/utils/__init__.py +3 -2
  387. mindspore/utils/dryrun.py +0 -6
  388. mindspore/utils/runtime_execution_order_check.py +162 -78
  389. mindspore/utils/sdc_detect.py +68 -0
  390. mindspore/utils/utils.py +14 -17
  391. mindspore/vcmeta.dll +0 -0
  392. mindspore/vcruntime140.dll +0 -0
  393. mindspore/vcruntime140_1.dll +0 -0
  394. mindspore/version.py +1 -1
  395. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/METADATA +5 -4
  396. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/RECORD +400 -439
  397. mindspore/_deprecated/jit.py +0 -198
  398. mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
  399. mindspore/communication/_hccl_management.py +0 -297
  400. mindspore/experimental/es/embedding_service.py +0 -891
  401. mindspore/experimental/es/embedding_service_layer.py +0 -581
  402. mindspore/profiler/common/validator/__init__.py +0 -14
  403. mindspore/profiler/common/validator/validate_path.py +0 -84
  404. mindspore/profiler/parser/__init__.py +0 -14
  405. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  406. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  407. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  408. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  409. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  410. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  411. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  412. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  413. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  414. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  415. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  416. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  417. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  418. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  419. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  420. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  421. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  422. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  423. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  424. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  425. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  426. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  427. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  428. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  429. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  430. mindspore/profiler/parser/container.py +0 -229
  431. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  432. mindspore/profiler/parser/flops_parser.py +0 -531
  433. mindspore/profiler/parser/framework_enum.py +0 -111
  434. mindspore/profiler/parser/framework_parser.py +0 -464
  435. mindspore/profiler/parser/framework_struct.py +0 -61
  436. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  437. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  438. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  439. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  440. mindspore/profiler/parser/hccl_parser.py +0 -573
  441. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  442. mindspore/profiler/parser/integrator.py +0 -526
  443. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  444. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  445. mindspore/profiler/parser/minddata_parser.py +0 -186
  446. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  447. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  448. mindspore/profiler/parser/optime_parser.py +0 -250
  449. mindspore/profiler/parser/profiler_info.py +0 -213
  450. mindspore/profiler/parser/step_trace_parser.py +0 -666
  451. mindspore/utils/hooks.py +0 -81
  452. /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
  453. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/WHEEL +0 -0
  454. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/entry_points.txt +0 -0
  455. {mindspore-2.6.0.dist-info → mindspore-2.7.0.dist-info}/top_level.txt +0 -0
@@ -16,10 +16,15 @@
16
16
  from mindspore._c_expression import _add_instance
17
17
  from mindspore._c_expression import _addcdiv_instance
18
18
  from mindspore._c_expression import _all_gather_matmul_instance
19
+ from mindspore._c_expression import _any_instance
20
+ from mindspore._c_expression import _bernoulli__instance
19
21
  from mindspore._c_expression import _bitwise_not_instance
20
22
  from mindspore._c_expression import _clamp_instance
23
+ from mindspore._c_expression import _conv3d_instance
21
24
  from mindspore._c_expression import _div_instance
25
+ from mindspore._c_expression import _einsum_instance
22
26
  from mindspore._c_expression import _empty_instance
27
+ from mindspore._c_expression import _empty_like_instance
23
28
  from mindspore._c_expression import _floor_divide_instance
24
29
  from mindspore._c_expression import _fmod_instance
25
30
  from mindspore._c_expression import _gelu_instance
@@ -27,6 +32,7 @@ from mindspore._c_expression import _gmm_instance
27
32
  from mindspore._c_expression import _gmm_backward_instance
28
33
  from mindspore._c_expression import _gmm_backward_fusion_instance
29
34
  from mindspore._c_expression import _greater_equal_instance
35
+ from mindspore._c_expression import _index_add_instance
30
36
  from mindspore._c_expression import _kthvalue_instance
31
37
  from mindspore._c_expression import _lerp_instance
32
38
  from mindspore._c_expression import _matmul_reduce_scatter_instance
@@ -34,8 +40,10 @@ from mindspore._c_expression import _max_instance
34
40
  from mindspore._c_expression import _min_instance
35
41
  from mindspore._c_expression import _nansum_instance
36
42
  from mindspore._c_expression import _pixel_shuffle_instance
43
+ from mindspore._c_expression import _quant_matmul_instance
37
44
  from mindspore._c_expression import _remainder_instance
38
45
  from mindspore._c_expression import _repeat_interleave_instance
46
+ from mindspore._c_expression import _rmod_instance
39
47
  from mindspore._c_expression import _sub_instance
40
48
  from mindspore._c_expression import _where_instance
41
49
  from mindspore._c_expression import _xlogy_instance
@@ -59,10 +67,10 @@ def add(*args, **kwargs):
59
67
  Args:
60
68
  input (Union[Tensor, number.Number, bool]): `input` is a number.Number or a bool or a tensor whose data type is
61
69
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
62
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
70
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
63
71
  other (Union[Tensor, number.Number, bool]): `other` is a number.Number or a bool or a tensor whose data type is
64
72
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
65
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
73
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
66
74
 
67
75
  Keyword Args:
68
76
  alpha (number.Number, optional): A scaling factor applied to `other`, default ``1``.
@@ -264,6 +272,61 @@ def all_gather_matmul(*args, **kwargs):
264
272
  return _all_gather_matmul_instance(*args, **kwargs)
265
273
 
266
274
 
275
+ def any(*args, **kwargs):
276
+ r"""
277
+ any(input) -> Tensor
278
+
279
+ Check if ``True`` is present in `input` .
280
+
281
+ Args:
282
+ input (Tensor): The input tensor.
283
+
284
+ Returns:
285
+ Tensor
286
+
287
+ Supported Platforms:
288
+ ``Ascend`` ``GPU`` ``CPU``
289
+
290
+ Examples:
291
+ >>> import mindspore
292
+ >>> input = mindspore.tensor([[True, False], [True, True]])
293
+ >>> mindspore.ops.functional_overload.any(input)
294
+ Tensor(shape=[], dtype=Bool, value= True)
295
+
296
+ .. function:: any(input, dim, keepdim=False) -> Tensor
297
+ :noindex:
298
+
299
+ Check if ``True`` is present in the specified dimension of `input` .
300
+
301
+ Args:
302
+ input (Tensor): The input tensor.
303
+ dim (int): The dimensions to reduce.
304
+ keepdim (bool, optional): Whether the output tensor has dim retained or not. Default ``False`` .
305
+
306
+ Returns:
307
+ Tensor
308
+
309
+ Supported Platforms:
310
+ ``Ascend`` ``GPU`` ``CPU``
311
+
312
+ Examples:
313
+ >>> import mindspore
314
+ >>> input = mindspore.tensor([[True, False], [True, True]])
315
+ >>> mindspore.ops.functional_overload.any(input, dim=1)
316
+ Tensor(shape=[2], dtype=Bool, value= [ True, True])
317
+ """
318
+ return _any_instance(*args, **kwargs)
319
+
320
+
321
+ def bernoulli_(*args, **kwargs):
322
+ r"""
323
+ bernoulli_(input, p, seed, offset) -> Tensor
324
+
325
+ Inner function, used for Tensor.bernoulli_.
326
+ """
327
+ return _bernoulli__instance(*args, **kwargs)
328
+
329
+
267
330
  def bitwise_not(*args, **kwargs):
268
331
  r"""
269
332
  bitwise_not(input) -> Tensor
@@ -376,6 +439,143 @@ def clip(*args, **kwargs):
376
439
  return _clamp_instance(*args, **kwargs)
377
440
 
378
441
 
442
+ def conv3d(*args, **kwargs):
443
+ r"""
444
+ conv3d(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1) -> Tensor
445
+
446
+ Applies a 3D convolution over an input tensor. The input tensor is typically of
447
+ shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})` or :math:`(C_{in}, D_{in}, H_{in}, W_{in})`,
448
+ where :math:`N` is batch size, :math:`C` is channel number, :math:`D, H, W` are the depth,
449
+ height and width of the feature graph, respectively.
450
+
451
+ The output is calculated based on formula:
452
+
453
+ .. math::
454
+
455
+ \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
456
+ \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
457
+
458
+ where :math:`bias` is the output channel bias, :math:`ccor` is
459
+ the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_
460
+ , :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
461
+
462
+ Here are the indices' meanings:
463
+
464
+ - :math:`i` corresponds to the batch number, the range is :math:`[0, N-1]`,
465
+ where :math:`N` is the batch size of the input.
466
+
467
+ - :math:`j` corresponds to the output channel, the range is :math:`[0, C_{out}-1]`,
468
+ where :math:`C_{out}` is the number of
469
+ output channels, which is also equal to the number of kernels.
470
+
471
+ - :math:`k` corresponds to the input channel, the range is :math:`[0, C_{in}-1]`,
472
+ where :math:`C_{in}` is the number of
473
+ input channels, which is also equal to the number of channels in the convolutional kernels.
474
+
475
+ Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
476
+ output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
477
+ kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
478
+ channel in the :math:`i`-th batch of the input feature map.
479
+
480
+ The shape of the convolutional kernel is given by :math:`(kd, kh, kw)` where :math:`kd` , :math:`kd` and\
481
+ :math:`kw` are the depth, height and width of the kernel, respectively.
482
+ If we consider the input and output channels as well as the `group` parameter, the complete kernel shape
483
+ will be :math:`(C_{out}, C_{in} / \text{group}, kd, kh, kw)`,
484
+ where `group` is the number of groups dividing `x`'s input channel when applying group convolution.
485
+
486
+ For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
487
+ <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
488
+
489
+ The following lists some of the limitations of the parameters.
490
+
491
+ - input -- The input to the conv3d. The input must have each dimension size within the range [1, int32_max].
492
+ - weight -- Filters of shape :math:`(C_{out}, C_{in} / groups, kd, kh, kw)`. The value of :math:`kh`
493
+ and :math:`kw` is in the range [1, 511]. The remaining values are in the range [1, int32_max].
494
+ And :math:`kh*kw*k0` is less 65536 (k0 is 16. If data type is float32, k0 is 8).
495
+ - bias -- Bias Tensor with shape :math:`(C_{out})`. The shape must equal to the first dimension of the weight.
496
+ - stride -- The distance of kernel moving. It can be an int number or
497
+ tuple (noted by :math:`(stride_d, stride_h, stride_w)`). stride_h and stride_w are in the range [1, 63].
498
+ stride_d is in the range [1, 255].
499
+ - padding -- If padding is an int number, it is in the range [0, 255].
500
+ - dilation -- The value is in the range [1, 255].
501
+ - groups -- The value is in the range [1, 65535].
502
+ - :math:`C_{in} \% \text{groups} == 0 \quad \text{and} \quad C_{out} \% \text{groups} == 0` .
503
+ - :math:`weight[1] == C_{in} / groups` .
504
+ - :math:`H_{in} + PadUp + PadDown >= (kh - 1) * DilationH + 1` .
505
+ - :math:`W_{in} + PadLeft + PadRight >= (kw - 1) * DilationW + 1` .
506
+ - :math:`D_{in} + PadFront + PadBack >= (kd - 1) * DilationD + 1` .
507
+ - :math:`H_{out} = (H_{in} + PadUp + PadDown - ((kh - 1) * DilationH + 1)) / StrideH + 1` .
508
+ - :math:`W_{out} = (W_{in} + PadLeft + PadRight - ((kw - 1) * DilationW + 1)) / StrideW + 1` .
509
+ - :math:`D_{out} = (D_{in} + PadFront + PadBack - ((kd - 1) * DilationD + 1)) / StrideD + 1` .
510
+ - :math:`(D_{in}+PadFront+PadBack - ((kd-1)*DilationD+1)) \% StrideD <= PadBack` .
511
+ - :math:`(H_{in}+PadUp+PadDown - ((kh-1)*Dilationh+1)) \% StrideH <= PadDown` .
512
+ - :math:`stride_d <= kernel_d` .
513
+ - :math:`PadUp < kh` and :math:`PadDown < kh` . When `padding` = ``'valid'``, both PadUp and PadDown are zeros.
514
+ When `padding` = ``'same'``, pad can be calculated by
515
+ :math:`floor(((H_{out}-1) * strideH + (kh - 1) * DilationH + 1 - H_{in}) / 2)` for high dimension.
516
+ It is similar way to calculate the padding for depth and width dimension. And the depth and width
517
+ dimensions also have the same constraints.
518
+ - :math:`((kh - 1) * DilationH - PadUp)` should be in [0, 255]. It is the same constraint for depth
519
+ and width dimension.
520
+ - If `padding` is ``'same'``, `stride` must be 1.
521
+
522
+ .. warning::
523
+ It is only supported on Atlas A2 Training Series Products.
524
+
525
+ Args:
526
+ input (Tensor): Tensor of shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})`.
527
+ weight (Tensor): Set size of kernel is :math:`(kd, kh,
528
+ kw)`, then the shape is :math:`(C_{out}, C_{in} / groups, kd, kh, kw)`.
529
+ bias (Tensor, optional): Bias Tensor with shape :math:`(C_{out})`.
530
+ When bias is ``None`` , zeros will be used. Default: ``None`` .
531
+ stride (Union(int, tuple[int], list[int]), optional): The distance of kernel moving, an int
532
+ number that represents the depth, the height and width of movement are both strides, or a
533
+ tuple of triple int numbers that
534
+ represent the depth, height and width of movement respectively. Default: ``1`` .
535
+ padding (Union(int, tuple[int], list[int], str), optional): Implicit paddings on both sides of the input `x`.
536
+ Can be a string, one integer or a tuple/list with 3 integers.
537
+ If `padding` is a string, the optional values are ``"same"`` , ``"valid"``.
538
+
539
+ - same: Adopts the way of completion. The height and width of the output will be equal to
540
+ the input `x` divided by stride. The padding will be evenly calculated in top and bottom,
541
+ left and right possiblily. Otherwise, the last extra padding will be calculated from the bottom
542
+ and the right side. If this mode is set, `stride` must be 1.
543
+
544
+ - valid: Adopts the way of discarding. The possible largest height and width of output will be returned
545
+ without padding. Extra pixels will be discarded.
546
+
547
+ If `padding` is one integer, the paddings of top, bottom, left and right are the same, equal to padding.
548
+ If `padding` is a tuple/list with 3 integers, the padding of head, tail, top, bottom,
549
+ left and right equal to pad[0], pad[0], pad[1], pad[1], pad[2] and pad[2] correspondingly. Default: ``0`` .
550
+ dilation (Union[int, tuple[int], list[int]], optional): Controlling the space between the kernel points.
551
+ Default: ``1`` .
552
+ groups (int, optional): Splits `input` into groups. Default: ``1`` .
553
+
554
+ Returns:
555
+ Tensor, the same dtype as the `input`, with the shape :math:`(N, C_{out}, D_{out}, H_{out}, W_{out})`
556
+ or :math:`(C_{out}, D_{out}, H_{out}, W_{out})`.
557
+
558
+ Raises:
559
+ TypeError: If `stride`, `padding` or `dilation` is neither an int nor a tuple.
560
+ TypeError: `groups` is not an int.
561
+ TypeError: If `bias` is not a Tensor.
562
+
563
+ Supported Platforms:
564
+ ``Ascend``
565
+
566
+ Examples:
567
+ >>> import mindspore
568
+ >>> import numpy as np
569
+ >>> from mindspore import mint
570
+ >>> x = mindspore.Tensor(np.random.randn(12, 1, 60, 50, 8), mindspore.float16)
571
+ >>> w = mindspore.Tensor(np.random.randn(26, 1, 2, 4, 4), mindspore.float16)
572
+ >>> out = mint.nn.functional.conv3d(x, w)
573
+ >>> print(out.shape)
574
+ (12, 26, 59, 47, 5)
575
+ """
576
+ return _conv3d_instance(*args, **kwargs)
577
+
578
+
379
579
  def div(*args, **kwargs):
380
580
  r"""
381
581
  div(input, other, *, rounding_mode=None) -> Tensor
@@ -389,7 +589,7 @@ def div(*args, **kwargs):
389
589
  .. note::
390
590
  - When the two inputs have different shapes, they must be able to broadcast to a common shape.
391
591
  - The two inputs can not be bool type at the same time,
392
- [True, Tensor(True, bool\_), Tensor(np.array([True]), bool\_)] are all considered bool type.
592
+ [True, Tensor(True), Tensor(np.array([True]))] are all considered bool type.
393
593
  - The two inputs comply with the implicit type conversion rules to make the data types
394
594
  consistent.
395
595
 
@@ -441,9 +641,106 @@ def divide(*args, **kwargs):
441
641
  return _div_instance(*args, **kwargs)
442
642
 
443
643
 
644
+ def einsum(*args, **kwargs):
645
+ r"""
646
+ According to the Einstein summation Convention (Einsum),
647
+ the product of the input tensor elements is summed along the specified dimension.
648
+ You can use this operator to perform diagonal, reducesum, transpose, matmul, mul, inner product operations, etc.
649
+
650
+ Note:
651
+ The sublist format is also supported. For example, einsum_ext(op1, sublist1, op2, sublist2, ..., sublist_out).
652
+ In this format, equation can be derived by the sublists which are made up of Python's Ellipsis and list of
653
+ integers in [0, 52). Each operand is followed by a sublist and an output sublist is at the end.
654
+ Dynamic shape, dynamic rank input is not supported in `graph mode (mode=mindspore.GRAPH_MODE)
655
+ <https://www.mindspore.cn/tutorials/en/master/compile/static_graph.html>`_.
656
+
657
+ .. warning::
658
+ This is an experimental API that is subject to change or deletion.
659
+
660
+ Args:
661
+ equation (str): Notation based on the Einstein summation convention, represent the operation you want to do.
662
+ the value can contain only letters, commas, ellipsis and arrow. The letters(must be in [a-zA-Z]) represent
663
+ input tensor dimension, commas(,) represent separate tensors, ellipsis indicates the tensor dimension that
664
+ you do not care about, the left of the arrow indicates the input tensors, and the right of it indicates the
665
+ desired output dimension. If there are no arrows in the equation, the letters that appear exactly once in
666
+ the equation will be part of the output, sorted in increasing alphabetical order. The output is computed by
667
+ multiplying the input operands element-wise, with their dimensions aligned based on the letters, and then
668
+ summing out the dimensions whose letters are not part of the output. If there is one arrow in the equation,
669
+ the output letters must appear at least once for some input operand and at most once for the output.
670
+ operands (Tensor): Input tensor used for calculation. The dtype of the tensor must be the same.
671
+
672
+ Returns:
673
+ Tensor, the shape of it can be obtained from the `equation` , and the dtype is the same as input tensors.
674
+
675
+ Raises:
676
+ TypeError: If `equation` is invalid, or the `equation` does not match the input tensor.
677
+ ValueError: If the number in sublist is not in [0, 52) in sublist format.
678
+
679
+ Supported Platforms:
680
+ ``Ascend``
681
+
682
+ Examples:
683
+ >>> import mindspore
684
+ >>> import numpy as np
685
+ >>> from mindspore import Tensor, ops
686
+ >>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
687
+ >>> equation = "i->"
688
+ >>> output = ops.einsum_ext(equation, x)
689
+ >>> print(output)
690
+ 7.0
691
+ >>> x = Tensor(np.array([1.0, 2.0, 4.0]), mindspore.float32)
692
+ >>> y = Tensor(np.array([2.0, 4.0, 3.0]), mindspore.float32)
693
+ >>> equation = "i,i->i"
694
+ >>> output = ops.einsum_ext(equation, x, y)
695
+ >>> print(output)
696
+ [ 2. 8. 12.]
697
+ >>> x = Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]), mindspore.float32)
698
+ >>> y = Tensor(np.array([[2.0, 3.0], [1.0, 2.0], [4.0, 5.0]]), mindspore.float32)
699
+ >>> equation = "ij,jk->ik"
700
+ >>> output = ops.einsum_ext(equation, x, y)
701
+ >>> print(output)
702
+ [[16. 22.]
703
+ [37. 52.]]
704
+ >>> x = Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]), mindspore.float32)
705
+ >>> equation = "ij->ji"
706
+ >>> output = ops.einsum_ext(equation, x)
707
+ >>> print(output)
708
+ [[1. 4.]
709
+ [2. 5.]
710
+ [3. 6.]]
711
+ >>> x = Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]), mindspore.float32)
712
+ >>> equation = "ij->j"
713
+ >>> output = ops.einsum_ext(equation, x)
714
+ >>> print(output)
715
+ [5. 7. 9.]
716
+ >>> x = Tensor(np.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]), mindspore.float32)
717
+ >>> equation = "...->"
718
+ >>> output = ops.einsum_ext(equation, x)
719
+ >>> print(output)
720
+ 21.0
721
+ >>> x = Tensor(np.array([1.0, 2.0, 3.0]), mindspore.float32)
722
+ >>> y = Tensor(np.array([2.0, 4.0, 1.0]), mindspore.float32)
723
+ >>> equation = "j,i->ji"
724
+ >>> output = ops.einsum_ext(equation, x, y)
725
+ >>> print(output)
726
+ [[ 2. 4. 1.]
727
+ [ 4. 8. 2.]
728
+ [ 6. 12. 3.]]
729
+ >>> x = mindspore.Tensor([1, 2, 3, 4], mindspore.float32)
730
+ >>> y = mindspore.Tensor([1, 2], mindspore.float32)
731
+ >>> output = ops.einsum_ext(x, [..., 1], y, [..., 2], [..., 1, 2])
732
+ >>> print(output)
733
+ [[1. 2.]
734
+ [2. 4.]
735
+ [3. 6.]
736
+ [4. 8.]]
737
+ """
738
+ return _einsum_instance(*args, **kwargs)
739
+
740
+
444
741
  def empty(*args, **kwargs):
445
742
  r"""
446
- empty(*size, dtype=None, device=None) -> Tensor
743
+ empty(*size, *, dtype=None, device=None) -> Tensor
447
744
 
448
745
  Creates a tensor with uninitialized data, whose shape, dtype and device are described by the argument `size`,
449
746
  `dtype` and `device` respectively.
@@ -453,22 +750,23 @@ def empty(*args, **kwargs):
453
750
 
454
751
  Args:
455
752
  size (Union[tuple[int], list[int], int]): The specified shape of output tensor. Can be variable numbers of
456
- positive integers or tupled or list containing positive integers.
753
+ positive integers or tuple or list containing positive integers.
457
754
 
458
755
  Keyword Args:
459
756
  dtype (:class:`mindspore.dtype`, optional): The specified type of output tensor. If `dtype` is ``None`` ,
460
757
  `mindspore.float32` will be used. Default: ``None`` .
461
- device (string, optional): The specified device of the output tensor. Support ``CPU`` and ``Ascend``. If
462
- `device = None`, `mindspore.context.device_target` will be used. Default ``None``.
758
+ device (string, optional): The specified device of the output tensor. In PyNative mode, ``"Ascend"``, ``"npu"``,
759
+ ``"cpu"`` and ``"CPU"`` are supported. In graph mode O0, ``"Ascend"`` and ``"npu"`` are supported. If `device = None`,
760
+ `mindspore.context.device_target` will be used. Default ``None``.
463
761
 
464
762
  Returns:
465
- Tensor, whose dtype and size are defined by input.
763
+ Tensor, whose shape, dtype and device are defined by input.
466
764
 
467
765
  Raises:
468
766
  TypeError: If `size` is neither an int nor a tuple or list of int.
469
767
 
470
768
  Supported Platforms:
471
- ``Ascend``
769
+ ``Ascend`` ``CPU``
472
770
 
473
771
  Examples:
474
772
  >>> import mindspore
@@ -481,8 +779,55 @@ def empty(*args, **kwargs):
481
779
  return _empty_instance(*args, **kwargs)
482
780
 
483
781
 
782
+ def empty_like(*args, **kwargs):
783
+ r"""
784
+ empty_like(input, *, dtype=None, device=None) -> Tensor
785
+
786
+ Returns an uninitialized Tensor with the same shape as the `input`. Its dtype is specified by `dtype` and its
787
+ device is specified by `device`.
788
+
789
+ .. warning::
790
+ This is an experimental API that is subject to change or deletion.
791
+
792
+ Args:
793
+ input (Tensor): Tensor of any dimension.
794
+
795
+ Keyword Args:
796
+ dtype (:class:`mindspore.dtype`, optional): The specified dtype of the output tensor. If `dtype = None`, the
797
+ tensor will have the same dtype as input `input`. Default ``None``.
798
+ device (string, optional): The specified device of the output tensor. In PyNative mode, ``"Ascend"``, ``"npu"``,
799
+ ``"cpu"`` and ``"CPU"`` are supported. In graph mode O0, ``"Ascend"`` and ``"npu"`` are supported. If `device = None`,
800
+ the value set by :func:`mindspore.set_device` will be used. Default ``None``.
801
+
802
+ Returns:
803
+ Tensor, has the same shape, type and device as `input` but with uninitialized data (May be a random value).
804
+
805
+ Raises:
806
+ TypeError: If `input` is not a Tensor.
807
+
808
+ Supported Platforms:
809
+ ``Ascend`` ``CPU``
810
+
811
+ Examples:
812
+ >>> import mindspore
813
+ >>> from mindspore import ops, Tensor
814
+ >>> x = Tensor([[1, 2, 3], [4, 5, 6]])
815
+ >>> output1 = ops.empty_like(x)
816
+ >>> print(output1)
817
+ [[0 0 0]
818
+ [0 0 0]]
819
+ >>> output2 = ops.empty_like(x, dtype=mindspore.float64)
820
+ >>> print(output2)
821
+ [[0. 0. 0.]
822
+ [0. 0. 0.]]
823
+ """
824
+ return _empty_like_instance(*args, **kwargs)
825
+
826
+
484
827
  def floor_divide(*args, **kwargs):
485
828
  r"""
829
+ floor_divide(input, other) -> Tensor
830
+
486
831
  Divides the first input tensor by the second input tensor element-wise and round down to the closest integer.
487
832
 
488
833
  Inputs of `input` and `other` comply with the implicit type conversion rules to make the data types consistent.
@@ -772,10 +1117,10 @@ def greater_equal(*args, **kwargs):
772
1117
 
773
1118
  Args:
774
1119
  input (Union[Tensor, Number]): The first input is a number
775
- or a tensor whose data type is `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_ or `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_.
1120
+ or a tensor whose data type is `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_ or `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html#mindspore.dtype>`_.
776
1121
  other (Union[Tensor, Number]): Second input. When the first input is a Tensor, the second input should be a Number,
777
- or a Tensor of the number or bool_ data type. When the first input is a Scalar,
778
- the second input must be a Tensor of number or bool_ data type.
1122
+ or a Tensor of the number or bool data type. When the first input is a Scalar,
1123
+ the second input must be a Tensor of number or bool data type.
779
1124
 
780
1125
  Returns:
781
1126
  Tensor, the shape is the same as the one after broadcasting, and the data type is bool.
@@ -812,6 +1157,60 @@ def ge(*args, **kwargs):
812
1157
  return _greater_equal_instance(*args, **kwargs)
813
1158
 
814
1159
 
1160
+ def index_add(*args, **kwargs):
1161
+ r"""
1162
+ index_add(input, dim, index, source, *, alpha=1) -> Tensor
1163
+
1164
+ Accumulate the elements of `alpha` times `source` into the `input` by adding to the index in the order given in `index`. For example, if ``dim == 0`` , ``index[i] == j`` , and ``alpha = -1`` , then the `i` th row of `source` is subtracted from the `j` th row of `input` . The `dim` th dimension of `source` must have the same size as the length of `index` , and all other dimensions must match `input`, or an error will be raised. For a 3-D tensor, the output is defined as follows:
1165
+
1166
+ .. math::
1167
+ \begin{array}{ll}
1168
+ input[index[i],\ :,\ :]\ +=\ alpha * source[i,\ :,\ :] \qquad \#if\ dim == 0 \\
1169
+ input[:,\ \ index[i],\ :]\ +=\ alpha * source[:,\ \ i,\ :] \qquad \#if\ dim == 1 \\
1170
+ input[:,\ :,\ \ index[i]]\ +=\ alpha * source[:,\ :,\ \ i] \qquad\#if\ dim == 2 \\
1171
+ \end{array}
1172
+
1173
+ .. warning::
1174
+ This is an experimental API that is subject to change or deletion.
1175
+
1176
+ Args:
1177
+ input (Tensor): The input Tensor.
1178
+ dim (int): The dimension along which to index.
1179
+ index (Tensor): Add the value of "input Tensor" and `source` along the dimension of the `dim` according to the specified index value, with data type int32. The `index` must be 1D with the same size as the size of `source` in the `dim` dimension. The values of `index` should be in [0, b), where the b is the size of "input Tensor" in the `dim` dimension.
1180
+ source (Tensor): The input tensor with the value to add. Must have same data type as "input Tensor". The shape must be the same as "input Tensor" except the `dim` th dimension.
1181
+
1182
+ Keyword Args:
1183
+ alpha (number, optional): The scalar multiplier for source. Default: ``1``.
1184
+
1185
+ Returns:
1186
+ Tensor, has the same shape and dtype as `input`.
1187
+
1188
+ Raises:
1189
+ TypeError: If neither `index` nor `source` is a Tensor.
1190
+ ValueError: If the value of `dim` is out of the dimension range of `source` shape.
1191
+ ValueError: If `index` rank is not the same as `source` rank.
1192
+ ValueError: If shape of `index` is not 1D or size of `index` is not equal to dimension of source[dim].
1193
+ ValueError: If the shape of `source` is not the same as that of `input` except the `dim` axis.
1194
+
1195
+ Supported Platforms:
1196
+ ``Ascend``
1197
+
1198
+ Examples:
1199
+ >>> import numpy as np
1200
+ >>> import mindspore
1201
+ >>> from mindspore import Tensor, mint
1202
+ >>> x = Tensor(np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]), mindspore.float32)
1203
+ >>> index = Tensor(np.array([0, 2]), mindspore.int32)
1204
+ >>> y = Tensor(np.array([[0.5, 1.0], [1.0, 1.5], [2.0, 2.5]]), mindspore.float32)
1205
+ >>> output = mint.index_add(x, 1, index, y, alpha=1)
1206
+ >>> print(output)
1207
+ [[ 1.5 2. 4. ]
1208
+ [ 5. 5. 7.5]
1209
+ [ 9. 8. 11.5]]
1210
+ """
1211
+ return _index_add_instance(*args, **kwargs)
1212
+
1213
+
815
1214
  def kthvalue(*args, **kwargs):
816
1215
  r"""
817
1216
  Calculates the kth smallest value along given dim specified by `dim` of the input
@@ -1256,6 +1655,60 @@ def pixel_shuffle(*args, **kwargs):
1256
1655
  return _pixel_shuffle_instance(*args, **kwargs)
1257
1656
 
1258
1657
 
1658
+ def quant_matmul(*args, **kwargs):
1659
+ r"""
1660
+ quant_matmul(x1, x2, scale, *, offset=None, pertoken_scale=None, bias=None, output_dtype=None, x1_dtype=None, x2_dtype=None, pertoken_scale_dtype=None, scale_dtype=None, group_sizes=None) -> Tensor
1661
+
1662
+ Used for quantized matrix multiplication.
1663
+
1664
+ .. warning::
1665
+ This is an experimental API that is subject to change or deletion.
1666
+ Only support on David training series.
1667
+
1668
+ Args:
1669
+ x1 (Tensor): Tensor of shape :math:`(*, M, K)` . The dimension of `input` should be in [2, 6].
1670
+ x2 (Tensor): Tensor of shape :math:`(*, K, N)` . The dimension of `input` should be in [2, 6].
1671
+ scale (Tensor): Tensor of shape :math:`(T,)` . T should be equal to 1 or N, N is the last dimension of `x2`.
1672
+
1673
+ Keyword Args:
1674
+ offset (Tensor, optional): Tensor of shape :math:`(T,)` . T should be equal to 1 or N, N is the last dimension of `x2`. Default: ``None`` .
1675
+ pertoken_scale (Tensor, optional): Tensor of shape :math:`(M,)` . M is second-to-last dimension of `x1`. Default: ``None`` .
1676
+ A valid Tensor must deliver to `pertoken_scale` , ``None`` will cause unexpected error.
1677
+ bias (Tensor, optional): Tensor of shape :math:`(N,)` or :math:`(B, 1, N)` , N is the last dimension of `x2`.
1678
+ If dimension of `output` is 2, 4, 5 or 6, `bias` must has shape :math:`(N,)` . Default: ``None`` .
1679
+ output_dtype (:class:`mindspore.dtype`, optional): the dtype of `output`. Default: ``None`` .
1680
+ x1_dtype (:class:`mindspore.dtype`, optional): Cast `x1` to `x1_dtype` before calculation. Default: ``None`` .
1681
+ x2_dtype (:class:`mindspore.dtype`, optional): Cast `x2` to `x2_dtype` before calculation. Default: ``None`` .
1682
+ pertoken_scale_dtype (:class:`mindspore.dtype`, optional): Cast `pertoken_scale` to `pertoken_scale_dtype` before calculation. Default: ``None`` .
1683
+ scale_dtype (:class:`mindspore.dtype`, optional): Cast `scale` to `scale_dtype` before calculation. Default: ``None`` .
1684
+ group_sizes (Union[tuple(int), list(int)], optional): A sequence of int elements. Must have 3 elements. Default: ``None`` .
1685
+
1686
+ Returns:
1687
+ Tensor of shape :math:`(*, M, N)` .
1688
+
1689
+ Raises:
1690
+ ValueError: If dtype of `x1` is int8 or int32.
1691
+
1692
+ Supported Platforms:
1693
+ ``Ascend``
1694
+
1695
+ Examples:
1696
+ >>> import numpy as np
1697
+ >>> import mindspore as ms
1698
+ >>> from mindspore import ops, Tensor
1699
+ >>> x1 = Tensor(np.random.randn(2, 3, 4), ms.float8_e4m3)
1700
+ >>> x2 = Tensor(np.random.randn(2, 4, 5), ms.float8_e4m3)
1701
+ >>> scale = Tensor(np.random.randn(1,), ms.float32)
1702
+ >>> pertoken_scale = Tensor(np.random.randn(3,), ms.float32)
1703
+ >>> output = ops.auto_generate.quant_matmul(x1, x2, scale, pertoken_scale=pertoken_scale, output_dtype=ms.bfloat16)
1704
+ >>> print(output.shape)
1705
+ (2, 3, 5)
1706
+ >>> print(output.dtype)
1707
+ BFloat16
1708
+ """
1709
+ return _quant_matmul_instance(*args, **kwargs)
1710
+
1711
+
1259
1712
  def remainder(*args, **kwargs):
1260
1713
  r"""
1261
1714
  remainder(input, other) -> Tensor
@@ -1276,10 +1729,10 @@ def remainder(*args, **kwargs):
1276
1729
  input (Union[Tensor, numbers.Number, bool]): The dividend is a numbers.Number or
1277
1730
  a bool or a tensor whose data type is
1278
1731
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
1279
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1732
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1280
1733
  other (Union[Tensor, numbers.Number, bool]): The divisor is a numbers.Number or
1281
- a bool or a tensor whose data type is number or bool\_ when the dividend is a tensor.
1282
- When the dividend is Scalar, the divisor must be a Tensor whose data type is number or bool\_.
1734
+ a bool or a tensor whose data type is number or bool when the dividend is a tensor.
1735
+ When the dividend is Scalar, the divisor must be a Tensor whose data type is number or bool.
1283
1736
 
1284
1737
  Returns:
1285
1738
  Tensor, with dtype promoted and shape broadcasted.
@@ -1347,6 +1800,13 @@ def repeat_interleave(*args, **kwargs):
1347
1800
  return _repeat_interleave_instance(*args, **kwargs)
1348
1801
 
1349
1802
 
1803
+ def rmod(*args, **kwargs):
1804
+ r"""
1805
+ rmod(input, other) -> Tensor
1806
+ """
1807
+ return _rmod_instance(*args, **kwargs)
1808
+
1809
+
1350
1810
  def sub(*args, **kwargs):
1351
1811
  r"""
1352
1812
  sub(input, other, *, alpha=1) -> Tensor
@@ -1366,10 +1826,10 @@ def sub(*args, **kwargs):
1366
1826
  Args:
1367
1827
  input (Union[Tensor, number.Number, bool]): `input` is a number.Number or a bool or a tensor whose data type is
1368
1828
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
1369
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1829
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1370
1830
  other (Union[Tensor, number.Number, bool]): `other` is a number.Number or a bool or a tensor whose data type is
1371
1831
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
1372
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1832
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1373
1833
 
1374
1834
  Keyword Args:
1375
1835
  alpha (number.Number, optional): A scaling factor applied to `other`, default ``1``.
@@ -1485,7 +1945,7 @@ def xlogy(*args, **kwargs):
1485
1945
  input (Union[Tensor, numbers.Number, bool]): The first input is a numbers.Number or
1486
1946
  a bool or a tensor whose data type is
1487
1947
  `number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
1488
- `bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1948
+ `bool <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
1489
1949
  other (Union[Tensor, numbers.Number, bool]): The second input is a numbers.Number or
1490
1950
  a bool or a tensor whose data type is number or bool when the first input is a tensor.
1491
1951
  When the first input is Scalar, the second input must be a Tensor whose data type is number or bool.
@@ -1518,12 +1978,17 @@ __all__ = [
1518
1978
  "__add__",
1519
1979
  "addcdiv",
1520
1980
  "all_gather_matmul",
1981
+ "any",
1982
+ "bernoulli_",
1521
1983
  "bitwise_not",
1522
1984
  "clamp",
1523
1985
  "clip",
1986
+ "conv3d",
1524
1987
  "div",
1525
1988
  "divide",
1989
+ "einsum",
1526
1990
  "empty",
1991
+ "empty_like",
1527
1992
  "floor_divide",
1528
1993
  "fmod",
1529
1994
  "gelu",
@@ -1532,6 +1997,7 @@ __all__ = [
1532
1997
  "gmm_backward_fusion",
1533
1998
  "greater_equal",
1534
1999
  "ge",
2000
+ "index_add",
1535
2001
  "kthvalue",
1536
2002
  "lerp",
1537
2003
  "matmul_reduce_scatter",
@@ -1539,8 +2005,10 @@ __all__ = [
1539
2005
  "min",
1540
2006
  "nansum",
1541
2007
  "pixel_shuffle",
2008
+ "quant_matmul",
1542
2009
  "remainder",
1543
2010
  "repeat_interleave",
2011
+ "rmod",
1544
2012
  "sub",
1545
2013
  "__sub__",
1546
2014
  "where",