mindspore 2.6.0rc1__cp310-cp310-win_amd64.whl → 2.7.0rc1__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 (407) 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 +1 -1
  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 +40 -9
  9. mindspore/{_deprecated → _extends/optimize}/__init__.py +9 -3
  10. mindspore/_extends/optimize/cell_utils.py +96 -0
  11. mindspore/_extends/parse/__init__.py +2 -2
  12. mindspore/_extends/parse/compile_config.py +44 -22
  13. mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -1
  14. mindspore/_extends/parse/parser.py +37 -62
  15. mindspore/_extends/parse/resources.py +39 -0
  16. mindspore/_extends/parse/standard_method.py +43 -13
  17. mindspore/_extends/parse/trope.py +8 -1
  18. mindspore/_extends/pijit/__init__.py +1 -2
  19. mindspore/amp.py +4 -4
  20. mindspore/atlprov.dll +0 -0
  21. mindspore/avcodec-59.dll +0 -0
  22. mindspore/avdevice-59.dll +0 -0
  23. mindspore/avfilter-8.dll +0 -0
  24. mindspore/avformat-59.dll +0 -0
  25. mindspore/avutil-57.dll +0 -0
  26. mindspore/boost/adasum.py +1 -1
  27. mindspore/boost/boost_cell_wrapper.py +4 -4
  28. mindspore/c1.dll +0 -0
  29. mindspore/c1xx.dll +0 -0
  30. mindspore/c2.dll +0 -0
  31. mindspore/common/__init__.py +27 -2
  32. mindspore/common/_grad_function.py +2 -1
  33. mindspore/common/_pijit_context.py +28 -7
  34. mindspore/common/_stub_tensor.py +1 -209
  35. mindspore/common/_tensor_cpp_method.py +1 -1
  36. mindspore/common/_tensor_docs.py +77 -16
  37. mindspore/common/api.py +238 -113
  38. mindspore/common/dtype.py +21 -11
  39. mindspore/common/dump.py +10 -15
  40. mindspore/common/generator.py +5 -3
  41. mindspore/common/hook_handle.py +11 -2
  42. mindspore/common/jit_config.py +1 -1
  43. mindspore/common/jit_trace.py +84 -105
  44. mindspore/common/parameter.py +26 -12
  45. mindspore/common/recompute.py +3 -3
  46. mindspore/common/sparse_tensor.py +0 -3
  47. mindspore/common/symbol.py +0 -1
  48. mindspore/common/tensor.py +81 -81
  49. mindspore/communication/_comm_helper.py +46 -4
  50. mindspore/communication/management.py +79 -7
  51. mindspore/context.py +58 -40
  52. mindspore/dataset/core/config.py +3 -3
  53. mindspore/dataset/engine/datasets.py +20 -7
  54. mindspore/dataset/engine/datasets_user_defined.py +33 -3
  55. mindspore/dataset/engine/iterators.py +2 -2
  56. mindspore/dataset/engine/obs/config_loader.py +2 -2
  57. mindspore/dataset/engine/obs/obs_mindrecord_dataset.py +8 -0
  58. mindspore/dataset/transforms/py_transforms.py +7 -3
  59. mindspore/dataset/transforms/transforms.py +7 -3
  60. mindspore/dataset/vision/validators.py +1 -0
  61. mindspore/device_context/ascend/device.py +1 -1
  62. mindspore/device_context/gpu/__init__.py +2 -2
  63. mindspore/device_context/gpu/device.py +1 -1
  64. mindspore/device_context/gpu/op_precision.py +4 -2
  65. mindspore/device_context/gpu/op_tuning.py +6 -3
  66. mindspore/device_manager.py +16 -9
  67. mindspore/dnnl.dll +0 -0
  68. mindspore/dpcmi.dll +0 -0
  69. mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +3 -7
  70. mindspore/experimental/llm_boost/atb/boost_base.py +2 -3
  71. mindspore/experimental/optim/adadelta.py +13 -20
  72. mindspore/experimental/optim/adagrad.py +15 -22
  73. mindspore/experimental/optim/adam.py +17 -24
  74. mindspore/experimental/optim/adamax.py +14 -22
  75. mindspore/experimental/optim/adamw.py +28 -34
  76. mindspore/experimental/optim/asgd.py +15 -25
  77. mindspore/experimental/optim/lr_scheduler.py +27 -45
  78. mindspore/experimental/optim/nadam.py +14 -24
  79. mindspore/experimental/optim/optimizer.py +13 -23
  80. mindspore/experimental/optim/radam.py +18 -24
  81. mindspore/experimental/optim/rmsprop.py +14 -25
  82. mindspore/experimental/optim/rprop.py +15 -26
  83. mindspore/experimental/optim/sgd.py +9 -19
  84. mindspore/hal/__init__.py +4 -4
  85. mindspore/hal/contiguous_tensors_handle.py +2 -2
  86. mindspore/hal/memory.py +27 -7
  87. mindspore/include/api/cell.h +37 -1
  88. mindspore/include/api/delegate.h +10 -0
  89. mindspore/include/api/model.h +3 -0
  90. mindspore/include/api/types.h +2 -2
  91. mindspore/include/c_api/model_c.h +0 -58
  92. mindspore/include/c_api/tensor_c.h +0 -26
  93. mindspore/include/dataset/vision_ascend.h +1 -1
  94. mindspore/jpeg62.dll +0 -0
  95. mindspore/mindrecord/tools/cifar10.py +60 -11
  96. mindspore/mindrecord/tools/cifar10_to_mr.py +5 -0
  97. mindspore/mindspore_backend_common.dll +0 -0
  98. mindspore/mindspore_backend_manager.dll +0 -0
  99. mindspore/mindspore_common.dll +0 -0
  100. mindspore/mindspore_core.dll +0 -0
  101. mindspore/mindspore_cpu_res_manager.dll +0 -0
  102. mindspore/mindspore_dump.dll +0 -0
  103. mindspore/mindspore_frontend.dll +0 -0
  104. mindspore/mindspore_glog.dll +0 -0
  105. mindspore/mindspore_memory_pool.dll +0 -0
  106. mindspore/mindspore_ms_backend.dll +0 -0
  107. mindspore/mindspore_ops.dll +0 -0
  108. mindspore/mindspore_ops_host.dll +0 -0
  109. mindspore/mindspore_ops_kernel_common.dll +0 -0
  110. mindspore/mindspore_profiler.dll +0 -0
  111. mindspore/mindspore_pyboost.dll +0 -0
  112. mindspore/mindspore_pynative.dll +0 -0
  113. mindspore/mindspore_res_manager.dll +0 -0
  114. mindspore/mindspore_runtime_pipeline.dll +0 -0
  115. mindspore/mint/__init__.py +6 -46
  116. mindspore/mint/distributed/__init__.py +1 -0
  117. mindspore/mint/distributed/distributed.py +212 -9
  118. mindspore/mint/nn/__init__.py +1 -1
  119. mindspore/mint/nn/functional.py +53 -6
  120. mindspore/mint/nn/layer/_functions.py +164 -294
  121. mindspore/mint/nn/layer/activation.py +8 -6
  122. mindspore/mint/nn/layer/conv.py +137 -101
  123. mindspore/mint/nn/layer/normalization.py +8 -22
  124. mindspore/mint/optim/adam.py +19 -18
  125. mindspore/mint/optim/adamw.py +14 -8
  126. mindspore/mint/optim/sgd.py +5 -5
  127. mindspore/msobj140.dll +0 -0
  128. mindspore/mspdb140.dll +0 -0
  129. mindspore/mspdbcore.dll +0 -0
  130. mindspore/mspdbst.dll +0 -0
  131. mindspore/mspft140.dll +0 -0
  132. mindspore/msvcdis140.dll +0 -0
  133. mindspore/msvcp140_1.dll +0 -0
  134. mindspore/msvcp140_2.dll +0 -0
  135. mindspore/msvcp140_atomic_wait.dll +0 -0
  136. mindspore/msvcp140_codecvt_ids.dll +0 -0
  137. mindspore/nn/cell.py +328 -502
  138. mindspore/nn/grad/cell_grad.py +11 -12
  139. mindspore/nn/layer/activation.py +32 -34
  140. mindspore/nn/layer/basic.py +67 -64
  141. mindspore/nn/layer/channel_shuffle.py +4 -4
  142. mindspore/nn/layer/combined.py +4 -2
  143. mindspore/nn/layer/conv.py +117 -110
  144. mindspore/nn/layer/dense.py +9 -7
  145. mindspore/nn/layer/embedding.py +50 -52
  146. mindspore/nn/layer/image.py +37 -39
  147. mindspore/nn/layer/math.py +111 -112
  148. mindspore/nn/layer/normalization.py +56 -44
  149. mindspore/nn/layer/pooling.py +58 -63
  150. mindspore/nn/layer/rnn_cells.py +33 -33
  151. mindspore/nn/layer/rnns.py +56 -56
  152. mindspore/nn/layer/thor_layer.py +74 -73
  153. mindspore/nn/layer/transformer.py +11 -1
  154. mindspore/nn/learning_rate_schedule.py +20 -20
  155. mindspore/nn/loss/loss.py +79 -81
  156. mindspore/nn/optim/adam.py +3 -3
  157. mindspore/nn/optim/adasum.py +2 -2
  158. mindspore/nn/optim/asgd.py +2 -0
  159. mindspore/nn/optim/optimizer.py +1 -1
  160. mindspore/nn/optim/thor.py +2 -2
  161. mindspore/nn/probability/distribution/exponential.py +2 -1
  162. mindspore/nn/probability/distribution/poisson.py +2 -1
  163. mindspore/nn/sparse/sparse.py +3 -3
  164. mindspore/nn/wrap/cell_wrapper.py +34 -37
  165. mindspore/nn/wrap/grad_reducer.py +37 -37
  166. mindspore/nn/wrap/loss_scale.py +72 -74
  167. mindspore/numpy/array_creations.py +5 -5
  168. mindspore/numpy/fft.py +1 -1
  169. mindspore/numpy/math_ops.py +5 -5
  170. mindspore/opencv_core452.dll +0 -0
  171. mindspore/opencv_imgcodecs452.dll +0 -0
  172. mindspore/opencv_imgproc452.dll +0 -0
  173. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  174. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  175. mindspore/ops/_vmap/vmap_array_ops.py +31 -13
  176. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  177. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +42 -11
  178. mindspore/ops/auto_generate/gen_extend_func.py +23 -141
  179. mindspore/ops/auto_generate/gen_ops_def.py +727 -321
  180. mindspore/ops/auto_generate/gen_ops_prim.py +1721 -984
  181. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  182. mindspore/ops/composite/__init__.py +10 -0
  183. mindspore/ops/composite/base.py +8 -4
  184. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  185. mindspore/ops/composite/multitype_ops/_compile_utils.py +133 -109
  186. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  187. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  188. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  189. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  190. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  191. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  192. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  193. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  194. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  195. mindspore/ops/function/__init__.py +3 -1
  196. mindspore/ops/function/_add_attr_func.py +11 -6
  197. mindspore/ops/function/array_func.py +9 -96
  198. mindspore/ops/function/debug_func.py +4 -3
  199. mindspore/ops/function/grad/grad_func.py +1 -1
  200. mindspore/ops/function/math_func.py +33 -540
  201. mindspore/ops/function/nn_func.py +28 -74
  202. mindspore/ops/function/other_func.py +4 -1
  203. mindspore/ops/function/random_func.py +44 -5
  204. mindspore/ops/function/vmap_func.py +2 -1
  205. mindspore/ops/functional.py +2 -3
  206. mindspore/ops/functional_overload.py +571 -6
  207. mindspore/ops/op_info_register.py +21 -0
  208. mindspore/ops/operations/__init__.py +16 -11
  209. mindspore/ops/operations/_custom_ops_utils.py +689 -34
  210. mindspore/ops/operations/_inner_ops.py +3 -6
  211. mindspore/ops/operations/_sequence_ops.py +1 -1
  212. mindspore/ops/operations/array_ops.py +2 -2
  213. mindspore/ops/operations/comm_ops.py +185 -26
  214. mindspore/ops/operations/custom_ops.py +294 -174
  215. mindspore/ops/operations/debug_ops.py +59 -4
  216. mindspore/ops/operations/image_ops.py +13 -13
  217. mindspore/ops/operations/manually_defined/ops_def.py +15 -16
  218. mindspore/ops/operations/math_ops.py +3 -4
  219. mindspore/ops/operations/nn_ops.py +7 -39
  220. mindspore/ops/primitive.py +6 -10
  221. mindspore/ops/tensor_method.py +47 -8
  222. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  223. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  224. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  225. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  226. mindspore/ops_generate/common/base_generator.py +14 -0
  227. mindspore/ops_generate/common/gen_constants.py +8 -3
  228. mindspore/ops_generate/common/gen_utils.py +0 -19
  229. mindspore/ops_generate/common/op_proto.py +11 -4
  230. mindspore/ops_generate/common/template.py +88 -11
  231. mindspore/ops_generate/gen_ops.py +1 -1
  232. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  233. mindspore/ops_generate/op_def/ops_def_cc_generator.py +0 -3
  234. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  235. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  236. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  237. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  238. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  239. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
  240. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  241. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  242. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  243. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  244. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  245. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  246. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  247. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  248. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  249. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  250. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  251. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  252. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  253. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  254. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  255. mindspore/parallel/_auto_parallel_context.py +11 -8
  256. mindspore/parallel/_cell_wrapper.py +113 -45
  257. mindspore/parallel/_parallel_serialization.py +1 -1
  258. mindspore/parallel/_ps_context.py +4 -6
  259. mindspore/parallel/_tensor.py +167 -12
  260. mindspore/parallel/_transformer/moe.py +1 -1
  261. mindspore/parallel/_transformer/transformer.py +13 -8
  262. mindspore/parallel/auto_parallel.py +14 -7
  263. mindspore/parallel/checkpoint_convert.py +3 -3
  264. mindspore/parallel/checkpoint_transform.py +11 -7
  265. mindspore/parallel/cluster/process_entity/_api.py +84 -48
  266. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  267. mindspore/parallel/cluster/run.py +43 -4
  268. mindspore/parallel/function/__init__.py +8 -1
  269. mindspore/parallel/function/reshard_func.py +6 -7
  270. mindspore/parallel/nn/__init__.py +15 -2
  271. mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
  272. mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
  273. mindspore/parallel/shard.py +3 -4
  274. mindspore/parallel/transform_safetensors.py +463 -174
  275. mindspore/pgodb140.dll +0 -0
  276. mindspore/pgort140.dll +0 -0
  277. mindspore/profiler/__init__.py +2 -1
  278. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  279. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  280. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +12 -6
  281. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  282. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  283. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  284. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  285. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  286. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  287. mindspore/profiler/analysis/task_manager.py +1 -1
  288. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  289. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  290. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
  291. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  292. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  293. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  294. mindspore/profiler/common/constant.py +16 -0
  295. mindspore/profiler/common/profiler_context.py +25 -27
  296. mindspore/profiler/common/profiler_info.py +0 -16
  297. mindspore/profiler/common/profiler_op_analyse.py +235 -0
  298. mindspore/profiler/common/profiler_output_path.py +23 -8
  299. mindspore/profiler/common/profiler_parameters.py +128 -35
  300. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  301. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  302. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  303. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  304. mindspore/profiler/dynamic_profiler.py +305 -314
  305. mindspore/profiler/envprofiler.py +12 -7
  306. mindspore/profiler/experimental_config.py +96 -6
  307. mindspore/profiler/mstx.py +33 -12
  308. mindspore/profiler/platform/__init__.py +2 -3
  309. mindspore/profiler/platform/npu_profiler.py +29 -19
  310. mindspore/profiler/profiler.py +35 -19
  311. mindspore/profiler/profiler_action_controller.py +64 -76
  312. mindspore/profiler/schedule.py +10 -4
  313. mindspore/rewrite/common/config.py +1 -0
  314. mindspore/rewrite/common/namer.py +1 -0
  315. mindspore/rewrite/common/namespace.py +1 -0
  316. mindspore/rewrite/node/node.py +31 -11
  317. mindspore/rewrite/parsers/assign_parser.py +1 -1
  318. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  319. mindspore/run_check/_check_version.py +7 -10
  320. mindspore/runtime/__init__.py +5 -5
  321. mindspore/runtime/event.py +10 -4
  322. mindspore/runtime/executor.py +60 -45
  323. mindspore/runtime/memory.py +30 -32
  324. mindspore/runtime/thread_bind_core.py +298 -164
  325. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  326. mindspore/swresample-4.dll +0 -0
  327. mindspore/swscale-6.dll +0 -0
  328. mindspore/tbbmalloc.dll +0 -0
  329. mindspore/tinyxml2.dll +0 -0
  330. mindspore/train/_utils.py +14 -4
  331. mindspore/train/amp.py +43 -20
  332. mindspore/train/callback/__init__.py +5 -5
  333. mindspore/train/callback/_checkpoint.py +3 -6
  334. mindspore/train/callback/_flops_collector.py +1 -1
  335. mindspore/train/callback/_landscape.py +0 -1
  336. mindspore/train/callback/_train_fault_tolerance.py +97 -16
  337. mindspore/train/data_sink.py +11 -2
  338. mindspore/train/dataset_helper.py +9 -0
  339. mindspore/train/model.py +135 -55
  340. mindspore/train/serialization.py +133 -111
  341. mindspore/train/summary/summary_record.py +13 -2
  342. mindspore/turbojpeg.dll +0 -0
  343. mindspore/utils/__init__.py +3 -2
  344. mindspore/utils/dryrun.py +0 -6
  345. mindspore/utils/runtime_execution_order_check.py +163 -77
  346. mindspore/utils/sdc_detect.py +68 -0
  347. mindspore/utils/utils.py +6 -9
  348. mindspore/vcmeta.dll +0 -0
  349. mindspore/vcruntime140.dll +0 -0
  350. mindspore/vcruntime140_1.dll +0 -0
  351. mindspore/version.py +1 -1
  352. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
  353. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +356 -394
  354. mindspore/_deprecated/jit.py +0 -198
  355. mindspore/experimental/es/__init__.py +0 -22
  356. mindspore/experimental/es/embedding_service.py +0 -891
  357. mindspore/experimental/es/embedding_service_layer.py +0 -581
  358. mindspore/profiler/parser/__init__.py +0 -14
  359. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  360. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  361. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  362. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  363. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  364. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  365. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  366. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  367. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  368. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  369. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  370. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  371. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  372. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  373. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  374. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  375. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  376. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  377. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  378. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  379. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  380. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  381. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  382. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  383. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  384. mindspore/profiler/parser/container.py +0 -229
  385. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  386. mindspore/profiler/parser/flops_parser.py +0 -531
  387. mindspore/profiler/parser/framework_enum.py +0 -111
  388. mindspore/profiler/parser/framework_parser.py +0 -464
  389. mindspore/profiler/parser/framework_struct.py +0 -61
  390. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  391. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  392. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  393. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  394. mindspore/profiler/parser/hccl_parser.py +0 -573
  395. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  396. mindspore/profiler/parser/integrator.py +0 -526
  397. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  398. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  399. mindspore/profiler/parser/minddata_parser.py +0 -186
  400. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  401. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  402. mindspore/profiler/parser/optime_parser.py +0 -250
  403. mindspore/profiler/parser/profiler_info.py +0 -213
  404. mindspore/profiler/parser/step_trace_parser.py +0 -666
  405. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
  406. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
  407. {mindspore-2.6.0rc1.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
@@ -15,24 +15,72 @@
15
15
  """
16
16
  Cifar10 reader class.
17
17
  """
18
- import builtins
18
+ import hashlib
19
19
  import io
20
+ import os
20
21
  import pickle
21
22
  import re
22
- import os
23
23
  import numpy as np
24
24
 
25
+ from mindspore import log as logger
25
26
  from ..shardutils import check_filename
26
27
 
27
28
  __all__ = ['Cifar10']
28
29
 
29
- safe_builtins = {
30
- 'range',
31
- 'complex',
32
- 'set',
33
- 'frozenset',
34
- 'slice',
35
- }
30
+
31
+ class CifarMD5Validator:
32
+ '''
33
+ MD5 check for cifar10-batch-py files
34
+ '''
35
+ def __init__(self):
36
+ self.md5_map = {'data_batch_1': 'c99cafc152244af753f735de768cd75f',
37
+ 'data_batch_2': 'd4bba439e000b95fd0a9bffe97cbabec',
38
+ 'data_batch_3': '54ebc095f3ab1f0389bbae665268c751',
39
+ 'data_batch_4': '634d18415352ddfa80567beed471001a',
40
+ 'data_batch_5': '482c414d41f54cd18b22e5b47cb7c3cb',
41
+ 'test_batch': '40351d587109b95175f43aff81a1287e'}
42
+
43
+ def calculate_md5(self, file_path):
44
+ """
45
+ Calculate MD5 hash of a file.
46
+
47
+ Args:
48
+ file_path (str): Path to the file to calculate MD5 for.
49
+
50
+ Returns:
51
+ MD5 hash string if successful, None otherwise.
52
+ """
53
+ try:
54
+ with open(file_path, 'rb') as f:
55
+ file_hash = hashlib.md5()
56
+ chunk = f.read(8192)
57
+ while chunk:
58
+ file_hash.update(chunk)
59
+ chunk = f.read(8192)
60
+ return file_hash.hexdigest()
61
+ except (IOError, OSError):
62
+ return None
63
+
64
+ def check(self, file_path, file_name):
65
+ """
66
+ Check if the file's MD5 matches the expected value.
67
+
68
+ Args:
69
+ file_path (str): Path to the file to check.
70
+ file_name (str): Key in md5_map to identify the expected MD5.
71
+
72
+ Returns:
73
+ True if MD5 matches, False otherwise (including if file doesn't exist).
74
+
75
+ Raises:
76
+ KeyError: If file_name is not found in md5_map.
77
+ """
78
+ expected_md5 = self.md5_map.get(file_name)
79
+ actual_md5 = self.calculate_md5(os.path.join(file_path, file_name))
80
+
81
+ if actual_md5 is None or expected_md5 is None or actual_md5 != expected_md5:
82
+ logger.warning(f"The MD5 value of {file_name} does not match the official CIFAR10 file."
83
+ "This file may pose a security risk.")
36
84
 
37
85
 
38
86
  class RestrictedUnpickler(pickle.Unpickler):
@@ -44,8 +92,6 @@ class RestrictedUnpickler(pickle.Unpickler):
44
92
  """
45
93
  def find_class(self, module, name):
46
94
  # Only allow safe classes from builtins and numpy
47
- if module == "builtins" and name in safe_builtins:
48
- return getattr(builtins, name)
49
95
  if module == "numpy.core.multiarray" and name == "_reconstruct":
50
96
  return getattr(np.core.multiarray, name)
51
97
  if module == "numpy":
@@ -89,6 +135,7 @@ class Cifar10:
89
135
  self.one_hot = one_hot
90
136
  self.images = None
91
137
  self.labels = None
138
+ self.validator = CifarMD5Validator()
92
139
 
93
140
  def load_data(self):
94
141
  """
@@ -104,12 +151,14 @@ class Cifar10:
104
151
  for file in files:
105
152
  if re.match("data_batch_*", file):
106
153
  real_file_path = os.path.realpath(self.path)
154
+ self.validator.check(real_file_path, file)
107
155
  with open(os.path.join(real_file_path, file), 'rb') as f: # load train data
108
156
  dic = restricted_loads(f.read())
109
157
  images = np.r_[images, dic[b"data"].reshape([-1, 3, 32, 32])]
110
158
  labels.append(dic[b"labels"])
111
159
  elif re.match("test_batch", file): # load test data
112
160
  real_file_path = os.path.realpath(self.path)
161
+ self.validator.check(real_file_path, file)
113
162
  with open(os.path.join(real_file_path, file), 'rb') as f:
114
163
  dic = restricted_loads(f.read())
115
164
  test_images = np.array(dic[b"data"].reshape([-1, 3, 32, 32]))
@@ -49,6 +49,11 @@ class Cifar10ToMR:
49
49
  >>> mindrecord_file = "/path/to/mindrecord/file"
50
50
  >>> cifar10_to_mr = Cifar10ToMR(cifar10_dir, mindrecord_file)
51
51
  >>> cifar10_to_mr.transform()
52
+
53
+ .. warning::
54
+ Cifar10ToMR.transform() uses `pickle` module implicitly, which is known to be insecure.
55
+ It is possible to construct malicious pickle data which will execute arbitrary code during unpickling.
56
+ Never load data that could have come from an untrusted source, or that could have been tampered with.
52
57
  """
53
58
 
54
59
  def __init__(self, source, destination):
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -33,7 +33,7 @@ from mindspore.ops.function.array_func import zeros_like_ext as zeros_like
33
33
  from mindspore.ops.function.array_func import unique_ext as unique
34
34
  from mindspore.ops.function.array_func import chunk_ext as chunk
35
35
  from mindspore.ops.functional_overload import empty
36
- from mindspore.ops.function.array_func import empty_like
36
+ from mindspore.ops.functional_overload import empty_like
37
37
  from mindspore.ops.function.math_func import isclose
38
38
  from mindspore.ops.auto_generate import abs
39
39
  from mindspore.ops.auto_generate import clone
@@ -63,7 +63,7 @@ from mindspore.ops.auto_generate import stack_ext as stack
63
63
  # 7
64
64
  from mindspore.ops.function.array_func import unsqueeze
65
65
  # 8
66
- from mindspore.ops.auto_generate import transpose_ext as transpose
66
+ from mindspore.ops.auto_generate import transpose_ext_view as transpose
67
67
  from mindspore.ops.auto_generate import batch_norm_elemt
68
68
  from mindspore.ops.auto_generate import batch_norm_gather_stats_with_counts
69
69
  from mindspore.ops.auto_generate import batch_norm_stats
@@ -291,7 +291,7 @@ from mindspore.ops.function.nn_func import softmax_ext
291
291
  # 118
292
292
 
293
293
  # 119
294
-
294
+ from mindspore.ops.functional_overload import any
295
295
  # 120
296
296
  from mindspore.ops.auto_generate import isneginf_ext as isneginf
297
297
  # 121
@@ -364,7 +364,7 @@ from mindspore.ops.function.array_func import scatter_add_ext as scatter_add
364
364
  # 289
365
365
  from mindspore.ops.auto_generate import sign
366
366
 
367
- from mindspore.ops.auto_generate import select_ext as select
367
+ from mindspore.ops.auto_generate import select_ext_view as select
368
368
 
369
369
  # 301
370
370
  from mindspore.ops.function.math_func import tan
@@ -478,7 +478,7 @@ from mindspore.ops.auto_generate import log2_ext as log2
478
478
  from mindspore.ops.function.math_func import isnan_ext as isnan
479
479
 
480
480
  # 916
481
- from mindspore.ops.auto_generate import index_add_ext as index_add
481
+ from mindspore.ops.functional_overload import index_add
482
482
 
483
483
  # 1007
484
484
  from mindspore.ops.auto_generate import t_ext as t
@@ -490,46 +490,6 @@ from mindspore.ops.auto_generate.gen_ops_prim import equal_ext_op
490
490
  from mindspore.ops.function.array_func import unbind_ext as unbind
491
491
 
492
492
 
493
- def any(input, dim=None, keepdim=False):
494
- r"""
495
- Tests if any element in `input` evaluates to `True` along the given axes.
496
-
497
- Args:
498
- input (Tensor): The input tensor.
499
- dim (Union[int, tuple(int), list(int), Tensor], optional): The dimensions to reduce. If ``None`` ,
500
- all dimensions are reduced. Default ``None`` .
501
- keepdim (bool, optional): Whether the output tensor has dim retained or not. Default ``False`` .
502
-
503
- Returns:
504
- Tensor
505
-
506
- Supported Platforms:
507
- ``Ascend`` ``GPU`` ``CPU``
508
-
509
- Examples:
510
- >>> import mindspore
511
- >>> input = mindspore.tensor([[True, False], [True, True]])
512
- >>>
513
- >>> # case 1: By default, mindspore.mint.any tests along all the axes.
514
- >>> mindspore.mint.any(input)
515
- Tensor(shape=[], dtype=Bool, value= True)
516
- >>>
517
- >>> # case 2: Reduces a dimension along dim 1, with keepdim False.
518
- >>> mindspore.mint.any(input, dim=1)
519
- Tensor(shape=[2], dtype=Bool, value= [ True, True])
520
- >>>
521
- >>> # case 3: Reduces a dimension along dim (0, 1), with keepdim False.
522
- >>> mindspore.mint.any(input, dim=(0,1))
523
- Tensor(shape=[], dtype=Bool, value= True)
524
- >>>
525
- >>> # case 4: Reduces a dimension along dim [0, 1], with keepdim True.
526
- >>> mindspore.mint.any(input, dim=[0,1], keepdim=True)
527
- Tensor(shape=[1, 1], dtype=Bool, value=
528
- [[ True]])
529
- """
530
- return ops.functional.any(input, dim, keepdim)
531
-
532
-
533
493
  def all(input, dim=None, keepdim=False):
534
494
  r"""
535
495
  all(input) -> Tensor
@@ -717,7 +677,7 @@ def cummax(input, dim):
717
677
  \end{array}
718
678
 
719
679
  .. note::
720
- O2 mode is not supported in Ascend.
680
+ GE backend is not supported in Ascend.
721
681
 
722
682
  Args:
723
683
  input (Tensor): The input Tensor. Rank of `input` must be greater than 0.
@@ -24,6 +24,7 @@ Please see the `msrun start up
24
24
  for more details.
25
25
  """
26
26
  from __future__ import absolute_import
27
+ from mindspore.mint.distributed.distributed import TCPStore
27
28
  from mindspore.mint.distributed.distributed import (
28
29
  init_process_group,
29
30
  destroy_process_group,
@@ -70,6 +70,7 @@ from mindspore.ops.auto_generate.gen_ops_prim import (
70
70
  dist_comm_barrier_op,
71
71
  dist_comm_batch_isend_irecv_op,
72
72
  )
73
+ from mindspore._c_expression import TCPStoreClient, GroupOptions
73
74
 
74
75
  _pickler = pickle.Pickler
75
76
  _unpickler = pickle.Unpickler
@@ -137,6 +138,193 @@ def _tensor_to_object(tensor, tensor_size):
137
138
  return restricted_loads(buf)
138
139
 
139
140
 
141
+ class TCPStore:
142
+ """
143
+ A TCP-based distributed key-value store implementation.
144
+
145
+ Note:
146
+ - The function is implemented by CPU and does not involve any hardware operations related to Ascend.
147
+ - Currently, all parameters provided by the TCPStore class constructor are not supported.
148
+ The master node and port number are uniformly specified by the MindSpore framework.
149
+ The following parameters are provided, currently not supported and settings are invalid.
150
+ - The current TcpStore function is limited and only supports scenarios where the key is
151
+ less than 4k and the value is less than 1G. Complex scenarios are to be supported.
152
+ - The timeout interval for message sending and receiving in the TcpStore function is controlled by
153
+ the `MS_RECEIVE_MSG_TIMEOUT` environment variable, in seconds, with a default value of ``15``.
154
+ If a timeout occurs, the user needs to increase the configuration value.
155
+
156
+ Args:
157
+ host_name (str, invalid, optional): The hostname or IP Address the server store should run on.
158
+ Default is ``None``.
159
+ port (int, invalid, optional): The port on which the server store should listen for incoming requests.
160
+ Default is ``None``.
161
+ world_size (int, invalid, optional): The total number of store users (number of clients + 1 for the server).
162
+ Default is ``None`` (``None`` indicates a non-fixed number of store users).
163
+ is_master (bool, invalid, optional): True when initializing the server store and False for client stores.
164
+ Default is ``False``.
165
+ timeout (timedelta, invalid, optional): Timeout used by the store during initialization, Unit: seconds.
166
+ Default is ``300``.
167
+ wait_for_workers (bool, invalid, optional): Whether to wait for all the workers to connect with the server
168
+ store. This is only applicable when `world_size` is a fixed value. Default is ``True``.
169
+ multi_tenant (bool, invalid, optional): If ``True``, all ``TCPStore`` instances in the current process with
170
+ the same host/port will use the same underlying ``TCPServer``. Default is ``False``.
171
+ master_listen_fd (int, invalid, optional): If specified, the underlying ``TCPServer`` will listen on this file
172
+ descriptor, which must be a socket already bound to ``port``. Useful to avoid port assignment races
173
+ in some scenarios. Default is ``None`` (meaning the server creates a new socket and attempts to bind it
174
+ to ``port``).
175
+ use_libuv (bool, invalid, optional): If True, use libuv for ``TCPServer`` backend. Default is ``True``.
176
+
177
+ Returns:
178
+ TCPStore Object.
179
+
180
+ Supported Platforms:
181
+ ``Ascend``
182
+
183
+ Examples:
184
+ .. note::
185
+ Before running the following examples, you need to configure the communication environment variables.
186
+
187
+ For Ascend devices, it is recommended to use the msrun startup method
188
+ without any third-party or configuration file dependencies.
189
+ Please see the `msrun start up
190
+ <https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
191
+ for more details.
192
+
193
+ >>> from mindspore.mint.distributed import TCPStore
194
+ >>> store = TCPStore()
195
+ """
196
+
197
+ def __init__(self, host_name=None, port=None, world_size=None, is_master=False, timeout=300,
198
+ wait_for_workers=True, multi_tenant=False, master_listen_fd=None, use_libuv=True):
199
+ self.instance = TCPStoreClient.get_instance()
200
+
201
+
202
+ def set(self, key, value):
203
+ """
204
+ Inserts the key-value pair into the store based on the supplied `key` and
205
+ `value`. If `key` already exists in the store, it will overwrite the old
206
+ value with the new supplied `value`.
207
+
208
+ Args:
209
+ key (str): The key to be added to the store.
210
+ value (Union[bytes, str]): The value associated with `key` to be added to the store.
211
+
212
+ Raises:
213
+ TypeError: If `key` is not string.
214
+ TypeError: If `value` is not string or bytes.
215
+
216
+ Supported Platforms:
217
+ ``Ascend``
218
+
219
+ Examples:
220
+ .. note::
221
+ Before running the following examples, you need to configure the communication environment variables.
222
+
223
+ For Ascend devices, it is recommended to use the msrun startup method
224
+ without any third-party or configuration file dependencies.
225
+ Please see the `msrun start up
226
+ <https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
227
+ for more details.
228
+
229
+ >>> from mindspore.mint.distributed import TCPStore
230
+ >>> store = TCPStore()
231
+ >>> store.set("first_key", "first_value")
232
+ """
233
+ if not isinstance(key, str):
234
+ raise TypeError(
235
+ "For 'TCPStore.set', the argument 'key' must be type of string, "
236
+ "but got 'key' type : {}.".format(type(key))
237
+ )
238
+ if not isinstance(value, (str, bytes)):
239
+ raise TypeError(
240
+ "For 'TCPStore.set', the argument 'value' must be type of string or bytes, "
241
+ "but got 'value' type : {}.".format(type(value))
242
+ )
243
+ return self.instance.set(key, value)
244
+
245
+
246
+ def get(self, key):
247
+ """
248
+ Retrieves the value associated with the given `key` in the store. If `key` is not
249
+ present in the store, the function will return "".
250
+
251
+ Args:
252
+ key (str): The function will return the value associated with this key.
253
+
254
+ Returns:
255
+ bytes, Value associated with `key` if `key` is in the store.
256
+
257
+ Raises:
258
+ TypeError: If `key` is not string.
259
+
260
+ Supported Platforms:
261
+ ``Ascend``
262
+
263
+ Examples:
264
+ .. note::
265
+ Before running the following examples, you need to configure the communication environment variables.
266
+
267
+ For Ascend devices, it is recommended to use the msrun startup method
268
+ without any third-party or configuration file dependencies.
269
+ Please see the `msrun start up
270
+ <https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
271
+ for more details.
272
+
273
+ >>> from mindspore.mint.distributed import TCPStore
274
+ >>> store = TCPStore()
275
+ >>> store.set("first_key", "first_value")
276
+ >>> data = store.get("first_key")
277
+ >>> print(data)
278
+ """
279
+ if not isinstance(key, str):
280
+ raise TypeError(
281
+ "For 'TCPStore.get', the argument 'key' must be type of string, "
282
+ "but got 'key' type : {}.".format(type(key))
283
+ )
284
+ byte_data = self.instance.get(key)
285
+ return byte_data
286
+
287
+
288
+ def delete_key(self, key):
289
+ """
290
+ Deletes the key-value pair associated with `key` from the store.
291
+
292
+ Args:
293
+ key (str): The key to be deleted from the store.
294
+
295
+ Returns:
296
+ bool, ``True`` if `key` was deleted, otherwise ``False``.
297
+
298
+ Raises:
299
+ TypeError: If `key` is not string.
300
+
301
+ Supported Platforms:
302
+ ``CPU``
303
+
304
+ Examples:
305
+ .. note::
306
+ Before running the following examples, you need to configure the communication environment variables.
307
+
308
+ For Ascend devices, it is recommended to use the msrun startup method
309
+ without any third-party or configuration file dependencies.
310
+ Please see the `msrun start up
311
+ <https://www.mindspore.cn/tutorials/en/master/parallel/msrun_launcher.html>`_
312
+ for more details.
313
+
314
+ >>> from mindspore.mint.distributed import TCPStore
315
+ >>> store = TCPStore()
316
+ >>> store.set("first_key", "first_value")
317
+ >>> # This should return true
318
+ >>> store.delete_key("first_key")
319
+ """
320
+ if not isinstance(key, str):
321
+ raise TypeError(
322
+ "For 'TCPStore.delete_key', the argument 'key' must be type of string, "
323
+ "but got 'key' type : {}.".format(type(key))
324
+ )
325
+ return self.instance.delete_key(key)
326
+
327
+
140
328
  def is_available():
141
329
  """
142
330
  Checks if distributed module is available.
@@ -470,7 +658,19 @@ def new_group(ranks=None,
470
658
  when backend is ``"hccl"`` will use Huawei Collective Communication Library(HCCL).
471
659
  when backend is ``"mccl"`` will use MindSpore Collective Communication Library(MCCL).
472
660
  If ``None``, which means ``"hccl"`` in Ascend. Default is ``None``.
473
- pg_options (str, invalid): Currently it is a reserved parameter.
661
+ pg_options (GroupOptions, optional): Additional communication group configuration parameters.
662
+ The backend will automatically select supported parameters and apply them during group
663
+ initialization. i.e. for the ``HCCL`` backend, ``hccl_config`` can be specified so that
664
+ group initialization configurations can be applied. Default is ``None``.
665
+
666
+ `GroupOptions` is defined as a class that can be instantiated as a python object.
667
+
668
+ .. code-block::
669
+
670
+ GroupOptions {
671
+ hccl_config(dict)
672
+ }
673
+
474
674
  use_local_synchronization (bool, invalid): Currently it is a reserved parameter.
475
675
  group_desc (str, invalid): Currently it is a reserved parameter.
476
676
 
@@ -511,8 +711,11 @@ def new_group(ranks=None,
511
711
  if not isinstance(backend, str) or backend not in ("hccl", "mccl"):
512
712
  raise TypeError(f"the input backend must be hccl or mccl, but got {backend}")
513
713
  group = backend + "_" + str(len(ranks)) + "_" + hashlib.sha1(bytes("_".join(map(str, ranks)), "utf-8")).hexdigest()
714
+ if pg_options is not None:
715
+ if not isinstance(pg_options, GroupOptions):
716
+ raise TypeError("pg_options must be type GroupOptions, but got {}".format(type(pg_options)))
514
717
  try:
515
- create_group(group, ranks)
718
+ create_group(group, ranks, pg_options)
516
719
  except RuntimeError as e:
517
720
  logger.warning(e)
518
721
  group = ""
@@ -813,7 +1016,7 @@ def all_reduce(tensor, op=ReduceOp.SUM, group=None, async_op=False):
813
1016
  RuntimeError: If device target is invalid, or backend is invalid, or distributed initialization fails.
814
1017
 
815
1018
  Supported Platforms:
816
- ``Ascend``
1019
+ ``Ascend`` ``CPU``
817
1020
 
818
1021
  Examples:
819
1022
  .. note::
@@ -1589,7 +1792,7 @@ def barrier(group=None, async_op=False, device_ids=None):
1589
1792
  RuntimeError: If backend is invalid, or distributed initialization fails.
1590
1793
 
1591
1794
  Supported Platforms:
1592
- ``Ascend``
1795
+ ``Ascend`` ``CPU``
1593
1796
 
1594
1797
  Examples:
1595
1798
  .. note::
@@ -1647,7 +1850,7 @@ def send(tensor, dst=0, group=None, tag=0):
1647
1850
  ValueError: If the `dst` process rank id is same as the current process.
1648
1851
 
1649
1852
  Supported Platforms:
1650
- ``Ascend``
1853
+ ``Ascend`` ``CPU``
1651
1854
 
1652
1855
  Examples:
1653
1856
  .. note::
@@ -1725,7 +1928,7 @@ def recv(tensor, src=0, group=None, tag=0):
1725
1928
  ValueError: If the rank ID of the process is greater than the rank size of the communication group.
1726
1929
 
1727
1930
  Supported Platforms:
1728
- ``Ascend``
1931
+ ``Ascend`` ``CPU``
1729
1932
 
1730
1933
  Examples:
1731
1934
  .. note::
@@ -2018,10 +2221,10 @@ def all_to_all(output_tensor_list, input_tensor_list, group=None, async_op=False
2018
2221
  recv_shape_list = []
2019
2222
 
2020
2223
  for tensor in input_tensor_list:
2021
- send_numel_list.append(tensor.size)
2224
+ send_numel_list.append(tensor.numel())
2022
2225
  send_flatten_tensor.append(tensor.reshape(-1))
2023
2226
  for tensor in output_tensor_list:
2024
- recv_numel_list.append(tensor.size)
2227
+ recv_numel_list.append(tensor.numel())
2025
2228
  recv_shape_list.append(tensor.shape)
2026
2229
 
2027
2230
  send_flatten_tensor = cat(send_flatten_tensor)
@@ -2810,7 +3013,7 @@ def broadcast_object_list(object_list, src=0, group=None, device=None):
2810
3013
  offset = 0
2811
3014
  for i, item in enumerate(object_size):
2812
3015
  obj_size = item
2813
- obj_view = object_tensor[offset : offset + obj_size]
3016
+ obj_view = object_tensor[offset: offset + obj_size]
2814
3017
  offset += obj_size
2815
3018
  object_list[i] = _tensor_to_object(obj_view, obj_size)
2816
3019
 
@@ -1189,7 +1189,7 @@ class PixelShuffle(Cell):
1189
1189
  >>> pixel_shuffle = mint.nn.PixelShuffle(3)
1190
1190
  >>> input = mint.randn(1, 9, 4, 4)
1191
1191
  >>> output = pixel_shuffle(input)
1192
- >>> print(output.shape())
1192
+ >>> print(output.shape)
1193
1193
  [1, 1, 12, 12]
1194
1194
  """
1195
1195
 
@@ -67,7 +67,7 @@ from mindspore.ops.auto_generate import prelu
67
67
  # 20
68
68
 
69
69
  # 21
70
- from mindspore.ops.function.nn_func import conv3d_ext as conv3d
70
+ from mindspore.ops.functional_overload import conv3d
71
71
  # 22
72
72
 
73
73
  # 23
@@ -118,7 +118,8 @@ from mindspore.ops.auto_generate import soft_margin_loss
118
118
  # 45
119
119
 
120
120
  # 46
121
- from mindspore.ops.functional import silu
121
+ from mindspore.ops.auto_generate import silu as silu_func
122
+ from mindspore.ops.auto_generate import inplace_silu
122
123
  # 47
123
124
 
124
125
  # 48
@@ -283,6 +284,52 @@ from mindspore.ops.functional import adaptive_avg_pool2d_ext as adaptive_avg_poo
283
284
  from mindspore.ops.function.nn_func import cross_entropy_ext as cross_entropy
284
285
  from mindspore.ops.function.nn_func import nll_loss_ext as nll_loss
285
286
 
287
+ def silu(input, inplace=False):
288
+ r"""
289
+ Computes Sigmoid Linear Unit of input element-wise. The SiLU function is defined as:
290
+
291
+ .. math::
292
+
293
+ \text{SiLU}(x) = x * \sigma(x),
294
+
295
+ where :math:`x` is an element of the input, :math:`\sigma(x)` is Sigmoid function.
296
+
297
+ .. math::
298
+
299
+ \text{sigma}(x_i) = \frac{1}{1 + \exp(-x_i)},
300
+
301
+ SiLU Function Graph:
302
+
303
+ .. image:: ../images/SiLU.png
304
+ :align: center
305
+
306
+ Args:
307
+ input (Tensor): `input` is :math:`x` in the preceding formula. Input with the data type
308
+ float16 or float32.
309
+ inplace (bool, optional): If it is ``True``, enable the in place update function. Default value: ``False``.
310
+
311
+ Returns:
312
+ Tensor, with the same type and shape as the `input`.
313
+
314
+ Raises:
315
+ TypeError: If dtype of `input` is neither float16 nor float32.
316
+
317
+ Supported Platforms:
318
+ ``Ascend`` ``GPU`` ``CPU``
319
+
320
+ Examples:
321
+ >>> import mindspore
322
+ >>> from mindspore import Tensor, mint
323
+ >>> import numpy as np
324
+ >>> input = Tensor(np.array([-1, 2, -3, 2, -1]), mindspore.float16)
325
+ >>> output = mint.nn.functional.silu(input, inplace=False)
326
+ >>> print(output)
327
+ [-0.269 1.762 -0.1423 1.762 -0.269]
328
+ """
329
+ if inplace:
330
+ return inplace_silu(input)
331
+ return silu_func(input)
332
+
286
333
 
287
334
  def elu(input, alpha=1.0, inplace=False):
288
335
  r"""
@@ -511,7 +558,10 @@ def binary_cross_entropy(input, target, weight=None, reduction='mean'):
511
558
  \end{cases}
512
559
 
513
560
  .. warning::
514
- - The value of `input` must range from `0` to `l`.
561
+ The value of `input` must range from `0` to `l`.
562
+
563
+ .. note::
564
+ Currently, when the platform is Ascend, all gradient calculations are performed on NPU.
515
565
 
516
566
  Args:
517
567
  input (Tensor): The predictive value whose data type must be float16 or float32.
@@ -955,9 +1005,6 @@ def threshold(input, threshold, value, inplace=False): # pylint: disable=W0621
955
1005
  \text{value}, &\text{ otherwise }
956
1006
  \end{cases}
957
1007
 
958
- .. warning::
959
- This is an experimental API that is subject to change or deletion.
960
-
961
1008
  Args:
962
1009
  input (Tensor): The input Tensor.
963
1010
  threshold (Union[int, float]): The value of the threshold.