mindspore 2.6.0__cp311-cp311-win_amd64.whl → 2.7.0rc1__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 (403) 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.cp311-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp311-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp311-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 +36 -61
  15. mindspore/_extends/parse/resources.py +39 -0
  16. mindspore/_extends/parse/standard_method.py +32 -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 +76 -15
  37. mindspore/common/api.py +193 -112
  38. mindspore/common/dtype.py +21 -11
  39. mindspore/common/dump.py +10 -15
  40. mindspore/common/generator.py +2 -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 +48 -83
  49. mindspore/communication/_comm_helper.py +46 -4
  50. mindspore/communication/management.py +79 -7
  51. mindspore/context.py +38 -23
  52. mindspore/dataset/core/config.py +3 -3
  53. mindspore/dataset/engine/datasets.py +20 -7
  54. mindspore/dataset/engine/datasets_user_defined.py +32 -2
  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 -5
  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 +1 -0
  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 +4 -44
  116. mindspore/mint/distributed/__init__.py +1 -0
  117. mindspore/mint/distributed/distributed.py +208 -5
  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 +122 -98
  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 +325 -499
  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 +86 -85
  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 +1 -1
  157. mindspore/nn/optim/adasum.py +2 -2
  158. mindspore/nn/optim/optimizer.py +1 -1
  159. mindspore/nn/optim/thor.py +2 -2
  160. mindspore/nn/probability/distribution/exponential.py +2 -1
  161. mindspore/nn/probability/distribution/poisson.py +2 -1
  162. mindspore/nn/sparse/sparse.py +3 -3
  163. mindspore/nn/wrap/cell_wrapper.py +34 -37
  164. mindspore/nn/wrap/grad_reducer.py +37 -37
  165. mindspore/nn/wrap/loss_scale.py +72 -74
  166. mindspore/numpy/array_creations.py +5 -5
  167. mindspore/numpy/fft.py +1 -1
  168. mindspore/numpy/math_ops.py +1 -1
  169. mindspore/opencv_core452.dll +0 -0
  170. mindspore/opencv_imgcodecs452.dll +0 -0
  171. mindspore/opencv_imgproc452.dll +0 -0
  172. mindspore/ops/_grad_experimental/grad_comm_ops.py +51 -13
  173. mindspore/ops/_grad_experimental/grad_debug_ops.py +14 -0
  174. mindspore/ops/_vmap/vmap_array_ops.py +6 -13
  175. mindspore/ops/_vmap/vmap_nn_ops.py +8 -16
  176. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +17 -8
  177. mindspore/ops/auto_generate/gen_extend_func.py +1 -51
  178. mindspore/ops/auto_generate/gen_ops_def.py +463 -257
  179. mindspore/ops/auto_generate/gen_ops_prim.py +1127 -885
  180. mindspore/ops/auto_generate/pyboost_inner_prim.py +31 -1
  181. mindspore/ops/composite/__init__.py +10 -0
  182. mindspore/ops/composite/base.py +8 -4
  183. mindspore/ops/composite/multitype_ops/__init__.py +12 -1
  184. mindspore/ops/composite/multitype_ops/_compile_utils.py +132 -108
  185. mindspore/ops/composite/multitype_ops/add_impl.py +70 -2
  186. mindspore/ops/composite/multitype_ops/div_impl.py +49 -0
  187. mindspore/ops/composite/multitype_ops/floordiv_impl.py +29 -0
  188. mindspore/ops/composite/multitype_ops/getitem_impl.py +11 -0
  189. mindspore/ops/composite/multitype_ops/mod_impl.py +5 -3
  190. mindspore/ops/composite/multitype_ops/mul_impl.py +49 -0
  191. mindspore/ops/composite/multitype_ops/setitem_impl.py +57 -0
  192. mindspore/ops/composite/multitype_ops/sub_impl.py +34 -0
  193. mindspore/ops/composite/multitype_ops/zeros_like_impl.py +14 -0
  194. mindspore/ops/function/__init__.py +3 -1
  195. mindspore/ops/function/_add_attr_func.py +11 -6
  196. mindspore/ops/function/array_func.py +7 -94
  197. mindspore/ops/function/debug_func.py +4 -3
  198. mindspore/ops/function/grad/grad_func.py +1 -1
  199. mindspore/ops/function/math_func.py +21 -367
  200. mindspore/ops/function/nn_func.py +26 -41
  201. mindspore/ops/function/other_func.py +4 -1
  202. mindspore/ops/function/random_func.py +31 -4
  203. mindspore/ops/functional.py +0 -2
  204. mindspore/ops/functional_overload.py +463 -6
  205. mindspore/ops/op_info_register.py +21 -0
  206. mindspore/ops/operations/__init__.py +5 -2
  207. mindspore/ops/operations/_custom_ops_utils.py +675 -8
  208. mindspore/ops/operations/_inner_ops.py +3 -6
  209. mindspore/ops/operations/_sequence_ops.py +1 -1
  210. mindspore/ops/operations/comm_ops.py +185 -26
  211. mindspore/ops/operations/custom_ops.py +235 -172
  212. mindspore/ops/operations/debug_ops.py +55 -4
  213. mindspore/ops/operations/image_ops.py +13 -13
  214. mindspore/ops/operations/manually_defined/ops_def.py +15 -16
  215. mindspore/ops/operations/math_ops.py +3 -4
  216. mindspore/ops/operations/nn_ops.py +5 -6
  217. mindspore/ops/primitive.py +6 -10
  218. mindspore/ops/tensor_method.py +36 -4
  219. mindspore/ops_generate/api/cpp_create_prim_instance_helper_generator.py +1 -1
  220. mindspore/ops_generate/api/functional_map_cpp_generator.py +10 -9
  221. mindspore/ops_generate/api/functions_cc_generator.py +58 -10
  222. mindspore/ops_generate/api/tensor_func_reg_cpp_generator.py +1 -1
  223. mindspore/ops_generate/common/base_generator.py +14 -0
  224. mindspore/ops_generate/common/gen_constants.py +7 -2
  225. mindspore/ops_generate/common/gen_utils.py +0 -19
  226. mindspore/ops_generate/common/op_proto.py +11 -4
  227. mindspore/ops_generate/common/template.py +88 -11
  228. mindspore/ops_generate/gen_ops.py +1 -1
  229. mindspore/ops_generate/op_def/lite_ops_cpp_generator.py +4 -4
  230. mindspore/ops_generate/op_def/ops_name_h_generator.py +0 -3
  231. mindspore/ops_generate/op_def/ops_primitive_h_generator.py +0 -4
  232. mindspore/ops_generate/op_def_py/op_prim_py_generator.py +5 -2
  233. mindspore/ops_generate/pyboost/auto_grad_impl_cc_generator.py +49 -8
  234. mindspore/ops_generate/pyboost/auto_grad_reg_cc_generator.py +2 -2
  235. mindspore/ops_generate/pyboost/gen_pyboost_func.py +31 -0
  236. mindspore/ops_generate/pyboost/op_template_parser.py +98 -72
  237. mindspore/ops_generate/pyboost/pyboost_functions_cpp_generator.py +70 -273
  238. mindspore/ops_generate/pyboost/pyboost_functions_h_generator.py +14 -6
  239. mindspore/ops_generate/pyboost/pyboost_functions_impl_cpp_generator.py +316 -0
  240. mindspore/ops_generate/pyboost/pyboost_functions_py_generator.py +1 -1
  241. mindspore/ops_generate/pyboost/pyboost_grad_function_cpp_generator.py +5 -3
  242. mindspore/ops_generate/pyboost/pyboost_inner_prim_generator.py +1 -1
  243. mindspore/ops_generate/pyboost/pyboost_internal_functions_cpp_generator.py +76 -0
  244. mindspore/ops_generate/pyboost/pyboost_internal_functions_h_generator.py +76 -0
  245. mindspore/ops_generate/pyboost/pyboost_internal_kernel_info_adapter_generator.py +125 -0
  246. mindspore/ops_generate/pyboost/pyboost_native_grad_functions_generator.py +4 -3
  247. mindspore/ops_generate/pyboost/pyboost_op_cpp_code_generator.py +348 -61
  248. mindspore/ops_generate/pyboost/pyboost_overload_functions_cpp_generator.py +1 -1
  249. mindspore/ops_generate/pyboost/pyboost_utils.py +118 -9
  250. mindspore/ops_generate/tensor_py_cc_generator.py +1 -24
  251. mindspore/parallel/_auto_parallel_context.py +4 -2
  252. mindspore/parallel/_cell_wrapper.py +106 -40
  253. mindspore/parallel/_parallel_serialization.py +1 -1
  254. mindspore/parallel/_ps_context.py +4 -6
  255. mindspore/parallel/_tensor.py +167 -12
  256. mindspore/parallel/_transformer/moe.py +1 -1
  257. mindspore/parallel/_transformer/transformer.py +13 -8
  258. mindspore/parallel/auto_parallel.py +12 -5
  259. mindspore/parallel/checkpoint_convert.py +3 -3
  260. mindspore/parallel/checkpoint_transform.py +3 -1
  261. mindspore/parallel/cluster/process_entity/_api.py +84 -48
  262. mindspore/parallel/cluster/process_entity/_utils.py +95 -7
  263. mindspore/parallel/cluster/run.py +43 -4
  264. mindspore/parallel/function/__init__.py +8 -1
  265. mindspore/parallel/function/reshard_func.py +1 -1
  266. mindspore/parallel/nn/__init__.py +15 -2
  267. mindspore/parallel/nn/parallel_cell_wrapper.py +9 -10
  268. mindspore/parallel/nn/parallel_grad_reducer.py +7 -6
  269. mindspore/parallel/shard.py +2 -2
  270. mindspore/parallel/transform_safetensors.py +462 -174
  271. mindspore/pgodb140.dll +0 -0
  272. mindspore/pgort140.dll +0 -0
  273. mindspore/profiler/__init__.py +2 -1
  274. mindspore/profiler/analysis/parser/timeline_assembly_factory/ascend_timeline_assembler.py +7 -7
  275. mindspore/profiler/analysis/parser/timeline_assembly_factory/base_timeline_assembler.py +3 -0
  276. mindspore/profiler/analysis/parser/timeline_assembly_factory/trace_view_container.py +3 -0
  277. mindspore/profiler/analysis/parser/timeline_creator/cpu_op_timeline_creator.py +3 -3
  278. mindspore/profiler/analysis/parser/timeline_creator/fwk_timeline_creator.py +3 -3
  279. mindspore/profiler/analysis/parser/timeline_creator/msprof_timeline_creator.py +4 -4
  280. mindspore/profiler/analysis/parser/timeline_creator/scope_layer_timeline_creator.py +3 -3
  281. mindspore/profiler/analysis/parser/timeline_event/fwk_event.py +4 -1
  282. mindspore/profiler/analysis/parser/timeline_event/timeline_event_pool.py +2 -1
  283. mindspore/profiler/analysis/task_manager.py +1 -1
  284. mindspore/profiler/analysis/viewer/ascend_communication_viewer.py +5 -1
  285. mindspore/profiler/analysis/viewer/ascend_integrate_viewer.py +2 -1
  286. mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +42 -22
  287. mindspore/profiler/analysis/viewer/ascend_step_trace_time_viewer.py +3 -2
  288. mindspore/profiler/analysis/viewer/ms_minddata_viewer.py +9 -5
  289. mindspore/profiler/analysis/viewer/ms_operator_details_viewer.py +132 -0
  290. mindspore/profiler/common/constant.py +16 -0
  291. mindspore/profiler/common/profiler_context.py +25 -27
  292. mindspore/profiler/common/profiler_info.py +0 -16
  293. mindspore/profiler/common/profiler_op_analyse.py +235 -0
  294. mindspore/profiler/common/profiler_output_path.py +23 -8
  295. mindspore/profiler/common/profiler_parameters.py +128 -35
  296. mindspore/profiler/dynamic_profile/__init__.py +0 -0
  297. mindspore/profiler/dynamic_profile/dynamic_monitor_proxy.py +39 -0
  298. mindspore/profiler/dynamic_profile/dynamic_profiler_config_context.py +666 -0
  299. mindspore/profiler/dynamic_profile/dynamic_profiler_utils.py +62 -0
  300. mindspore/profiler/dynamic_profiler.py +305 -314
  301. mindspore/profiler/envprofiler.py +12 -7
  302. mindspore/profiler/experimental_config.py +96 -6
  303. mindspore/profiler/mstx.py +33 -12
  304. mindspore/profiler/platform/__init__.py +2 -3
  305. mindspore/profiler/platform/npu_profiler.py +29 -19
  306. mindspore/profiler/profiler.py +35 -19
  307. mindspore/profiler/profiler_action_controller.py +64 -76
  308. mindspore/profiler/schedule.py +10 -4
  309. mindspore/rewrite/common/config.py +1 -0
  310. mindspore/rewrite/common/namer.py +1 -0
  311. mindspore/rewrite/common/namespace.py +1 -0
  312. mindspore/rewrite/node/node.py +31 -11
  313. mindspore/rewrite/parsers/assign_parser.py +1 -1
  314. mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
  315. mindspore/run_check/_check_version.py +7 -10
  316. mindspore/runtime/__init__.py +5 -5
  317. mindspore/runtime/event.py +10 -4
  318. mindspore/runtime/executor.py +60 -45
  319. mindspore/runtime/memory.py +21 -30
  320. mindspore/runtime/thread_bind_core.py +298 -164
  321. mindspore/safeguard/rewrite_obfuscation.py +12 -13
  322. mindspore/swresample-4.dll +0 -0
  323. mindspore/swscale-6.dll +0 -0
  324. mindspore/tbbmalloc.dll +0 -0
  325. mindspore/tinyxml2.dll +0 -0
  326. mindspore/train/_utils.py +6 -2
  327. mindspore/train/amp.py +43 -20
  328. mindspore/train/callback/__init__.py +5 -5
  329. mindspore/train/callback/_checkpoint.py +3 -6
  330. mindspore/train/callback/_flops_collector.py +1 -1
  331. mindspore/train/callback/_landscape.py +0 -1
  332. mindspore/train/callback/_train_fault_tolerance.py +71 -13
  333. mindspore/train/data_sink.py +11 -2
  334. mindspore/train/dataset_helper.py +9 -0
  335. mindspore/train/model.py +51 -33
  336. mindspore/train/serialization.py +133 -111
  337. mindspore/train/summary/summary_record.py +13 -2
  338. mindspore/turbojpeg.dll +0 -0
  339. mindspore/utils/__init__.py +3 -2
  340. mindspore/utils/dryrun.py +0 -6
  341. mindspore/utils/runtime_execution_order_check.py +162 -78
  342. mindspore/utils/sdc_detect.py +68 -0
  343. mindspore/utils/utils.py +6 -9
  344. mindspore/vcmeta.dll +0 -0
  345. mindspore/vcruntime140.dll +0 -0
  346. mindspore/vcruntime140_1.dll +0 -0
  347. mindspore/version.py +1 -1
  348. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +5 -4
  349. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +352 -390
  350. mindspore/_deprecated/jit.py +0 -198
  351. mindspore/experimental/es/__init__.py +0 -22
  352. mindspore/experimental/es/embedding_service.py +0 -891
  353. mindspore/experimental/es/embedding_service_layer.py +0 -581
  354. mindspore/profiler/parser/__init__.py +0 -14
  355. mindspore/profiler/parser/aicpu_data_parser.py +0 -272
  356. mindspore/profiler/parser/ascend_analysis/__init__.py +0 -14
  357. mindspore/profiler/parser/ascend_analysis/constant.py +0 -71
  358. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -180
  359. mindspore/profiler/parser/ascend_analysis/function_event.py +0 -185
  360. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +0 -136
  361. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +0 -131
  362. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +0 -104
  363. mindspore/profiler/parser/ascend_analysis/path_manager.py +0 -313
  364. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +0 -123
  365. mindspore/profiler/parser/ascend_analysis/tlv_decoder.py +0 -86
  366. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +0 -75
  367. mindspore/profiler/parser/ascend_cluster_generator.py +0 -116
  368. mindspore/profiler/parser/ascend_communicate_generator.py +0 -314
  369. mindspore/profiler/parser/ascend_flops_generator.py +0 -116
  370. mindspore/profiler/parser/ascend_fpbp_generator.py +0 -82
  371. mindspore/profiler/parser/ascend_hccl_generator.py +0 -271
  372. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  373. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  374. mindspore/profiler/parser/ascend_msprof_exporter.py +0 -282
  375. mindspore/profiler/parser/ascend_msprof_generator.py +0 -187
  376. mindspore/profiler/parser/ascend_op_generator.py +0 -334
  377. mindspore/profiler/parser/ascend_steptrace_generator.py +0 -94
  378. mindspore/profiler/parser/ascend_timeline_generator.py +0 -545
  379. mindspore/profiler/parser/base_timeline_generator.py +0 -483
  380. mindspore/profiler/parser/container.py +0 -229
  381. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +0 -697
  382. mindspore/profiler/parser/flops_parser.py +0 -531
  383. mindspore/profiler/parser/framework_enum.py +0 -111
  384. mindspore/profiler/parser/framework_parser.py +0 -464
  385. mindspore/profiler/parser/framework_struct.py +0 -61
  386. mindspore/profiler/parser/gpu_analysis/__init__.py +0 -14
  387. mindspore/profiler/parser/gpu_analysis/function_event.py +0 -44
  388. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +0 -89
  389. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +0 -72
  390. mindspore/profiler/parser/hccl_parser.py +0 -573
  391. mindspore/profiler/parser/hwts_log_parser.py +0 -122
  392. mindspore/profiler/parser/integrator.py +0 -526
  393. mindspore/profiler/parser/memory_usage_parser.py +0 -277
  394. mindspore/profiler/parser/minddata_analyzer.py +0 -800
  395. mindspore/profiler/parser/minddata_parser.py +0 -186
  396. mindspore/profiler/parser/minddata_pipeline_parser.py +0 -299
  397. mindspore/profiler/parser/op_intermediate_parser.py +0 -149
  398. mindspore/profiler/parser/optime_parser.py +0 -250
  399. mindspore/profiler/parser/profiler_info.py +0 -213
  400. mindspore/profiler/parser/step_trace_parser.py +0 -666
  401. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
  402. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
  403. {mindspore-2.6.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
@@ -25,7 +25,7 @@ import mindspore.common.dtype as mstype
25
25
  from mindspore.common.parameter import Parameter
26
26
  from mindspore.common.initializer import initializer, HeUniform, Uniform, _calculate_fan_in_and_fan_out
27
27
  from mindspore import _checkparam as Validator
28
- from mindspore._checkparam import once, twice, triple
28
+ from mindspore._checkparam import once_sequence, twice_sequence, triple_sequence
29
29
  from mindspore._extends import cell_attr_register
30
30
  from mindspore.nn.cell import Cell
31
31
  from mindspore.ops.functional import isconstant
@@ -52,12 +52,11 @@ class _Conv(Cell):
52
52
  dtype=mstype.float32):
53
53
  """Initialize _Conv."""
54
54
  super(_Conv, self).__init__()
55
- if groups <= 0:
56
- raise ValueError('groups must be a positive integer.')
57
- self.in_channels = in_channels
55
+ self.groups = Validator.check_positive_int(groups)
56
+ self.in_channels = Validator.check_non_negative_int(in_channels)
57
+ self.out_channels = Validator.check_non_negative_int(out_channels)
58
58
  if self.in_channels % groups != 0:
59
59
  raise ValueError('in_channels must be divisible by groups.')
60
- self.out_channels = out_channels
61
60
  if self.out_channels % groups != 0:
62
61
  raise ValueError('out_channels must be divisible by groups.')
63
62
  valid_padding_strings = {'same', 'valid'}
@@ -75,7 +74,6 @@ class _Conv(Cell):
75
74
  raise ValueError(f"The value of 'padding_mode' must be one of '{valid_padding_modes}', "
76
75
  f"but got {padding_mode}.")
77
76
  self.transposed = transposed
78
- self.groups = Validator.check_positive_int(groups)
79
77
  self.output_padding = output_padding
80
78
  self.padding_mode = padding_mode
81
79
  self.kernel_size = kernel_size
@@ -148,12 +146,12 @@ class Conv1d(_Conv):
148
146
  .. math::
149
147
 
150
148
  \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
151
- \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
149
+ \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{input}(N_i, k)})
152
150
 
153
151
 
154
152
  where :math:`bias` is the output channel bias, :math:`ccor` is
155
153
  the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_,
156
- :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
154
+ :math:`weight` is the convolution kernel value and :math:`input` represents the input feature map.
157
155
 
158
156
  - :math:`i` corresponds to the batch number, the range is :math:`[0, N-1]`,
159
157
  where :math:`N` is the batch size of the input.
@@ -168,14 +166,14 @@ class Conv1d(_Conv):
168
166
 
169
167
  Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
170
168
  output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
171
- kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
169
+ kernel in the :math:`k`-th channel, and :math:`{input}(N_i, k)` represents the slice of the :math:`k`-th input
172
170
  channel in the :math:`i`-th batch of the input feature map.
173
171
 
174
172
  The shape of the convolutional kernel is given by :math:`(\text{kernel_size})`,
175
173
  where :math:`\text{kernel_size}` is the length of the kernel.
176
174
  If we consider the input and output channels as well as the `groups` parameter, the complete kernel shape
177
175
  will be :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size})`,
178
- where `groups` is the number of groups dividing `x`'s input channel when applying groups convolution.
176
+ where `groups` is the number of groups dividing `input`'s input channel when applying groups convolution.
179
177
 
180
178
  For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
181
179
  <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
@@ -184,12 +182,12 @@ class Conv1d(_Conv):
184
182
  in_channels (int): The channel number of the input tensor of the Conv1d layer.
185
183
  out_channels (int): The channel number of the output tensor of the Conv1d layer.
186
184
  kernel_size (Union[int, tuple[int], list[int]]): Specifies the length of the 1D convolution kernel.
187
- The data type is an integer or a tuple of one integer.
185
+ The data type is an integer or a tuple/list of one integer.
188
186
  stride (Union[int, tuple[int], list[int]], optional): The movement stride of the 1D convolution kernel.
189
- The data type is an integer or a tuple of one integer. Default: ``1`` .
187
+ The data type is an integer or a tuple/list of one integer. Default: ``1`` .
190
188
  padding (Union[int, tuple[int], list[int], str], optional): The number of padding
191
189
  on the input.
192
- The data type is an integer or a tuple of one integer or string {``"valid"``, ``"same"``}.
190
+ The data type is an integer or a tuple/list of one integer or string {``"valid"``, ``"same"``}.
193
191
  The value should be greater than or equal to 0. Default: ``0`` .
194
192
 
195
193
  - ``"same"``: Pad the input around its edges so that the shape of input and output
@@ -203,9 +201,10 @@ class Conv1d(_Conv):
203
201
  be discarded.
204
202
 
205
203
  padding_mode (str, optional): Specifies the padding mode with a padding value of 0. It can be set to:
206
- ``"zeros"`` , ``"reflect"`` ``"circular"`` or ``"replicate"`` . Default: ``"zeros"`` .
207
- dilation (Union[int, tuple[int], list[int]], optional): Specifies the dilation rate to use for dilated convolution.
208
- It can be a single int or a tuple of 1 integer.
204
+ ``"zeros"`` , ``"reflect"`` or ``"replicate"`` . Default: ``"zeros"`` .
205
+ dilation (Union[int, tuple[int], list[int]], optional): Specifies the dilation
206
+ rate to use for dilated convolution.
207
+ It can be a single int or a tuple/list of 1 integer.
209
208
  Assuming :math:`dilation=(d)`, the convolutional kernel samples the input with a
210
209
  spacing of :math:`d-1` elements in the length direction.
211
210
  Default: ``1`` .
@@ -214,16 +213,22 @@ class Conv1d(_Conv):
214
213
  this 1D convolution layer also can be called 1D depthwise convolution layer. Default: ``1`` .
215
214
  The following restraints must be met:
216
215
 
217
- - :math:`(C_{in} \text{ % } \text{groups} == 0)`
218
- - :math:`(C_{out} \text{ % } \text{groups} == 0)`
219
- - :math:`(C_{out} >= \text{groups})`
220
- - :math:`(\text{kernel_size[1]} = C_{in} / \text{groups})`
216
+ - :math:`(C_{in} \text{ % } \text{groups} == 0)`
217
+ - :math:`(C_{out} \text{ % } \text{groups} == 0)`
218
+ - :math:`(C_{out} >= \text{groups})`
219
+ - :math:`(\text{weight[1]} = C_{in} / \text{groups})`
221
220
 
222
221
  bias (bool, optional): Whether the Conv1d layer has a bias parameter. Default: ``True`` .
223
222
  dtype (:class:`mindspore.dtype`, optional): Dtype of Parameters. Default: ``None``, using ``mstype.float32``.
224
223
 
224
+ Variables:
225
+ - **weight** (Tensor) - The weight of the convolution layer, with shape :math:
226
+ `(C_{out}, C_{in} / \text{groups}, \text{kernel_size[0]})`.
227
+ - **bias** (Tensor) - The bias of the convolution layer, with shape :math:
228
+ `(C_{out})`. If bias is False, this will be None.
229
+
225
230
  Inputs:
226
- - **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, L_{in})` \
231
+ - **input** (Tensor) - Tensor of shape :math:`(N, C_{in}, L_{in})` \
227
232
  or :math:`(C_{in}, L_{in})`.
228
233
 
229
234
  Outputs:
@@ -258,7 +263,7 @@ class Conv1d(_Conv):
258
263
  RuntimeError: On Ascend, due to the limitation of the L1 cache size of different NPU chip, if input size or
259
264
  kernel size is too large, it may trigger an error.
260
265
  TypeError: If `in_channels`, `out_channels` or `groups` is not an int.
261
- TypeError: If `kernel_size`, `stride` or `dilation` is neither an int nor a tuple.
266
+ TypeError: If `kernel_size`, `stride` or `dilation` is neither an int nor a tuple/list.
262
267
  ValueError: If `in_channels`, `out_channels`, `kernel_size`, `stride` or `dilation` is less than 1.
263
268
  ValueError: If `padding` is less than 0.
264
269
  ValueError: If `padding` is `same` , `stride` is not equal to 1.
@@ -292,14 +297,14 @@ class Conv1d(_Conv):
292
297
  padding_mode='zeros',
293
298
  dtype=None):
294
299
  """Initialize Conv1d."""
295
- kernel_size_ = once(kernel_size)
296
- stride_ = once(stride)
297
- padding_ = padding if isinstance(padding, str) else once(padding)
298
- dilation_ = once(dilation)
300
+ kernel_size_ = once_sequence(kernel_size)
301
+ stride_ = once_sequence(stride)
302
+ padding_ = padding if isinstance(padding, str) else once_sequence(padding)
303
+ dilation_ = once_sequence(dilation)
299
304
  if not dtype:
300
305
  dtype = mstype.float32
301
306
  super(Conv1d, self).__init__(in_channels, out_channels, kernel_size_, stride_, padding_, dilation_, False,
302
- once(0), groups, bias, padding_mode, dtype)
307
+ once_sequence(0), groups, bias, padding_mode, dtype)
303
308
  if isinstance(padding, str) and padding_mode == "zeros":
304
309
  self.conv1d = conv1d_padding_op
305
310
  else:
@@ -327,11 +332,11 @@ class Conv2d(_Conv):
327
332
  .. math::
328
333
 
329
334
  \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
330
- \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
335
+ \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{Input}(N_i, k)})
331
336
 
332
337
  where :math:`bias` is the output channel bias, :math:`ccor` is
333
338
  the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_,
334
- :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
339
+ :math:`weight` is the convolution kernel value and :math:`Input` represents the input feature map.
335
340
 
336
341
  - :math:`i` corresponds to the batch number, the range is :math:`[0, N-1]`,
337
342
  where :math:`N` is the batch size of the input.
@@ -346,7 +351,7 @@ class Conv2d(_Conv):
346
351
 
347
352
  Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
348
353
  output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
349
- kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
354
+ kernel in the :math:`k`-th channel, and :math:`{Input}(N_i, k)` represents the slice of the :math:`k`-th input
350
355
  channel in the :math:`i`-th batch of the input feature map.
351
356
 
352
357
  The shape of the convolutional kernel is given by :math:`(\text{kernel_size[0]},\text{kernel_size[1]})`,
@@ -354,7 +359,7 @@ class Conv2d(_Conv):
354
359
  and :math:`\text{kernel_size[1]}` are the height and width of the kernel, respectively.
355
360
  If we consider the input and output channels as well as the `groups` parameter, the complete kernel shape
356
361
  will be :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size[0]}, \text{kernel_size[1]})`,
357
- where `groups` is the number of groups dividing `x`'s input channel when applying groups convolution.
362
+ where `groups` is the number of groups dividing `Input`'s input channel when applying groups convolution.
358
363
 
359
364
  For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
360
365
  <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
@@ -363,18 +368,18 @@ class Conv2d(_Conv):
363
368
  in_channels (int): The channel number of the input tensor of the Conv2d layer.
364
369
  out_channels (int): The channel number of the output tensor of the Conv2d layer.
365
370
  kernel_size (Union[int, tuple[int], list[int]]): Specifies the height and width of the 2D convolution kernel.
366
- The data type is an integer or a tuple of two integers. An integer represents the height
367
- and width of the convolution kernel. A tuple of two integers represents the height
371
+ The data type is an integer or a tuple/list of two integers. An integer represents the height
372
+ and width of the convolution kernel. A tuple/list of two integers represents the height
368
373
  and width of the convolution kernel respectively.
369
374
  stride (Union[int, tuple[int], list[int]], optional): The movement stride of the 2D convolution kernel.
370
- The data type is an integer or a tuple of two integers. An integer represents the movement step size
371
- in both height and width directions. A tuple of two integers represents the movement step size in the height
375
+ The data type is an integer or a tuple/list of two integers. An integer represents the movement step size
376
+ in both height and width directions. A tuple/list of two integers represents the movement step size in the height
372
377
  and width directions respectively. Default: ``1`` .
373
378
  padding (Union[int, tuple[int], list[int], str], optional): The number of padding
374
379
  on the height and width directions of the input.
375
- The data type is an integer or a tuple of two integers or string {``"valid"``, ``"same"``}.
380
+ The data type is an integer or a tuple/list of two integers or string {``"valid"``, ``"same"``}.
376
381
  If `padding` is an integer, then `padding_{H}` and `padding_{W}` are all equal to `padding`.
377
- If `padding` is a tuple of 2 integers, then `padding_{H}` and `padding_{W}`
382
+ If `padding` is a tuple/list of 2 integers, then `padding_{H}` and `padding_{W}`
378
383
  is equal to `padding[0]` and `padding[1]` respectively.
379
384
  The value should be greater than or equal to 0. Default: ``0`` .
380
385
 
@@ -389,13 +394,12 @@ class Conv2d(_Conv):
389
394
  be discarded.
390
395
 
391
396
  padding_mode (str, optional): Specifies the padding mode with a padding value of 0. It can be set to:
392
- ``"zeros"`` , ``"reflect"`` ``"circular"`` or ``"replicate"`` . Default: ``"zeros"`` .
393
- dilation (Union[int, tuple[int], list[int]], optional): Specifies the dilation rate to use for dilated convolution.
394
- It can be a single int or a tuple of 2 or 4 integers. A single int means the dilation size is the same
395
- in both the height and width directions. A tuple of two ints represents the dilation size in
396
- the height and width directions, respectively. For a tuple of four ints, the two ints correspond
397
- to (N, C) dimension are treated as 1, and the two correspond to (H, W) dimensions is the
398
- dilation size in the height and width directions respectively.
397
+ ``"zeros"`` , ``"reflect"`` or ``"replicate"`` . Default: ``"zeros"`` .
398
+ dilation (Union[int, tuple[int], list[int]], optional): Specifies the dilation rate to use
399
+ for dilated convolution.
400
+ It can be a single int or a tuple/list of 2 integers. A single int means the dilation size is the same
401
+ in both the height and width directions. A tuple/list of two ints represents the dilation size in
402
+ the height and width directions, respectively.
399
403
  Assuming :math:`dilation=(d0, d1)`, the convolutional kernel samples the input with a
400
404
  spacing of :math:`d0-1` elements in the height direction and :math:`d1-1` elements in the width direction.
401
405
  The values in the height and width dimensions are in the ranges [1, H] and [1, W], respectively.
@@ -408,43 +412,49 @@ class Conv2d(_Conv):
408
412
  - :math:`(C_{in} \text{ % } \text{groups} == 0)`
409
413
  - :math:`(C_{out} \text{ % } \text{groups} == 0)`
410
414
  - :math:`(C_{out} >= \text{groups})`
411
- - :math:`(\text{kernel_size[1]} = C_{in} / \text{groups})`
415
+ - :math:`(\text{weight[1]} = C_{in} / \text{groups})`
412
416
 
413
417
  bias (bool, optional): Whether the Conv2d layer has a bias parameter. Default: ``True`` .
414
418
  dtype (:class:`mindspore.dtype`, optional): Dtype of Parameters. Default: ``None``, using ``mstype.float32``.
415
419
 
420
+ Variables:
421
+ - **weight** (Tensor) - The weight of the convolution layer, with shape
422
+ :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size[0]}, \text{kernel_size[1]})`.
423
+ - **bias** (Tensor) - The bias of the convolution layer, with shape
424
+ :math:`(C_{out})`. If bias is False, this will be None.
425
+
416
426
  Inputs:
417
- - **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` \
418
- or :math:`(C_{in}, H_{in}, W_{in})`.
427
+ - **Input** (Tensor) - Tensor of shape :math:`(N, C_{in}, H_{in}, W_{in})` or :math:`(C_{in}, H_{in}, W_{in})`.
428
+ When it's an empty Tesnor, backpropagation is currently not supported.
419
429
 
420
430
  Outputs:
421
431
  Tensor of shape :math:`(N, C_{out}, H_{out}, W_{out})` or :math:`(C_{out}, H_{out}, W_{out})`.
422
-
432
+
423
433
  padding is ``'same'``:
424
-
434
+
425
435
  .. math::
426
436
  \begin{array}{ll} \\
427
- H_{out} = \left \lceil{\frac{H_{in}}{\text{stride[0]}}} \right \rceil \\
428
- W_{out} = \left \lceil{\frac{W_{in}}{\text{stride[1]}}} \right \rceil \\
437
+ H_{out} = \left \lceil{\frac{H_{in}}{\text{stride[0]}}} \right \rceil \\
438
+ W_{out} = \left \lceil{\frac{W_{in}}{\text{stride[1]}}} \right \rceil \\
429
439
  \end{array}
430
-
440
+
431
441
  padding is ``'valid'``:
432
-
442
+
433
443
  .. math::
434
444
  \begin{array}{ll} \\
435
- H_{out} = \left \lfloor{\frac{H_{in} - \text{dilation[0]} \times (\text{kernel_size[0]} - 1) - 1}
436
- {\text{stride[0]}}} \right \rfloor + 1 \\
437
- W_{out} = \left \lfloor{\frac{W_{in} - \text{dilation[1]} \times (\text{kernel_size[1]} - 1) - 1}
438
- {\text{stride[1]}}} \right \rfloor + 1 \\
445
+ H_{out} = \left \lfloor{\frac{H_{in} - \text{dilation[0]} \times (\text{kernel_size[0]} - 1) - 1}
446
+ {\text{stride[0]}}} \right \rfloor + 1 \\
447
+ W_{out} = \left \lfloor{\frac{W_{in} - \text{dilation[1]} \times (\text{kernel_size[1]} - 1) - 1}
448
+ {\text{stride[1]}}} \right \rfloor + 1 \\
439
449
  \end{array}
440
-
450
+
441
451
  padding is int or tuple/list:
442
-
452
+
443
453
  .. math::
444
454
  \begin{array}{ll} \\
445
- H_{out} = \left \lfloor{\frac{H_{in} + padding[0] + padding[1] - \text{dilation[0]} \times
455
+ H_{out} = \left \lfloor{\frac{H_{in} + 2 \times padding[0] - \text{dilation[0]} \times
446
456
  (\text{kernel_size[0]} - 1) - 1}{\text{stride[0]}}} \right \rfloor + 1 \\
447
- W_{out} = \left \lfloor{\frac{W_{in} + padding[2] + padding[3] - \text{dilation[1]} \times
457
+ W_{out} = \left \lfloor{\frac{W_{in} + 2 \times padding[1] - \text{dilation[1]} \times
448
458
  (\text{kernel_size[1]} - 1) - 1}{\text{stride[1]}}} \right \rfloor + 1 \\
449
459
  \end{array}
450
460
 
@@ -454,7 +464,7 @@ class Conv2d(_Conv):
454
464
  RuntimeError: On Ascend, due to the limitation of the L1 cache size of different NPU chip, if input size or
455
465
  kernel size is too large, it may trigger an error.
456
466
  TypeError: If `in_channels`, `out_channels` or `groups` is not an int.
457
- TypeError: If `kernel_size`, `stride` or `dilation` is neither an int nor a tuple.
467
+ TypeError: If `kernel_size`, `stride` or `dilation` is neither an int nor a tuple/list.
458
468
  ValueError: If `in_channels`, `out_channels`, `kernel_size`, `stride` or `dilation` is less than 1.
459
469
  ValueError: If `padding` is less than 0.
460
470
  ValueError: If `padding` is `same` , `stride` is not equal to 1.
@@ -488,14 +498,14 @@ class Conv2d(_Conv):
488
498
  padding_mode='zeros',
489
499
  dtype=None):
490
500
  """Initialize Conv2d."""
491
- kernel_size_ = twice(kernel_size)
492
- stride_ = twice(stride)
493
- padding_ = padding if isinstance(padding, str) else twice(padding)
494
- dilation_ = twice(dilation)
501
+ kernel_size_ = twice_sequence(kernel_size)
502
+ stride_ = twice_sequence(stride)
503
+ padding_ = padding if isinstance(padding, str) else twice_sequence(padding)
504
+ dilation_ = twice_sequence(dilation)
495
505
  if not dtype:
496
506
  dtype = mstype.float32
497
507
  super(Conv2d, self).__init__(in_channels, out_channels, kernel_size_, stride_, padding_, dilation_, False,
498
- twice(0), groups, bias, padding_mode, dtype)
508
+ twice_sequence(0), groups, bias, padding_mode, dtype)
499
509
  if isinstance(padding, str) and padding_mode == "zeros":
500
510
  self.conv2d = conv2d_padding_op
501
511
  else:
@@ -524,11 +534,11 @@ class Conv3d(_Conv):
524
534
  .. math::
525
535
 
526
536
  \text{out}(N_i, C_{\text{out}_j}) = \text{bias}(C_{\text{out}_j}) +
527
- \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{X}(N_i, k)})
537
+ \sum_{k = 0}^{C_{in} - 1} \text{ccor}({\text{weight}(C_{\text{out}_j}, k), \text{input}(N_i, k)})
528
538
 
529
539
  where :math:`bias` is the output channel bias, :math:`ccor` is
530
540
  the `cross-correlation <https://en.wikipedia.org/wiki/Cross-correlation>`_,
531
- :math:`weight` is the convolution kernel value and :math:`X` represents the input feature map.
541
+ :math:`weight` is the convolution kernel value and :math:`input` represents the input feature map.
532
542
 
533
543
  Here are the indices' meanings:
534
544
 
@@ -545,7 +555,7 @@ class Conv3d(_Conv):
545
555
 
546
556
  Therefore, in the above formula, :math:`{bias}(C_{\text{out}_j})` represents the bias of the :math:`j`-th
547
557
  output channel, :math:`{weight}(C_{\text{out}_j}, k)` represents the slice of the :math:`j`-th convolutional
548
- kernel in the :math:`k`-th channel, and :math:`{X}(N_i, k)` represents the slice of the :math:`k`-th input
558
+ kernel in the :math:`k`-th channel, and :math:`{input}(N_i, k)` represents the slice of the :math:`k`-th input
549
559
  channel in the :math:`i`-th batch of the input feature map.
550
560
 
551
561
  The shape of the convolutional kernel is given by
@@ -555,7 +565,7 @@ class Conv3d(_Conv):
555
565
  If we consider the input and output channels as well as the `groups` parameter, the complete kernel shape
556
566
  will be
557
567
  :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size[0]}, \text{kernel_size[1]}, \text{kernel_size[2]})`,
558
- where `groups` is the number of groups dividing `x`'s input channel when applying groups convolution.
568
+ where `groups` is the number of groups dividing `input`'s input channel when applying groups convolution.
559
569
 
560
570
  For more details about convolution layer, please refer to `Gradient Based Learning Applied to Document Recognition
561
571
  <http://vision.stanford.edu/cs598_spring07/papers/Lecun98.pdf>`_.
@@ -563,45 +573,59 @@ class Conv3d(_Conv):
563
573
  For the detail of limitations of the parameters, please refer to :func:`mindspore.mint.nn.functional.conv3d`.
564
574
 
565
575
  .. warning::
566
- This is an experimental API that is subject to change or deletion.
576
+ It is only supported on Atlas A2 Training Series Products.
567
577
 
568
578
  Args:
569
579
  in_channels (int): The channel number of the input tensor of the Conv3d layer.
570
580
  out_channels (int): The channel number of the output tensor of the Conv3d layer.
571
- kernel_size (Union[int, tuple[int], list[int]]): Specifies the height and width of the 3D convolution kernel.
572
- The data type is an integer or a tuple of two integers. An integer represents the height
573
- and width of the convolution kernel. A tuple of two integers represents the height
581
+ kernel_size (Union[int, tuple[int], list[int]]): Specifies the depth, height and width of the 3D convolution
582
+ kernel. The data type is an integer or a tuple/list of three integers. An integer represents the depth,
583
+ height and width of the convolution kernel. A tuple/list of three integers represents the depth, height
574
584
  and width of the convolution kernel respectively.
575
585
  stride (Union[int, tuple[int], list[int]], optional): The movement stride of the 3D convolution kernel.
576
- The data type is an integer or a tuple of three integers. An integer represents the movement step size
577
- in both height and width directions. A tuple of three integers represents the movement step size in the
586
+ The data type is an integer or a tuple/list of three integers. An integer represents the movement step size
587
+ in both height and width directions. A tuple/list of three integers represents the movement step size in the
578
588
  depth, height and width directions respectively. Default: ``1`` .
579
589
  padding (Union[int, tuple[int], list[int], str], optional): The number of padding
580
590
  on the depth, height and width directions of the input.
581
- The data type is an integer or string {``"valid"``, ``"same"``} or a tuple of three integers.
591
+ The data type is an integer or string {``"valid"``, ``"same"``} or a tuple/list of three integers.
582
592
  The value should be greater than or equal to 0. Default: ``0`` .
583
593
 
584
594
  - ``"same"``: Pad the input around its edges so that the shape of input and output
585
595
  are the same when `stride` is set to ``1``.
586
596
  The amount of padding to is calculated by the operator internally, If the amount is even, it is
587
597
  uniformly distributed around the input, if it is odd, the excess amount goes to the right/bottom side.
588
- If this mode is set, `padding` must be 0.
589
598
 
590
599
  - ``"valid"``: No padding is applied to the input, and the output returns the maximum
591
600
  possible height and width. Extra pixels that could not complete a full stride will
592
- be discarded. If this mode is set, `padding` must be 0.
601
+ be discarded.
593
602
 
594
603
  padding_mode (str, optional): Specifies the padding mode with a padding value of 0. It can be set to:
595
- ``"zeros"`` , ``"reflect"`` ``"circular"`` or ``"replicate"`` . Default: ``"zeros"`` .
604
+ ``"zeros"`` , ``"reflect"`` or ``"replicate"`` . Default: ``"zeros"`` .
596
605
  dilation (Union[int, tuple[int], list[int]], optional): Controlling the space between the kernel points.
597
606
  Default: ``1`` .
598
607
  groups (int, optional): Splits filter into groups, `in_channels` and `out_channels` must be
599
- divisible by `groups`. If the groups is equal to `in_channels` and `out_channels`. Default: ``1`` .
608
+ divisible by `groups`. If the groups is equal to `in_channels` and `out_channels`,
609
+ this 3D convolution layer also can be called 3D depthwise convolution layer. Default: ``1`` .
610
+ The following restraints must be met:
611
+
612
+ - :math:`(C_{in} \text{ % } \text{groups} == 0)`
613
+ - :math:`(C_{out} \text{ % } \text{groups} == 0)`
614
+ - :math:`(C_{out} >= \text{groups})`
615
+ - :math:`(\text{weight[1]} = C_{in} / \text{groups})`
616
+
600
617
  bias (bool, optional): Whether the Conv3d layer has a bias parameter. Default: ``True`` .
601
618
  dtype (:class:`mindspore.dtype`, optional): Dtype of Parameters. Default: ``None``, using ``mstype.float32``.
602
619
 
620
+ Variables:
621
+ - **weight** (Tensor) - The weight of the convolution layer, with shape
622
+ :math:`(C_{out}, C_{in} / \text{groups}, \text{kernel_size[0]},
623
+ \text{kernel_size[1]}, \text{kernel_size[2]})`.
624
+ - **bias** (Tensor) - The bias of the convolution layer, with shape
625
+ :math:`(C_{out})`. If bias is False, this will be None.
626
+
603
627
  Inputs:
604
- - **x** (Tensor) - Tensor of shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})` \
628
+ - **input** (Tensor) - Tensor of shape :math:`(N, C_{in}, D_{in}, H_{in}, W_{in})` \
605
629
  or :math:`(C_{in}, D_{in}, H_{in}, W_{in})`.
606
630
 
607
631
  Outputs:
@@ -621,29 +645,29 @@ class Conv3d(_Conv):
621
645
 
622
646
  .. math::
623
647
  \begin{array}{ll} \\
624
- D_{out} = \left \lceil{\frac{D_{in} - \text{dilation[0]} \times (\text{kernel_size[0]} - 1) }
625
- {\text{stride[0]}}} \right \rceil \\
626
- H_{out} = \left \lceil{\frac{H_{in} - \text{dilation[1]} \times (\text{kernel_size[1]} - 1) }
627
- {\text{stride[1]}}} \right \rceil \\
628
- W_{out} = \left \lceil{\frac{W_{in} - \text{dilation[2]} \times (\text{kernel_size[2]} - 1) }
629
- {\text{stride[2]}}} \right \rceil \\
648
+ D_{out} = \left \lfloor{\frac{D_{in} - \text{dilation[0]} \times (\text{kernel_size[0]} - 1) - 1}
649
+ {\text{stride[0]}}} \right \rfloor + 1 \\
650
+ H_{out} = \left \lfloor{\frac{H_{in} - \text{dilation[1]} \times (\text{kernel_size[1]} - 1) - 1}
651
+ {\text{stride[1]}}} \right \rfloor + 1 \\
652
+ W_{out} = \left \lfloor{\frac{W_{in} - \text{dilation[2]} \times (\text{kernel_size[2]} - 1) - 1}
653
+ {\text{stride[2]}}} \right \rfloor + 1 \\
630
654
  \end{array}
631
655
 
632
656
  padding is int or tuple/list:
633
657
 
634
658
  .. math::
635
659
  \begin{array}{ll} \\
636
- D_{out} = \left \lfloor{\frac{D_{in} + padding[0] + padding[1] - \text{dilation[0]} \times
660
+ D_{out} = \left \lfloor{\frac{D_{in} + 2 \times padding[0] - \text{dilation[0]} \times
637
661
  (\text{kernel_size[0]} - 1) - 1}{\text{stride[0]}} + 1} \right \rfloor \\
638
- H_{out} = \left \lfloor{\frac{H_{in} + padding[2] + padding[3] - \text{dilation[1]} \times
662
+ H_{out} = \left \lfloor{\frac{H_{in} + 2 \times padding[1] - \text{dilation[1]} \times
639
663
  (\text{kernel_size[1]} - 1) - 1}{\text{stride[1]}} + 1} \right \rfloor \\
640
- W_{out} = \left \lfloor{\frac{W_{in} + padding[4] + padding[5] - \text{dilation[2]} \times
664
+ W_{out} = \left \lfloor{\frac{W_{in} + 2 \times padding[2] - \text{dilation[2]} \times
641
665
  (\text{kernel_size[2]} - 1) - 1}{\text{stride[2]}} + 1} \right \rfloor \\
642
666
  \end{array}
643
667
 
644
668
  Raises:
645
669
  TypeError: If `in_channels`, `out_channels` or `groups` is not an int.
646
- TypeError: If `kernel_size`, `stride`, `padding` or `dilation` is neither an int nor a tuple.
670
+ TypeError: If `kernel_size`, `stride` or `dilation` is neither an int nor a tuple/list.
647
671
  ValueError: If `in_channels`, `out_channels`, `kernel_size`, `stride` or `dilation` is less than 1.
648
672
  ValueError: If `padding` is less than 0.
649
673
 
@@ -673,14 +697,14 @@ class Conv3d(_Conv):
673
697
  padding_mode='zeros',
674
698
  dtype=None):
675
699
  """Initialize Conv3d."""
676
- kernel_size_ = triple(kernel_size)
677
- stride_ = triple(stride)
678
- padding_ = padding if isinstance(padding, str) else triple(padding)
679
- dilation_ = triple(dilation)
700
+ kernel_size_ = triple_sequence(kernel_size)
701
+ stride_ = triple_sequence(stride)
702
+ padding_ = padding if isinstance(padding, str) else triple_sequence(padding)
703
+ dilation_ = triple_sequence(dilation)
680
704
  if not dtype:
681
705
  dtype = mstype.float32
682
706
  super(Conv3d, self).__init__(in_channels, out_channels, kernel_size_, stride_, padding_, dilation_, False,
683
- triple(0), groups, bias, padding_mode, dtype)
707
+ triple_sequence(0), groups, bias, padding_mode, dtype)
684
708
  if isinstance(padding, str) and padding_mode == "zeros":
685
709
  self.conv3d = conv3d_padding_op
686
710
  else:
@@ -1,17 +1,7 @@
1
- # Copyright 2020-2024 Huawei Technologies Co., Ltd
1
+ # Adapted from:
2
+ # https://github.com/pytorch/pytorch/blob/release/2.1/torch/nn/modules/batchnorm.py
2
3
  #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
- # ============================================================================
4
+ # Additional modifications made by Huawei Technologies Co., Ltd in 2024.
15
5
  """normalization for mint"""
16
6
  from __future__ import absolute_import
17
7
  from __future__ import division
@@ -600,21 +590,17 @@ class SyncBatchNorm(_BatchNorm):
600
590
  else: # use exponential moving average
601
591
  exponential_average_factor = self.momentum
602
592
 
603
- r"""
604
- Decide whether the mini-batch stats should be used for normalization rather than the buffers.
605
- Mini-batch stats are used in training mode, and in eval mode when buffers are None.
606
- """
593
+ # Decide whether the mini-batch stats should be used for normalization rather than the buffers.
594
+ # Mini-batch stats are used in training mode, and in eval mode when buffers are None.
607
595
  if self.training:
608
596
  bn_training = True
609
597
  else:
610
598
  bn_training = (self.running_mean is None) and (
611
599
  self.running_var is None)
612
600
 
613
- r"""
614
- Buffers are only updated if they are to be tracked and we are in training mode. Thus they only need to be
615
- passed when the update should occur (i.e. in training mode when they are tracked), or when buffer stats are
616
- used for normalization (i.e. in eval mode when buffers are not None).
617
- """
601
+ # Buffers are only updated if they are to be tracked and we are in training mode. Thus they only need to be
602
+ # passed when the update should occur (i.e. in training mode when they are tracked), or when buffer stats are
603
+ # used for normalization (i.e. in eval mode when buffers are not None).
618
604
  # If buffers are not to be tracked, ensure that they won't be updated
619
605
  running_mean = (
620
606
  self.running_mean if not self.training or self.track_running_stats else None
@@ -15,17 +15,18 @@
15
15
  """Adam"""
16
16
  from __future__ import absolute_import
17
17
 
18
- from mindspore.ops import functional as F, composite as C, operations as P
19
18
  from mindspore.common.parameter import Parameter
20
19
  from mindspore.common.tensor import Tensor
21
20
  from mindspore.common import dtype as mstype
22
21
  from mindspore.experimental.optim.optimizer import Optimizer
23
22
  from mindspore import _checkparam as validator
24
23
  from mindspore import mint
24
+ from mindspore import ops
25
25
 
26
- _optim_adamw_opt = C.MultitypeFuncGraph("optim_adamw_opt")
27
- hyper_map = C.HyperMap()
28
- assign_add = P.AssignAdd()
26
+
27
+ _optim_adamw_opt = ops.MultitypeFuncGraph("optim_adamw_opt")
28
+ hyper_map = ops.HyperMap()
29
+ assign_add = ops.AssignAdd()
29
30
 
30
31
 
31
32
  @_optim_adamw_opt.register("Float", "Float", "Float", "Tensor", "Tensor", "Tensor", "Tensor",
@@ -38,12 +39,12 @@ def _run_optim_adamw_amsgrad_opt(beta1, beta2, eps, neg_step_size, sqrt_bias_cor
38
39
  exp_avg_sq_tmp = mint.mul(exp_avg_sq, beta2) + mint.mul(mint.mul(grads, grads), 1 - beta2)
39
40
 
40
41
  max_exp_avg_sq = mint.maximum(max_exp_avg_sq, exp_avg_sq_tmp)
41
- denom = F.cast(mint.div(mint.sqrt(max_exp_avg_sq), sqrt_bias_correction2), max_exp_avg_sq.dtype)
42
+ denom = ops.cast(mint.div(mint.sqrt(max_exp_avg_sq), sqrt_bias_correction2), max_exp_avg_sq.dtype)
42
43
  denom = mint.add(denom, eps)
43
44
 
44
- delta_param = mint.mul(F.cast(neg_step_size, max_exp_avg_sq.dtype), mint.div(exp_avg_tmp, denom))
45
- F.assign(exp_avg, exp_avg_tmp)
46
- F.assign(exp_avg_sq, exp_avg_sq_tmp)
45
+ delta_param = mint.mul(ops.cast(neg_step_size, max_exp_avg_sq.dtype), mint.div(exp_avg_tmp, denom))
46
+ ops.assign(exp_avg, exp_avg_tmp)
47
+ ops.assign(exp_avg_sq, exp_avg_sq_tmp)
47
48
  assign_add(parameters, delta_param)
48
49
  return success
49
50
 
@@ -56,12 +57,12 @@ def _run_optim_adamw_opt(beta1, beta2, eps, neg_step_size, sqrt_bias_correction2
56
57
  exp_avg_tmp = mint.add(mint.mul(exp_avg, beta1), grads, alpha=1 - beta1)
57
58
  exp_avg_sq_tmp = mint.mul(exp_avg_sq, beta2) + mint.mul(mint.mul(grads, grads), 1 - beta2)
58
59
 
59
- denom = F.cast(mint.div(mint.sqrt(exp_avg_sq_tmp), sqrt_bias_correction2), exp_avg_sq_tmp.dtype)
60
+ denom = ops.cast(mint.div(mint.sqrt(exp_avg_sq_tmp), sqrt_bias_correction2), exp_avg_sq_tmp.dtype)
60
61
  denom = mint.add(denom, eps)
61
62
 
62
- delta_param = mint.mul(F.cast(neg_step_size, exp_avg_sq_tmp.dtype), mint.div(exp_avg_tmp, denom))
63
- F.assign(exp_avg, exp_avg_tmp)
64
- F.assign(exp_avg_sq, exp_avg_sq_tmp)
63
+ delta_param = mint.mul(ops.cast(neg_step_size, exp_avg_sq_tmp.dtype), mint.div(exp_avg_tmp, denom))
64
+ ops.assign(exp_avg, exp_avg_tmp)
65
+ ops.assign(exp_avg_sq, exp_avg_sq_tmp)
65
66
  assign_add(parameters, delta_param)
66
67
  return success
67
68
 
@@ -190,8 +191,8 @@ class Adam(Optimizer):
190
191
  self.exp_avg_sq = self.parameters.clone(prefix="exp_avg_sq", init='zeros')
191
192
  self.state_step = Parameter(Tensor([0], mstype.float32), "state_step")
192
193
  self.increase_tensor = Tensor(1, mstype.float32)
193
- self.assignadd = P.AssignAdd()
194
- self.pow = P.Pow()
194
+ self.assignadd = ops.AssignAdd()
195
+ self.pow = ops.Pow()
195
196
 
196
197
 
197
198
  def construct(self, gradients):
@@ -211,13 +212,13 @@ class Adam(Optimizer):
211
212
  grads = self._decay_weight(group.get("weight_decay"), self.parameters[start_id: end_id], grads)
212
213
 
213
214
  if group.get("amsgrad"):
214
- self.hyper_map(F.partial(_optim_adamw_opt, beta1, beta2, group.get("eps"), neg_step_size,
215
- sqrt_bias_correction2),
215
+ self.hyper_map(ops.partial(_optim_adamw_opt, beta1, beta2, group.get("eps"), neg_step_size,
216
+ sqrt_bias_correction2),
216
217
  self.parameters[start_id: end_id], grads, self.exp_avg[start_id: end_id],
217
218
  self.exp_avg_sq[start_id: end_id], group.get("max_exp_avg_sq"))
218
219
  else:
219
- self.hyper_map(F.partial(_optim_adamw_opt, beta1, beta2, group.get("eps"), neg_step_size,
220
- sqrt_bias_correction2),
220
+ self.hyper_map(ops.partial(_optim_adamw_opt, beta1, beta2, group.get("eps"), neg_step_size,
221
+ sqrt_bias_correction2),
221
222
  self.parameters[start_id: end_id], grads, self.exp_avg[start_id: end_id],
222
223
  self.exp_avg_sq[start_id: end_id])
223
224
  return True