mindspore 2.7.0rc1__cp311-cp311-win_amd64.whl → 2.7.1__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mindspore might be problematic. Click here for more details.

Files changed (370) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +5 -2
  3. mindspore/_c_dataengine.cp311-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp311-win_amd64.pyd +0 -0
  6. mindspore/_checkparam.py +2 -2
  7. mindspore/_extends/builtin_operations.py +3 -3
  8. mindspore/_extends/parallel_compile/akg_compiler/custom.py +1109 -0
  9. mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
  10. mindspore/_extends/parse/__init__.py +3 -3
  11. mindspore/_extends/parse/compile_config.py +24 -1
  12. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +6 -3
  13. mindspore/_extends/parse/parser.py +28 -22
  14. mindspore/_extends/parse/resources.py +1 -1
  15. mindspore/_extends/parse/standard_method.py +23 -2
  16. mindspore/_extends/parse/trope.py +2 -1
  17. mindspore/_extends/pijit/pijit_func_white_list.py +9 -27
  18. mindspore/amp.py +0 -18
  19. mindspore/avcodec-59.dll +0 -0
  20. mindspore/avdevice-59.dll +0 -0
  21. mindspore/avfilter-8.dll +0 -0
  22. mindspore/avformat-59.dll +0 -0
  23. mindspore/avutil-57.dll +0 -0
  24. mindspore/boost/base.py +29 -2
  25. mindspore/common/__init__.py +18 -12
  26. mindspore/common/_decorator.py +3 -2
  27. mindspore/common/_grad_function.py +3 -1
  28. mindspore/common/_tensor_cpp_method.py +1 -1
  29. mindspore/common/_tensor_docs.py +371 -96
  30. mindspore/common/_utils.py +7 -43
  31. mindspore/common/api.py +434 -135
  32. mindspore/common/dtype.py +98 -57
  33. mindspore/common/dump.py +7 -108
  34. mindspore/common/dynamic_shape/__init__.py +0 -0
  35. mindspore/common/{auto_dynamic_shape.py → dynamic_shape/auto_dynamic_shape.py} +15 -23
  36. mindspore/common/dynamic_shape/enable_dynamic.py +197 -0
  37. mindspore/common/file_system.py +59 -9
  38. mindspore/common/hook_handle.py +82 -3
  39. mindspore/common/jit_config.py +5 -1
  40. mindspore/common/jit_trace.py +27 -12
  41. mindspore/common/lazy_inline.py +5 -3
  42. mindspore/common/np_dtype.py +3 -3
  43. mindspore/common/parameter.py +17 -127
  44. mindspore/common/recompute.py +4 -13
  45. mindspore/common/tensor.py +50 -217
  46. mindspore/communication/_comm_helper.py +11 -1
  47. mindspore/communication/comm_func.py +138 -4
  48. mindspore/communication/management.py +85 -1
  49. mindspore/config/op_info.config +0 -15
  50. mindspore/context.py +20 -106
  51. mindspore/dataset/__init__.py +1 -1
  52. mindspore/dataset/audio/transforms.py +1 -1
  53. mindspore/dataset/core/config.py +35 -1
  54. mindspore/dataset/engine/datasets.py +338 -319
  55. mindspore/dataset/engine/datasets_user_defined.py +38 -22
  56. mindspore/dataset/engine/datasets_vision.py +1 -1
  57. mindspore/dataset/engine/validators.py +1 -15
  58. mindspore/dataset/transforms/c_transforms.py +2 -2
  59. mindspore/dataset/transforms/transforms.py +3 -3
  60. mindspore/dataset/vision/__init__.py +1 -1
  61. mindspore/dataset/vision/py_transforms.py +8 -8
  62. mindspore/dataset/vision/transforms.py +17 -5
  63. mindspore/dataset/vision/utils.py +632 -21
  64. mindspore/device_context/ascend/op_tuning.py +35 -1
  65. mindspore/dnnl.dll +0 -0
  66. mindspore/{profiler/common/validator → graph}/__init__.py +9 -1
  67. mindspore/graph/custom_pass.py +55 -0
  68. mindspore/include/api/cell.h +28 -4
  69. mindspore/include/api/cfg.h +24 -7
  70. mindspore/include/api/context.h +1 -0
  71. mindspore/include/api/delegate.h +0 -2
  72. mindspore/include/api/dual_abi_helper.h +100 -19
  73. mindspore/include/api/graph.h +14 -1
  74. mindspore/include/api/kernel.h +16 -3
  75. mindspore/include/api/kernel_api.h +9 -1
  76. mindspore/include/api/metrics/accuracy.h +9 -0
  77. mindspore/include/api/model.h +5 -1
  78. mindspore/include/api/model_group.h +4 -0
  79. mindspore/include/api/model_parallel_runner.h +2 -0
  80. mindspore/include/api/status.h +48 -10
  81. mindspore/include/api/types.h +6 -1
  82. mindspore/include/dataset/constants.h +9 -0
  83. mindspore/include/dataset/execute.h +2 -2
  84. mindspore/jpeg62.dll +0 -0
  85. mindspore/mindrecord/__init__.py +3 -3
  86. mindspore/mindrecord/common/exceptions.py +1 -0
  87. mindspore/mindrecord/config.py +1 -1
  88. mindspore/{parallel/mpi → mindrecord/core}/__init__.py +4 -1
  89. mindspore/mindrecord/{shardheader.py → core/shardheader.py} +2 -1
  90. mindspore/mindrecord/{shardindexgenerator.py → core/shardindexgenerator.py} +1 -1
  91. mindspore/mindrecord/{shardreader.py → core/shardreader.py} +2 -1
  92. mindspore/mindrecord/{shardsegment.py → core/shardsegment.py} +2 -2
  93. mindspore/mindrecord/{shardutils.py → core/shardutils.py} +1 -1
  94. mindspore/mindrecord/{shardwriter.py → core/shardwriter.py} +1 -1
  95. mindspore/mindrecord/filereader.py +4 -4
  96. mindspore/mindrecord/filewriter.py +5 -5
  97. mindspore/mindrecord/mindpage.py +2 -2
  98. mindspore/mindrecord/tools/cifar10.py +4 -3
  99. mindspore/mindrecord/tools/cifar100.py +1 -1
  100. mindspore/mindrecord/tools/cifar100_to_mr.py +1 -1
  101. mindspore/mindrecord/tools/cifar10_to_mr.py +6 -6
  102. mindspore/mindrecord/tools/csv_to_mr.py +1 -1
  103. mindspore/mindrecord/tools/imagenet_to_mr.py +1 -1
  104. mindspore/mindrecord/tools/mnist_to_mr.py +1 -1
  105. mindspore/mindrecord/tools/tfrecord_to_mr.py +1 -1
  106. mindspore/mindspore_backend_common.dll +0 -0
  107. mindspore/mindspore_backend_manager.dll +0 -0
  108. mindspore/mindspore_cluster.dll +0 -0
  109. mindspore/mindspore_common.dll +0 -0
  110. mindspore/mindspore_core.dll +0 -0
  111. mindspore/mindspore_cpu.dll +0 -0
  112. mindspore/mindspore_dump.dll +0 -0
  113. mindspore/mindspore_frontend.dll +0 -0
  114. mindspore/mindspore_glog.dll +0 -0
  115. mindspore/mindspore_hardware_abstract.dll +0 -0
  116. mindspore/mindspore_memory_pool.dll +0 -0
  117. mindspore/mindspore_ms_backend.dll +0 -0
  118. mindspore/mindspore_ops.dll +0 -0
  119. mindspore/{mindspore_ops_host.dll → mindspore_ops_cpu.dll} +0 -0
  120. mindspore/mindspore_profiler.dll +0 -0
  121. mindspore/mindspore_pyboost.dll +0 -0
  122. mindspore/mindspore_pynative.dll +0 -0
  123. mindspore/mindspore_runtime_pipeline.dll +0 -0
  124. mindspore/mindspore_runtime_utils.dll +0 -0
  125. mindspore/mindspore_tools.dll +0 -0
  126. mindspore/mint/__init__.py +15 -10
  127. mindspore/mint/distributed/__init__.py +4 -0
  128. mindspore/mint/distributed/distributed.py +392 -69
  129. mindspore/mint/nn/__init__.py +2 -16
  130. mindspore/mint/nn/functional.py +4 -110
  131. mindspore/mint/nn/layer/__init__.py +0 -2
  132. mindspore/mint/nn/layer/_functions.py +1 -2
  133. mindspore/mint/nn/layer/activation.py +0 -6
  134. mindspore/mint/nn/layer/basic.py +0 -47
  135. mindspore/mint/nn/layer/conv.py +10 -10
  136. mindspore/mint/nn/layer/normalization.py +11 -16
  137. mindspore/mint/nn/layer/pooling.py +0 -4
  138. mindspore/nn/__init__.py +1 -3
  139. mindspore/nn/cell.py +231 -239
  140. mindspore/nn/layer/activation.py +4 -2
  141. mindspore/nn/layer/basic.py +56 -14
  142. mindspore/nn/layer/container.py +16 -0
  143. mindspore/nn/layer/embedding.py +4 -169
  144. mindspore/nn/layer/image.py +1 -1
  145. mindspore/nn/layer/normalization.py +2 -1
  146. mindspore/nn/layer/thor_layer.py +4 -85
  147. mindspore/nn/optim/ada_grad.py +0 -1
  148. mindspore/nn/optim/adafactor.py +0 -1
  149. mindspore/nn/optim/adam.py +32 -127
  150. mindspore/nn/optim/adamax.py +0 -1
  151. mindspore/nn/optim/asgd.py +0 -1
  152. mindspore/nn/optim/ftrl.py +8 -102
  153. mindspore/nn/optim/lamb.py +1 -4
  154. mindspore/nn/optim/lars.py +0 -3
  155. mindspore/nn/optim/lazyadam.py +25 -218
  156. mindspore/nn/optim/momentum.py +5 -43
  157. mindspore/nn/optim/optimizer.py +6 -55
  158. mindspore/nn/optim/proximal_ada_grad.py +0 -1
  159. mindspore/nn/optim/rmsprop.py +0 -1
  160. mindspore/nn/optim/rprop.py +0 -1
  161. mindspore/nn/optim/sgd.py +0 -1
  162. mindspore/nn/optim/tft_wrapper.py +2 -4
  163. mindspore/nn/optim/thor.py +0 -2
  164. mindspore/nn/probability/bijector/bijector.py +7 -8
  165. mindspore/nn/probability/bijector/gumbel_cdf.py +2 -2
  166. mindspore/nn/probability/bijector/power_transform.py +20 -21
  167. mindspore/nn/probability/bijector/scalar_affine.py +5 -5
  168. mindspore/nn/probability/bijector/softplus.py +13 -14
  169. mindspore/nn/probability/distribution/_utils/utils.py +2 -2
  170. mindspore/nn/wrap/cell_wrapper.py +39 -5
  171. mindspore/nn/wrap/grad_reducer.py +4 -89
  172. mindspore/numpy/array_creations.py +4 -4
  173. mindspore/numpy/fft.py +9 -9
  174. mindspore/numpy/utils_const.py +1 -1
  175. mindspore/{nn/reinforcement → onnx}/__init__.py +5 -8
  176. mindspore/onnx/onnx_export.py +137 -0
  177. mindspore/opencv_core4110.dll +0 -0
  178. mindspore/opencv_imgcodecs4110.dll +0 -0
  179. mindspore/{opencv_imgproc452.dll → opencv_imgproc4110.dll} +0 -0
  180. mindspore/ops/__init__.py +2 -0
  181. mindspore/ops/_grad_experimental/grad_comm_ops.py +38 -2
  182. mindspore/ops/_grad_experimental/grad_inner_ops.py +0 -9
  183. mindspore/ops/_op_impl/aicpu/__init__.py +0 -10
  184. mindspore/ops/_op_impl/cpu/__init__.py +1 -5
  185. mindspore/ops/_op_impl/cpu/{buffer_append.py → joinedstr_op.py} +8 -8
  186. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +28 -24
  187. mindspore/ops/auto_generate/gen_extend_func.py +6 -11
  188. mindspore/ops/auto_generate/gen_ops_def.py +385 -154
  189. mindspore/ops/auto_generate/gen_ops_prim.py +5676 -5167
  190. mindspore/ops/communication.py +97 -0
  191. mindspore/ops/composite/__init__.py +5 -2
  192. mindspore/ops/composite/base.py +16 -2
  193. mindspore/ops/composite/multitype_ops/__init__.py +3 -1
  194. mindspore/ops/composite/multitype_ops/_compile_utils.py +150 -8
  195. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  196. mindspore/ops/composite/multitype_ops/add_impl.py +7 -0
  197. mindspore/ops/composite/multitype_ops/mod_impl.py +27 -0
  198. mindspore/ops/function/__init__.py +2 -0
  199. mindspore/ops/function/array_func.py +24 -18
  200. mindspore/ops/function/comm_func.py +3883 -0
  201. mindspore/ops/function/debug_func.py +7 -6
  202. mindspore/ops/function/grad/grad_func.py +4 -12
  203. mindspore/ops/function/math_func.py +89 -86
  204. mindspore/ops/function/nn_func.py +92 -313
  205. mindspore/ops/function/random_func.py +9 -18
  206. mindspore/ops/functional.py +4 -1
  207. mindspore/ops/functional_overload.py +377 -30
  208. mindspore/ops/operations/__init__.py +2 -5
  209. mindspore/ops/operations/_custom_ops_utils.py +7 -9
  210. mindspore/ops/operations/_inner_ops.py +12 -50
  211. mindspore/ops/operations/_rl_inner_ops.py +0 -933
  212. mindspore/ops/operations/array_ops.py +5 -50
  213. mindspore/ops/operations/comm_ops.py +95 -17
  214. mindspore/ops/operations/custom_ops.py +237 -22
  215. mindspore/ops/operations/debug_ops.py +33 -35
  216. mindspore/ops/operations/manually_defined/ops_def.py +39 -318
  217. mindspore/ops/operations/math_ops.py +5 -5
  218. mindspore/ops/operations/nn_ops.py +3 -3
  219. mindspore/ops/operations/sparse_ops.py +0 -83
  220. mindspore/ops/primitive.py +4 -27
  221. mindspore/ops/tensor_method.py +88 -10
  222. mindspore/ops_generate/aclnn/aclnn_kernel_register_auto_cc_generator.py +5 -5
  223. mindspore/ops_generate/aclnn/gen_aclnn_implement.py +8 -8
  224. mindspore/ops_generate/api/functions_cc_generator.py +53 -4
  225. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +25 -11
  226. mindspore/ops_generate/common/gen_constants.py +11 -10
  227. mindspore/ops_generate/common/op_proto.py +18 -1
  228. mindspore/ops_generate/common/template.py +102 -245
  229. mindspore/ops_generate/common/template_utils.py +212 -0
  230. mindspore/ops_generate/gen_custom_ops.py +69 -0
  231. mindspore/ops_generate/op_def/ops_def_cc_generator.py +78 -7
  232. mindspore/ops_generate/op_def_py/base_op_prim_py_generator.py +360 -0
  233. mindspore/ops_generate/op_def_py/custom_op_prim_py_generator.py +140 -0
  234. mindspore/ops_generate/op_def_py/op_def_py_generator.py +54 -7
  235. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -312
  236. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +74 -17
  237. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +22 -5
  238. mindspore/ops_generate/pyboost/gen_pyboost_func.py +0 -16
  239. mindspore/ops_generate/pyboost/op_template_parser.py +3 -2
  240. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +21 -5
  241. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +2 -2
  242. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +30 -10
  243. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +10 -3
  244. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +1 -1
  245. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +19 -9
  246. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +71 -28
  247. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +10 -9
  248. mindspore/ops_generate/pyboost/pyboost_utils.py +27 -16
  249. mindspore/ops_generate/resources/yaml_loader.py +13 -0
  250. mindspore/ops_generate/tensor_py_cc_generator.py +2 -2
  251. mindspore/parallel/_auto_parallel_context.py +5 -15
  252. mindspore/parallel/_cell_wrapper.py +1 -1
  253. mindspore/parallel/_parallel_serialization.py +4 -6
  254. mindspore/parallel/_ps_context.py +2 -2
  255. mindspore/parallel/_utils.py +34 -17
  256. mindspore/parallel/auto_parallel.py +23 -9
  257. mindspore/parallel/checkpoint_transform.py +20 -2
  258. mindspore/parallel/cluster/process_entity/_api.py +28 -33
  259. mindspore/parallel/cluster/process_entity/_utils.py +9 -5
  260. mindspore/parallel/cluster/run.py +5 -3
  261. mindspore/{experimental/llm_boost/ascend_native → parallel/distributed}/__init__.py +21 -22
  262. mindspore/parallel/distributed/distributed_data_parallel.py +393 -0
  263. mindspore/parallel/distributed/flatten_grad_buffer.py +295 -0
  264. mindspore/parallel/function/reshard_func.py +6 -5
  265. mindspore/parallel/nn/parallel_cell_wrapper.py +40 -3
  266. mindspore/parallel/nn/parallel_grad_reducer.py +0 -8
  267. mindspore/parallel/shard.py +7 -21
  268. mindspore/parallel/strategy.py +336 -0
  269. mindspore/parallel/transform_safetensors.py +127 -20
  270. mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +13 -9
  271. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
  272. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +1 -1
  273. mindspore/profiler/common/constant.py +5 -0
  274. mindspore/profiler/common/file_manager.py +9 -0
  275. mindspore/profiler/common/msprof_cmd_tool.py +40 -4
  276. mindspore/profiler/common/path_manager.py +65 -24
  277. mindspore/profiler/common/profiler_context.py +27 -14
  278. mindspore/profiler/common/profiler_info.py +3 -3
  279. mindspore/profiler/common/profiler_meta_data.py +1 -0
  280. mindspore/profiler/common/profiler_op_analyse.py +10 -6
  281. mindspore/profiler/common/profiler_path_manager.py +13 -0
  282. mindspore/profiler/common/util.py +30 -3
  283. mindspore/profiler/dynamic_profiler.py +91 -46
  284. mindspore/profiler/envprofiler.py +30 -5
  285. mindspore/profiler/experimental_config.py +18 -2
  286. mindspore/profiler/platform/cpu_profiler.py +10 -4
  287. mindspore/profiler/platform/npu_profiler.py +34 -7
  288. mindspore/profiler/profiler.py +193 -145
  289. mindspore/profiler/profiler_action_controller.py +1 -1
  290. mindspore/profiler/profiler_interface.py +2 -2
  291. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  292. mindspore/run_check/_check_version.py +108 -24
  293. mindspore/runtime/__init__.py +9 -6
  294. mindspore/runtime/executor.py +35 -0
  295. mindspore/runtime/memory.py +113 -0
  296. mindspore/runtime/thread_bind_core.py +1 -1
  297. mindspore/swresample-4.dll +0 -0
  298. mindspore/swscale-6.dll +0 -0
  299. mindspore/tinyxml2.dll +0 -0
  300. mindspore/{experimental/llm_boost → tools}/__init__.py +5 -5
  301. mindspore/tools/data_dump.py +130 -0
  302. mindspore/tools/sdc_detect.py +91 -0
  303. mindspore/tools/stress_detect.py +63 -0
  304. mindspore/train/__init__.py +6 -6
  305. mindspore/train/_utils.py +8 -21
  306. mindspore/train/amp.py +6 -7
  307. mindspore/train/callback/_callback.py +2 -1
  308. mindspore/train/callback/_checkpoint.py +1 -17
  309. mindspore/train/callback/_flops_collector.py +10 -6
  310. mindspore/train/callback/_train_fault_tolerance.py +72 -25
  311. mindspore/train/data_sink.py +5 -9
  312. mindspore/train/dataset_helper.py +5 -5
  313. mindspore/train/model.py +41 -230
  314. mindspore/train/serialization.py +160 -401
  315. mindspore/train/train_thor/model_thor.py +2 -2
  316. mindspore/turbojpeg.dll +0 -0
  317. mindspore/utils/__init__.py +6 -3
  318. mindspore/utils/dlpack.py +92 -0
  319. mindspore/utils/dryrun.py +1 -1
  320. mindspore/utils/runtime_execution_order_check.py +10 -0
  321. mindspore/utils/sdc_detect.py +14 -12
  322. mindspore/utils/stress_detect.py +43 -0
  323. mindspore/utils/utils.py +152 -16
  324. mindspore/version.py +1 -1
  325. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/METADATA +3 -2
  326. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/RECORD +330 -344
  327. mindspore/_extends/remote/kernel_build_server_ascend.py +0 -75
  328. mindspore/communication/_hccl_management.py +0 -297
  329. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -207
  330. mindspore/experimental/llm_boost/ascend_native/llm_boost.py +0 -52
  331. mindspore/experimental/llm_boost/atb/__init__.py +0 -23
  332. mindspore/experimental/llm_boost/atb/boost_base.py +0 -385
  333. mindspore/experimental/llm_boost/atb/llama_boost.py +0 -137
  334. mindspore/experimental/llm_boost/atb/qwen_boost.py +0 -124
  335. mindspore/experimental/llm_boost/register.py +0 -130
  336. mindspore/experimental/llm_boost/utils.py +0 -31
  337. mindspore/include/OWNERS +0 -7
  338. mindspore/mindspore_cpu_res_manager.dll +0 -0
  339. mindspore/mindspore_ops_kernel_common.dll +0 -0
  340. mindspore/mindspore_res_manager.dll +0 -0
  341. mindspore/nn/optim/_dist_optimizer_registry.py +0 -111
  342. mindspore/nn/reinforcement/_batch_read_write.py +0 -142
  343. mindspore/nn/reinforcement/_tensors_queue.py +0 -152
  344. mindspore/nn/reinforcement/tensor_array.py +0 -145
  345. mindspore/opencv_core452.dll +0 -0
  346. mindspore/opencv_imgcodecs452.dll +0 -0
  347. mindspore/ops/_op_impl/aicpu/priority_replay_buffer.py +0 -113
  348. mindspore/ops/_op_impl/aicpu/reservoir_replay_buffer.py +0 -96
  349. mindspore/ops/_op_impl/aicpu/sparse_cross.py +0 -42
  350. mindspore/ops/_op_impl/cpu/buffer_get.py +0 -28
  351. mindspore/ops/_op_impl/cpu/buffer_sample.py +0 -28
  352. mindspore/ops/_op_impl/cpu/priority_replay_buffer.py +0 -42
  353. mindspore/ops/operations/_tensor_array.py +0 -359
  354. mindspore/ops/operations/rl_ops.py +0 -288
  355. mindspore/parallel/_offload_context.py +0 -275
  356. mindspore/parallel/_recovery_context.py +0 -115
  357. mindspore/parallel/_transformer/__init__.py +0 -35
  358. mindspore/parallel/_transformer/layers.py +0 -765
  359. mindspore/parallel/_transformer/loss.py +0 -251
  360. mindspore/parallel/_transformer/moe.py +0 -693
  361. mindspore/parallel/_transformer/op_parallel_config.py +0 -222
  362. mindspore/parallel/_transformer/transformer.py +0 -3124
  363. mindspore/parallel/mpi/_mpi_config.py +0 -116
  364. mindspore/profiler/common/validator/validate_path.py +0 -84
  365. mindspore/train/memory_profiling_pb2.py +0 -298
  366. mindspore/utils/hooks.py +0 -81
  367. /mindspore/common/{_auto_dynamic.py → dynamic_shape/_auto_dynamic.py} +0 -0
  368. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/WHEEL +0 -0
  369. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/entry_points.txt +0 -0
  370. {mindspore-2.7.0rc1.dist-info → mindspore-2.7.1.dist-info}/top_level.txt +0 -0
@@ -28,6 +28,7 @@ from mindspore.ops.operations import _sequence_ops as seq
28
28
  import mindspore.common.dtype as mstype
29
29
  from mindspore.ops.function.math_func import logsumexp, div
30
30
  from mindspore.ops.function.random_func import _get_seed, _set_prim_op_user_data
31
+ from mindspore.ops.functional_overload import conv2d as conv2d_op
31
32
  from mindspore.common.tensor import Tensor
32
33
  from mindspore._c_expression import TensorPy as Tensor_
33
34
  from mindspore.ops._primitive_cache import _get_cache_prim
@@ -41,7 +42,7 @@ from mindspore.ops.operations.nn_ops import TripletMarginLoss
41
42
  from mindspore.ops.operations._sequence_ops import TupleToTensor, TensorToTuple, ListToTensor
42
43
  from mindspore.common.api import _function_forbid_reuse
43
44
  from mindspore.ops.auto_generate import log_softmax, dense, prelu, celu, fast_gelu, silu, elu, sigmoid, relu6, \
44
- softmax_impl, swiglu, logsigmoid_op, kl_div_op, divs_op
45
+ softmax_impl, swiglu, logsigmoid_op, kl_div_op, divs_op, l1_loss_ext, inplace_sigmoid
45
46
  from mindspore.ops.auto_generate import relu_op, inplace_relu_op
46
47
  from mindspore.ops.auto_generate import group_norm_op, rms_norm, add_rms_norm, layer_norm_ext_op, batch_norm_ext_op,\
47
48
  mse_loss_ext
@@ -49,12 +50,12 @@ from mindspore.ops.auto_generate import group_norm_op, rms_norm, add_rms_norm, l
49
50
  from mindspore.ops.auto_generate import (reflection_pad_1d_op, reflection_pad_2d_op, add_layernorm_v2_op,
50
51
  reflection_pad_3d_op, # pylint: disable=W0611
51
52
  replication_pad_1d_op, replication_pad_2d_op, replication_pad_3d_op,
52
- constant_pad_nd_op, dropout_ext_op, reverse_v2_impl, avg_pool2d_op,
53
+ constant_pad_nd_op, func_dropout_ext_op, reverse_v2_impl, avg_pool2d_op,
53
54
  upsample_nearest1d_op, upsample_nearest2d_op, upsample_nearest3d_op,
54
55
  upsample_linear1d_op, upsample_bilinear2d_op, upsample_bicubic2d_op,
55
56
  upsample_trilinear3d_impl, fill_scalar_op, floor_op, nllloss_2d_op,
56
57
  masked_fill_op, masked_select, ones, flatten_ext, conv_transpose2d,
57
- func_max_pool2d_op)
58
+ func_max_pool2d_op, dropout2d_ext_op)
58
59
  # 2
59
60
  from mindspore.ops.auto_generate.pyboost_inner_prim import grid_sampler_2d_impl, grid_sampler_3d_impl
60
61
  # 3
@@ -92,16 +93,14 @@ from mindspore.ops.auto_generate import avg_pool3d_ext_op
92
93
  # 19
93
94
 
94
95
  # 20
95
- from mindspore.ops.functional_overload import conv3d as conv3d_op
96
96
  from mindspore.ops.auto_generate.gen_ops_prim import embedding_op, MaxPoolWithIndices, \
97
97
  PromptFlashAttention, MaxPoolWithMask
98
- from mindspore.ops.auto_generate.gen_ops_prim import conv2d_ext_op, \
99
- conv2d_padding_op, conv1d_ext_op, conv1d_padding_op, speed_fusion_attention_op
98
+ from mindspore.ops.auto_generate.gen_ops_prim import speed_fusion_attention_op
100
99
  from mindspore.common.generator import default_generator
101
100
  from mindspore.ops.auto_generate import hardshrink, hardsigmoid, hardswish
102
101
  from mindspore.ops.auto_generate import softshrink
103
102
  from mindspore.ops.auto_generate import soft_margin_loss
104
- from mindspore.ops.auto_generate import moe_token_permute, moe_token_unpermute
103
+ from mindspore.ops.auto_generate import moe_token_permute, moe_token_unpermute, ring_attention_update
105
104
  from mindspore.ops.auto_generate import adaptive_avg_pool2d_ext_op
106
105
  from mindspore.ops.auto_generate.pyboost_inner_prim import nllloss_impl
107
106
  from mindspore.ops.auto_generate.pyboost_inner_prim import adaptive_max_pool2d_impl
@@ -280,9 +279,6 @@ def adaptive_avg_pool2d_ext(input, output_size):
280
279
  * (w_{end}- w_{start})}
281
280
  \end{align}
282
281
 
283
- .. warning::
284
- This is an experimental API that is subject to change or deletion.
285
-
286
282
  Args:
287
283
  input (Tensor): The input of adaptive_avg_pool2d, which is a 3D or 4D tensor,
288
284
  with float16 or float32 data type.
@@ -952,7 +948,7 @@ def adaptive_max_pool1d(input, output_size):
952
948
  >>> import mindspore
953
949
  >>> import numpy as np
954
950
  >>> from mindspore import Tensor, ops
955
- >>> input = Tensor(np.random.randint(0, 10, [1, 3, 6]), mindspore.float32)
951
+ >>> input = Tensor(np.random.randint(0, 10, [1, 3, 6]), mindspore.float16)
956
952
  >>> output = ops.adaptive_max_pool1d(input, output_size=2)
957
953
  >>> print(output.shape)
958
954
  (1, 3, 2)
@@ -1623,7 +1619,6 @@ def dropout_ext(input, p=0.5, training=True, inplace=False):
1623
1619
  - **output** (Tensor) - Zeroed tensor, with the same shape and data type as `input`.
1624
1620
 
1625
1621
  Raises:
1626
- TypeError: If `p` is not a float.
1627
1622
  TypeError: If `input` is not a Tensor.
1628
1623
 
1629
1624
  Supported Platforms:
@@ -1637,16 +1632,8 @@ def dropout_ext(input, p=0.5, training=True, inplace=False):
1637
1632
  >>> print(output.shape)
1638
1633
  (2, 2)
1639
1634
  """
1640
- check_bool_const(training, "training", "dropout_ext")
1641
- check_bool_const(inplace, "inplace", "dropout_ext")
1642
- if not training:
1643
- return input
1644
1635
  seed, offset = default_generator._step(generator_step_) # pylint: disable=protected-access
1645
- out, _ = dropout_ext_op(input, p, seed, offset)
1646
- if inplace:
1647
- input.copy_(out)
1648
- return input
1649
- return out
1636
+ return func_dropout_ext_op(input, p, training, inplace, seed, offset)
1650
1637
 
1651
1638
 
1652
1639
  def dropout1d(input, p=0.5, training=True):
@@ -1780,6 +1767,58 @@ def dropout2d(input, p=0.5, training=True):
1780
1767
  return out
1781
1768
 
1782
1769
 
1770
+ def dropout2d_ext(input, p=0.5, training=True, inplace=False):
1771
+ r"""
1772
+ During training, randomly zeroes some channels of the input tensor with probability `p`
1773
+ from a Bernoulli distribution (For a 4-dimensional tensor with a shape of :math:`(N, C, H, W)`,
1774
+ the channel feature map refers to a 2-dimensional feature map with the shape of :math:`(H, W)`).
1775
+
1776
+ For example, the :math:`j\_th` channel of the :math:`i\_th` sample in the batched input is a to-be-processed
1777
+ `2D` tensor input[i,j].
1778
+ Each channel will be zeroed out independently on every forward call which based on Bernoulli distribution
1779
+ probability `p`.
1780
+ The parper `Dropout: A Simple Way to Prevent Neural Networks from Overfitting
1781
+ <http://www.cs.toronto.edu/~rsalakhu/papers/srivastava14a.pdf>`_ mentioned this technology, and it is proved that
1782
+ it can effectively reduce over fitting and prevent neuronal coadaptation.
1783
+ For more details, refer to `Improving neural networks by preventing co-adaptation of feature detectors
1784
+ <https://arxiv.org/pdf/1207.0580.pdf>`_ .
1785
+
1786
+ `dropout2d` can improve the independence between channel feature maps.
1787
+
1788
+ .. warning::
1789
+ This is an experimental API that is subject to change or deletion.
1790
+
1791
+ Args:
1792
+ input (Tensor): A `4D` tensor with shape :math:`(N, C, H, W)`, where `N` is the batch size, `C` is the number
1793
+ of channels, `H` is the feature height, and `W` is the feature width.
1794
+ p (float, optional): The dropping probability of a channel, between 0 and 1, e.g. `p` = 0.8,
1795
+ which means dropping out 80% of channels. Default: ``0.5`` .
1796
+ training(bool, optional): If `training` is True, applying dropout, otherwise, not applying. Default: ``True`` .
1797
+ inplace (bool, optional): If set to ``True`` , will do this operation in-place. Default: ``False`` .
1798
+
1799
+ Returns:
1800
+ Tensor, output, with the same shape and data type as `input`.
1801
+
1802
+ Raises:
1803
+ TypeError: If `input` is not a Tensor.
1804
+ ValueError: If `p` is out of the range `[0.0, 1.0]`.
1805
+
1806
+ Supported Platforms:
1807
+ ``Ascend``
1808
+
1809
+ Examples:
1810
+ >>> import mindspore
1811
+ >>> import numpy as np
1812
+ >>> from mindspore import Tensor, mint
1813
+ >>> input = Tensor(np.ones([2, 1, 2, 3]), mindspore.float32)
1814
+ >>> output = mint.nn.functional.dropout2d(input, 0.5)
1815
+ >>> print(output.shape)
1816
+ (2, 1, 2, 3)
1817
+ """
1818
+ seed, offset = default_generator._step(generator_step_) # pylint: disable=protected-access
1819
+ return dropout2d_ext_op(input, p, training, inplace, seed, offset)
1820
+
1821
+
1783
1822
  def dropout3d(input, p=0.5, training=True):
1784
1823
  r"""
1785
1824
  During training, randomly zeroes some channels of the input tensor
@@ -2395,7 +2434,7 @@ def is_floating_point(input):
2395
2434
  >>> mindspore.ops.is_floating_point(input)
2396
2435
  False
2397
2436
  """
2398
- return input.dtype in [mstype.float32, mstype.bfloat16, mstype.float16, mstype.float64]
2437
+ return input.dtype in mstype.float_type
2399
2438
 
2400
2439
 
2401
2440
  def _is_dim_unknown(shape):
@@ -2864,9 +2903,6 @@ def interpolate_ext(input,
2864
2903
  r"""
2865
2904
  Samples the input Tensor to the given size or scale_factor by using one of the interpolate algorithms.
2866
2905
 
2867
- .. warning::
2868
- This is an experimental API that is subject to change or deletion.
2869
-
2870
2906
  .. note::
2871
2907
  - In 'linear' mode, the scenarios, where `scale_factor` is not None and `align_corners` is False,
2872
2908
  is not supported.
@@ -3452,9 +3488,6 @@ def logsigmoid_ext(input):
3452
3488
  .. image:: ../images/LogSigmoid.png
3453
3489
  :align: center
3454
3490
 
3455
- .. warning::
3456
- This is an experimental API that is subject to change or deletion.
3457
-
3458
3491
  Args:
3459
3492
  input (Tensor): The input of LogSigmoid with data type of bfloat16, float16 or float32.
3460
3493
  The shape is :math:`(*)` where :math:`*` means, any number of additional dimensions.
@@ -4303,6 +4336,15 @@ def nll_loss(inputs, target, weight=None, ignore_index=-100, reduction='mean', l
4303
4336
  \sum_{n=1}^{N} l_{n}, & \text { if reduction }=\text { 'sum' }
4304
4337
  \end{array}\right.
4305
4338
 
4339
+ .. warning::
4340
+ - In GE mode, the rank of `inputs` should be 1D or 2D, the rank of `target` and `weight` should be 1D,
4341
+ and the following restraints should be met:
4342
+
4343
+ - when `inputs` is 1D: target_shape[0] == 1 and weight_shape[0] == inputs_shape[0].
4344
+ - when `inputs` is 2D: target_shape[0] == inputs_shape[0] and weight_shape[0] == inputs_shape[1].
4345
+
4346
+ - On GPU or CPU, `inputs` should be 2D.
4347
+
4306
4348
  Args:
4307
4349
  inputs (Tensor): :math:`(N, C)` where `C = number of classes` or :math:`(N, C, H, W)`
4308
4350
  in case of 2D Loss, or :math:`(N, C, d_1, d_2, ..., d_K)`.
@@ -4430,9 +4472,6 @@ def nll_loss_ext(input, target, weight=None, ignore_index=-100, reduction='mean'
4430
4472
  \sum_{n=1}^{N} l_{n}, & \text { if reduction }=\text { 'sum' }
4431
4473
  \end{array}\right.
4432
4474
 
4433
- .. warning::
4434
- This is an experimental API that is subject to change or deletion.
4435
-
4436
4475
  Args:
4437
4476
  input (Tensor): :math:`(N)` or :math:`(N, C)` where `C = number of classes` , `N = batch size` ,
4438
4477
  or :math:`(N, C, d_1, d_2, ..., d_K)` (for high-dimensional data).
@@ -4846,8 +4885,9 @@ def smooth_l1_loss(input, target, beta=1.0, reduction='none'):
4846
4885
  >>> print(output)
4847
4886
  [0. 0. 0.5]
4848
4887
  """
4849
- _smooth_l1_loss = _get_cache_prim(P.SmoothL1Loss)(beta, reduction)
4850
- return _smooth_l1_loss(input, target)
4888
+ if beta == 0.0:
4889
+ return l1_loss_ext(input, target, reduction)
4890
+ return ops.auto_generate.smooth_l1_loss(input, target, beta=beta, reduction=reduction)
4851
4891
 
4852
4892
 
4853
4893
  def threshold(input, thr, value):
@@ -5192,7 +5232,7 @@ def margin_ranking_loss(input1, input2, target, margin=0.0, reduction='mean'):
5192
5232
  _check_is_tensor('target', target, "margin_ranking_loss")
5193
5233
  check_input_dtype('input1', input1, 'input2', input2, 'margin_ranking_loss')
5194
5234
  check_input_dtype('target', target, 'input1', input1, 'margin_ranking_loss')
5195
- x = maximum_(-target * (input1 - input2) + margin, 0)
5235
+ x = ops.clamp(-target * (input1 - input2) + margin, min=0)
5196
5236
  return _get_loss(x, reduction, "margin_ranking_loss")
5197
5237
 
5198
5238
 
@@ -5533,8 +5573,8 @@ def ctc_loss(log_probs, targets, input_lengths, target_lengths, blank=0, reducti
5533
5573
  >>> print(loss)
5534
5574
  -2.2986124
5535
5575
  >>> print(log_alpha)
5536
- [[[0.3 0.3 -inf -inf -inf]
5537
- [1.2 1.8931472 1.2 -inf -inf]]]
5576
+ [[[0.3 0.3 -inf -inf 1.8931472 1.2 0. 0. ]
5577
+ [0. 0. 0. 0. 0. 0. 0. 0. ]]]
5538
5578
  """
5539
5579
  _check_ctc_loss_inputs(blank, reduction, zero_infinity, 'ctc_loss')
5540
5580
  ctc_loss_op = NN_OPS.CTCLossV2(blank=blank, reduction="none", zero_infinity=zero_infinity)
@@ -6228,127 +6268,6 @@ def conv2d(input, weight, bias=None, stride=1, pad_mode="valid", padding=0, dila
6228
6268
  return output
6229
6269
 
6230
6270
 
6231
- def conv1d_ext(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1):
6232
- r"""
6233
- Applies a 1D convolution over an input tensor. The input tenor is typically
6234
- of shape :math:`(N, C_{in}, L_{in})`,
6235
- where :math:`N` is batch size, :math:`C` is channel number, :math:`L` is sequence length.
6236
-
6237
- The output is calculated based on formula:
6238
-
6239
- .. math::
6240
-
6241
- \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
6242
- \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
6243
-
6244
- where :math:`bias` is the output channel bias, :math:`ccor` is
6245
- the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_,
6246
- :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
6247
-
6248
- - :math:`i` corresponds to the batch number, the range is :math:`[0, N-1]`,
6249
- where :math:`N` is the batch size of the input.
6250
-
6251
- - :math:`j` corresponds to the output channel, the range is :math:`[0, C_{out}-1]`,
6252
- where :math:`C_{out}` is the number of
6253
- output channels, which is also equal to the number of kernels.
6254
-
6255
- - :math:`k` corresponds to the input channel, the range is :math:`[0, C_{in}-1]`,
6256
- where :math:`C_{in}` is the number of
6257
- input channels, which is also equal to the number of channels in the convolutional kernels.
6258
-
6259
- Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
6260
- output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
6261
- kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
6262
- channel in the :math:`i`-th batch of the input feature map.
6263
-
6264
- The shape of the convolutional kernel is given by :math:`(\text{kernel_size})`,
6265
- where :math:`\text{kernel_size}` is the length of the kernel.
6266
- If we consider the input and output channels as well as the `groups` parameter, the complete kernel shape
6267
- will be :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size})`,
6268
- where `groups` is the number of groups dividing `x`'s input channel when applying groups convolution.
6269
-
6270
- For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
6271
- <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
6272
-
6273
- .. warning::
6274
- This is an experimental API that is subject to change or deletion.
6275
-
6276
- Args:
6277
- input (Tensor): Tensor of shape :math:`(N, C_{in}, L_{in})` or :math:`(C_{in}, L_{in})`.
6278
- weight (Tensor): Tensor of shape
6279
- :math:`(N, C_{in} / \text{groups}, \text{kernel_size})`, then the size of kernel
6280
- is :math:`(\text{kernel_size})`.
6281
- bias (Tensor, optional): Bias Tensor with shape :math:`(C_{out})`.
6282
- When bias is ``None`` , zeros will be used. Default: ``None`` .
6283
- stride (Union[int, tuple[int], list[int]], optional): The movement stride of the 1D convolution kernel.
6284
- The data type is an integer or a tuple of one integer. Default: ``1`` .` .
6285
- padding (Union[int, tuple[int], list[int], str], optional): The number of padding
6286
- on the input.
6287
- The data type is an integer or a tuple of one integer or string {`valid`, `same`}.
6288
- The value should be greater than or equal to 0. Default: ``0`` .
6289
-
6290
- - ``"same"``: Pad the input around its edges so that the shape of input and output
6291
- are the same when `stride` is set to ``1``.
6292
- The amount of padding to is calculated by the operator internally, If the amount is even, it is
6293
- uniformly distributed around the input, if it is odd, the excess amount goes to the right side.
6294
- If this mode is set, `stride` must be 1.
6295
-
6296
- - ``"valid"``: No padding is applied to the input, and the output returns the maximum
6297
- possible length. Extra sequence that could not complete a full stride will
6298
- be discarded.
6299
-
6300
- dilation (Union[int, tuple[int], list[int]], optional): Specifies the dilation rate to use for
6301
- dilated convolution. It can be a single int or a tuple of 1 integer.
6302
- Assuming :math:`dilation=(d)`, the convolutional kernel samples the input with a
6303
- spacing of :math:`d-1` elements in the length direction.
6304
- Default: ``1`` .
6305
- groups (int, optional): Splits filter into groups, `in_channels` and `out_channels` must be
6306
- divisible by `groups`. If the groups is equal to `in_channels` and `out_channels`,
6307
- this 1D convolution layer also can be called 1D depthwise convolution layer. Default: ``1`` .
6308
-
6309
- - :math:`(C_{in} \text{ % } \text{groups} == 0)` , :math:`(C_{out} \text{ % } \text{groups} == 0)` ,
6310
- :math:`(C_{out} >= \text{groups})` , :math:`(\text{weight[1]} = C_{in} / \text{groups})`。
6311
-
6312
- Returns:
6313
- Tensor, the value that applied 1D convolution. The shape is :math:`(N, C_{out}, L_{out})`.
6314
- To see how different pad modes affect the output shape, please refer to
6315
- :class:`mindspore.mint.nn.Conv1d` for more details.
6316
-
6317
- Raises:
6318
- ValueError: Args and size of the input feature map should satisfy the output formula to ensure that the size of
6319
- the output feature map is positive; otherwise, an error will be reported.
6320
- RuntimeError: On Ascend, due to the limitation of the L1 cache size of different NPU chip, if input size or
6321
- kernel size is too large, it may trigger an error.
6322
- TypeError: If `in_channels`, `out_channels` or `groups` is not an int.
6323
- TypeError: If `kernel_size`, `stride` or `dilation` is neither an int not a tuple.
6324
- ValueError: If `in_channels`, `out_channels`, `kernel_size`, `stride` or `dilation` is less than 1.
6325
- ValueError: If `padding` is less than 0.
6326
- ValueError: If `padding` is `same` , `stride` is not equal to 1.
6327
- ValueError: The input parameters do not satisfy the convolution output formula.
6328
- ValueError: The KernelSize cannot exceed the size of the input feature map.
6329
- ValueError: The value of padding cannot cause the calculation area to exceed the input size.
6330
-
6331
- Supported Platforms:
6332
- ``Ascend``
6333
-
6334
- Examples:
6335
- >>> import mindspore
6336
- >>> import numpy as np
6337
- >>> from mindspore import Tensor, ops, mint
6338
- >>> x = Tensor(np.ones([10, 32, 32]), mindspore.float32)
6339
- >>> weight = Tensor(np.ones([32, 32, 3]), mindspore.float32)
6340
- >>> output = mint.nn.functional.conv1d(x, weight)
6341
- >>> print(output.shape)
6342
- (10, 32, 30)
6343
- """
6344
- if isinstance(padding, (int, tuple, list)):
6345
- return conv1d_ext_op(input, weight, bias, stride, padding, dilation, groups)
6346
- if isinstance(padding, str):
6347
- return conv1d_padding_op(input, weight, bias, stride, padding, dilation, groups)
6348
- raise TypeError(f"For conv1d, the parameter 'padding' must be a tuple/list " \
6349
- f"or a string, but got {type(padding)}")
6350
-
6351
-
6352
6271
  def _check_stride_when_same_mode(stride):
6353
6272
  """ stride must be 1 when pad mode is same """
6354
6273
  if isinstance(stride, int):
@@ -6438,9 +6357,6 @@ def conv2d_ext(input, weight, bias=None, stride=1, padding=0, dilation=1, groups
6438
6357
  <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_ and
6439
6358
  `ConvNets <http://cs231n.github.io/convolutional-networks/>`_.
6440
6359
 
6441
- .. warning::
6442
- This is an experimental API that is subject to change or deletion.
6443
-
6444
6360
  Args:
6445
6361
  input (Tensor): Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`(C_{in}, H_{in}, W_{in})`.
6446
6362
  weight (Tensor): Tensor of shape
@@ -6475,9 +6391,12 @@ def conv2d_ext(input, weight, bias=None, stride=1, padding=0, dilation=1, groups
6475
6391
  there will be :math:`k - 1` pixels skipped for each sampling location. Its value must
6476
6392
  be greater than or equal to 1 and bounded by the height and width of the input `x`. Default: ``1`` .
6477
6393
  groups (int, optional): Splits `input` into groups. Default: ``1`` .
6394
+ The following restraints should be met:
6478
6395
 
6479
- - :math:`(C_{in} \text{ % } \text{groups} == 0)` , :math:`(C_{out} \text{ % } \text{groups} == 0)` ,
6480
- :math:`(C_{out} >= \text{groups})` , :math:`(\text{weight[1]} = C_{in} / \text{groups})`
6396
+ - :math:`(C_{in} \text{ % } \text{groups} == 0)`
6397
+ - :math:`(C_{out} \text{ % } \text{groups} == 0)`
6398
+ - :math:`(C_{out} >= \text{groups})`
6399
+ - :math:`(\text{weight[1]} = C_{in} / \text{groups})`
6481
6400
 
6482
6401
  Returns:
6483
6402
  Tensor, the value that applied 2D convolution. The shape is :math:`(N, C_{out}, H_{out}, W_{out})`.
@@ -6513,12 +6432,7 @@ def conv2d_ext(input, weight, bias=None, stride=1, padding=0, dilation=1, groups
6513
6432
  >>> print(output.shape)
6514
6433
  (10, 32, 30, 30)
6515
6434
  """
6516
- if isinstance(padding, (int, tuple, list)):
6517
- return conv2d_ext_op(input, weight, bias, stride, padding, dilation, groups)
6518
- if isinstance(padding, str):
6519
- return conv2d_padding_op(input, weight, bias, stride, padding, dilation, groups)
6520
- raise TypeError(f"For conv2d, the parameter 'padding' must be a tuple/list " \
6521
- f"or a string, but got {type(padding)}")
6435
+ return conv2d_op(input, weight, bias, stride, padding, dilation, groups)
6522
6436
 
6523
6437
 
6524
6438
  def hardtanh(input, min_val=-1.0, max_val=1.0):
@@ -7312,143 +7226,6 @@ def conv3d(input, weight, bias=None, stride=1, pad_mode="valid", padding=0, dila
7312
7226
  return output
7313
7227
 
7314
7228
 
7315
- def conv3d_ext(input, weight, bias=None, stride=1, padding=0, dilation=1, groups=1):
7316
- r"""
7317
- Applies a 3D convolution over an input tensor. The input tensor is typically of
7318
- shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})` or :math:`(C_{in}, D_{in}, H_{in}, W_{in})`,
7319
- where :math:`N` is batch size, :math:`C` is channel number, :math:`D, H, W` are the depth,
7320
- height and width of the feature graph, respectively.
7321
-
7322
- The output is calculated based on formula:
7323
-
7324
- .. math::
7325
-
7326
- \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
7327
- \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
7328
-
7329
- where :math:`bias` is the output channel bias, :math:`ccor` is
7330
- the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_
7331
- , :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
7332
-
7333
- Here are the indices' meanings:
7334
-
7335
- - :math:`i` corresponds to the batch number, the range is :math:`[0, N-1]`,
7336
- where :math:`N` is the batch size of the input.
7337
-
7338
- - :math:`j` corresponds to the output channel, the range is :math:`[0, C_{out}-1]`,
7339
- where :math:`C_{out}` is the number of
7340
- output channels, which is also equal to the number of kernels.
7341
-
7342
- - :math:`k` corresponds to the input channel, the range is :math:`[0, C_{in}-1]`,
7343
- where :math:`C_{in}` is the number of
7344
- input channels, which is also equal to the number of channels in the convolutional kernels.
7345
-
7346
- Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
7347
- output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
7348
- kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
7349
- channel in the :math:`i`-th batch of the input feature map.
7350
-
7351
- The shape of the convolutional kernel is given by :math:`(kd, kh, kw)` where :math:`kd` , :math:`kd` and\
7352
- :math:`kw` are the depth, height and width of the kernel, respectively.
7353
- If we consider the input and output channels as well as the `group` parameter, the complete kernel shape
7354
- will be :math:`(C_{out}, C_{in} / \text{group}, kd, kh, kw)`,
7355
- where `group` is the number of groups dividing `x`'s input channel when applying group convolution.
7356
-
7357
- For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
7358
- <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
7359
-
7360
- The following lists some of the limitations of the parameters.
7361
-
7362
- - input -- The input to the conv3d. The input must have each dimension size within the range [1, int32_max].
7363
- - weight -- Filters of shape :math:`(C_{out}, C_{in} / groups, kd, kh, kw)`. The value of :math:`kh`
7364
- and :math:`kw` is in the range [1, 511]. The remaining values are in the range [1, int32_max].
7365
- And :math:`kh*kw*k0` is less 65536 (k0 is 16. If data type is float32, k0 is 8).
7366
- - bias -- Bias Tensor with shape :math:`(C_{out})`. The shape must equal the first dimension of the weight.
7367
- - stride -- The distance of kernel moving. It can be an int number or
7368
- tuple (noted by :math:`(stride_d, stride_h, stride_w)`). stride_h and stride_w are in the range [1, 63].
7369
- stride_d is in the range [1, 255].
7370
- - padding -- If padding is an int number, it is in the range [0, 255].
7371
- - dilation -- The value is in the range [1, 255].
7372
- - groups -- The value is in the range [1, 65535].
7373
- - :math:`C_{in} \% \text{groups} == 0 \quad \text{and} \quad C_{out} \% \text{groups} == 0` .
7374
- - :math:`weight[1] == C_{in} / groups` .
7375
- - :math:`H_{in} + PadUp + PadDown >= (kh - 1) * DilationH + 1` .
7376
- - :math:`W_{in} + PadLeft + PadRight >= (kw - 1) * DilationW + 1` .
7377
- - :math:`D_{in} + PadFront + PadBack >= (kd - 1) * DilationD + 1` .
7378
- - :math:`H_{out} = (H_{in} + PadUp + PadDown - ((kh - 1) * DilationH + 1)) / StrideH + 1` .
7379
- - :math:`W_{out} = (W_{in} + PadLeft + PadRight - ((kw - 1) * DilationW + 1)) / StrideW + 1` .
7380
- - :math:`D_{out} = (D_{in} + PadFront + PadBack - ((kd - 1) * DilationD + 1)) / StrideD + 1` .
7381
- - :math:`(D_{in}+PadFront+PadBack - ((kd-1)*DilationD+1)) \% StrideD <= PadBack` .
7382
- - :math:`(H_{in}+PadUp+PadDown - ((kh-1)*Dilationh+1)) \% StrideH <= PadDown` .
7383
- - :math:`stride_d <= kernel_d` .
7384
- - :math:`PadUp < kh` and :math:`PadDown < kh` . When `padding` = ``'valid'``, both PadUp and PadDown are zeros.
7385
- When `padding` = ``'same'``, pad can be calculated by
7386
- :math:`floor(((H_{out}-1) * strideH + (kh - 1) * DilationH + 1 - H_{in}) / 2)` for high dimension.
7387
- It is similar way to calculate the padding for depth and width dimension. And the depth and width
7388
- dimensions also have the same constraints.
7389
- - :math:`((kh - 1) * DilationH - PadUp)` should be in [0, 255]. It is the same constraint for depth
7390
- and width dimension.
7391
- - If `padding` is ``'same'``, `stride` must be 1.
7392
-
7393
- .. warning::
7394
- This API does not support Atlas series products.
7395
- This is an experimental API that is subject to change or deletion.
7396
-
7397
- Args:
7398
- input (Tensor): Tensor of shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})`.
7399
- weight (Tensor): Set size of kernel is :math:`(kd, kh,
7400
- kw)`, then the shape is :math:`(C_{out}, C_{in} / groups, kd, kh, kw)`.
7401
- bias (Tensor, optional): Bias Tensor with shape :math:`(C_{out})`.
7402
- When bias is ``None`` , zeros will be used. Default: ``None`` .
7403
- stride (Union(int, tuple[int], list[int]), optional): The distance of kernel moving, an int
7404
- number that represents the depth, the height and width of movement are both strides, or a
7405
- tuple of triple int numbers that
7406
- represent the depth, height and width of movement respectively. Default: ``1`` .
7407
- padding (Union(int, tuple[int], list[int], str), optional): Implicit paddings on both sides of the input `x`.
7408
- Can be a string, one integer or a tuple/list with 3 integers.
7409
- If `padding` is a string, the optional values are ``"same"`` , ``"valid"``.
7410
-
7411
- - same: Adopts the way of completion. The height and width of the output will be equal to
7412
- the input `x` divided by stride. The padding will be evenly calculated in top and bottom,
7413
- left and right possiblily. Otherwise, the last extra padding will be calculated from the bottom
7414
- and the right side. If this mode is set, `stride` must be 1.
7415
-
7416
- - valid: Adopts the way of discarding. The possible largest height and width of output will be returned
7417
- without padding. Extra pixels will be discarded.
7418
-
7419
- If `padding` is one integer, the paddings of top, bottom, left and right are the same, equal to padding.
7420
- If `padding` is a tuple/list with 3 integers, the padding of head, tail, top, bottom,
7421
- left and right equal to pad[0], pad[0], pad[1], pad[1], pad[2] and pad[2] correspondingly. Default: ``0`` .
7422
- dilation (Union[int, tuple[int], list[int]], optional): Controlling the space between the kernel points.
7423
- Default: ``1`` .
7424
- groups (int, optional): Splits `input` into groups. Default: ``1`` .
7425
-
7426
- Returns:
7427
- Tensor, the same dtype as the `input`, with the shape :math:`(N, C_{out}, D_{out}, H_{out}, W_{out})`
7428
- or :math:`(C_{out}, D_{out}, H_{out}, W_{out})`.
7429
-
7430
- Raises:
7431
- TypeError: If `stride`, `padding` or `dilation` is neither an int nor a tuple.
7432
- TypeError: `groups` is not an int.
7433
- TypeError: If `bias` is not a Tensor.
7434
-
7435
- Supported Platforms:
7436
- ``Ascend``
7437
-
7438
- Examples:
7439
- >>> import mindspore
7440
- >>> import numpy as np
7441
- >>> from mindspore import mint
7442
- >>> x = mindspore.Tensor(np.random.randn(12, 1, 60, 50, 8), mindspore.float16)
7443
- >>> w = mindspore.Tensor(np.random.randn(26, 1, 2, 4, 4), mindspore.float16)
7444
- >>> out = mint.nn.functional.conv3d(x, w)
7445
- >>> print(out.shape)
7446
- (12, 26, 59, 47, 5)
7447
- """
7448
-
7449
- return conv3d_op(input, weight, bias, stride, padding, dilation, groups)
7450
-
7451
-
7452
7229
  @_primexpr
7453
7230
  def _check_positive_int(arg_value, arg_name=None, prim_name=None):
7454
7231
  validator.check_positive_int(arg_value, arg_name=arg_name, prim_name=prim_name)
@@ -9332,14 +9109,14 @@ def embedding(input, weight, padding_idx=None, max_norm=None, norm_type=2.0, sca
9332
9109
  >>> weight = Parameter(np.random.randn(3, 3).astype(np.float32))
9333
9110
  >>> output = ops.embedding(input, weight, max_norm=0.4)
9334
9111
  >>> print(output)
9335
- [[[ 5.49015924e-02, 3.47811311e-01, -1.89771220e-01],
9336
- [ 2.09307984e-01, -2.24846993e-02, 3.40124398e-01],
9337
- [ 5.49015924e-02, 3.47811311e-01, -1.89771220e-01],
9338
- [ 5.49015924e-02, 3.47811311e-01, -1.89771220e-01]],
9339
- [[ 2.09307984e-01, -2.24846993e-02, 3.40124398e-01],
9340
- [ 2.09307984e-01, -2.24846993e-02, 3.40124398e-01],
9341
- [ 5.49015924e-02, 3.47811311e-01, -1.89771220e-01],
9342
- [ 2.09307984e-01, -2.24846993e-02, 3.40124398e-01]]]
9112
+ [[[ 5.49015924 3.47811311 -1.89771220],
9113
+ [ 2.09307984 -2.24846993 3.40124398],
9114
+ [ 5.49015924 3.47811311 -1.89771220],
9115
+ [ 5.49015924 3.47811311 -1.89771220]],
9116
+ [[ 2.09307984 -2.24846993 3.40124398],
9117
+ [ 2.09307984 -2.24846993 3.40124398],
9118
+ [ 5.49015924 3.47811311 -1.89771220],
9119
+ [ 2.09307984 -2.24846993 3.40124398]]]
9343
9120
  """
9344
9121
  return embedding_op(input, weight, padding_idx, max_norm, norm_type, scale_grad_by_freq)
9345
9122
 
@@ -9633,6 +9410,7 @@ __all__ = [
9633
9410
  'conv2d',
9634
9411
  'conv_transpose2d',
9635
9412
  'sigmoid',
9413
+ 'inplace_sigmoid',
9636
9414
  'soft_margin_loss',
9637
9415
  'logsigmoid',
9638
9416
  'relu',
@@ -9653,6 +9431,7 @@ __all__ = [
9653
9431
  'lp_pool2d',
9654
9432
  'moe_token_permute',
9655
9433
  'moe_token_unpermute',
9434
+ 'ring_attention_update',
9656
9435
  'max_unpool1d',
9657
9436
  'max_unpool2d',
9658
9437
  'max_unpool3d',
@@ -1262,9 +1262,6 @@ def randn_ext(*size, generator=None, dtype=None):
1262
1262
  Returns a new tensor filled with numbers from the normal distribution over an interval :math:`[0, 1)`
1263
1263
  based on the given shape and dtype.
1264
1264
 
1265
- .. warning::
1266
- This is an experimental API that is subject to change or deletion.
1267
-
1268
1265
  Args:
1269
1266
  size (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g. :math:`(2, 3)` or :math:`2`.
1270
1267
 
@@ -1341,9 +1338,6 @@ def randint_ext(*args, generator=None, dtype=None):
1341
1338
  Returns a new tensor filled with integer numbers from the uniform distribution over an interval :math:`[low, high)`
1342
1339
  based on the given shape and dtype.
1343
1340
 
1344
- .. warning::
1345
- This is an experimental API that is subject to change or deletion.
1346
-
1347
1341
  Args:
1348
1342
  low (int, optional): the lower bound of the generated random number. Default: ``0``.
1349
1343
  high (int): the upper bound of the generated random number
@@ -1680,9 +1674,6 @@ def randperm_ext(n, *, generator=None, dtype=mstype.int64):
1680
1674
  r"""
1681
1675
  Generates random permutation of integers from 0 to n-1.
1682
1676
 
1683
- .. warning::
1684
- - This is an experimental API that is subject to change or deletion.
1685
-
1686
1677
  Args:
1687
1678
  n (Union[Tensor, int]): size of the permutation. int or Tensor with shape: () or (1,) and
1688
1679
  data type int64. The value of `n` must be greater than zero.
@@ -1957,10 +1948,10 @@ def multinomial_ext(input, num_samples, replacement=False, *, generator=None):
1957
1948
  >>> # input1 and input2 have the same meaning.
1958
1949
  >>> output1 = ops.multinomial_ext(input1, 2)
1959
1950
  >>> output2 = ops.multinomial_ext(input2, 2)
1960
- >>> # print(output1)
1961
- >>> # [0 1]
1962
- >>> # print(output2)
1963
- >>> # [0 1]
1951
+ >>> print(output1)
1952
+ [0 1]
1953
+ >>> print(output2)
1954
+ [0 1]
1964
1955
  >>> print(len(output1))
1965
1956
  2
1966
1957
  >>> print(len(output2))
@@ -1968,8 +1959,8 @@ def multinomial_ext(input, num_samples, replacement=False, *, generator=None):
1968
1959
  >>> # case 2: The output is random, and the length of the output is the same as num_sample.
1969
1960
  >>> # replacement is True.
1970
1961
  >>> output3 = ops.multinomial_ext(input1, 10, replacement=True)
1971
- >>> # print(output3)
1972
- >>> # [0 0 1 0 0 0 0 0 0 0]
1962
+ >>> print(output3)
1963
+ [0 0 1 0 0 0 0 0 0 0]
1973
1964
  >>> print(len(output3))
1974
1965
  10
1975
1966
  >>> # case 3: The output is random, and the length of the output is the same as num_sample.
@@ -1977,9 +1968,9 @@ def multinomial_ext(input, num_samples, replacement=False, *, generator=None):
1977
1968
  >>> # rank is 2
1978
1969
  >>> input4 = Tensor([[90, 10, 0], [10, 90, 0]], mstype.float32)
1979
1970
  >>> output4 = ops.multinomial_ext(input4, 10, replacement=True)
1980
- >>> # print(output4)
1981
- >>> # [[0 0 0 0 0 0 0 0 1 0]
1982
- >>> # [1 1 1 1 1 0 1 1 1 1]]
1971
+ >>> print(output4)
1972
+ [[0 0 0 0 0 0 0 0 1 0]
1973
+ [1 1 1 1 1 0 1 1 1 1]]
1983
1974
  """
1984
1975
  if generator is None:
1985
1976
  generator = default_generator