mindspore 2.3.0__cp39-none-any.whl → 2.3.0rc2__cp39-none-any.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 (423) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/Third_Party_Open_Source_Software_Notice +0 -1512
  3. mindspore/__init__.py +1 -2
  4. mindspore/_c_dataengine.cpython-39-aarch64-linux-gnu.so +0 -0
  5. mindspore/_c_expression.cpython-39-aarch64-linux-gnu.so +0 -0
  6. mindspore/_c_mindrecord.cpython-39-aarch64-linux-gnu.so +0 -0
  7. mindspore/_checkparam.py +25 -5
  8. mindspore/_extends/graph_kernel/model/graph_parallel.py +1 -1
  9. mindspore/_extends/parse/__init__.py +2 -2
  10. mindspore/_extends/parse/compile_config.py +0 -29
  11. mindspore/_extends/parse/namespace.py +2 -2
  12. mindspore/_extends/parse/parser.py +5 -21
  13. mindspore/_extends/parse/resources.py +7 -5
  14. mindspore/_extends/parse/standard_method.py +59 -40
  15. mindspore/_mindspore_offline_debug.cpython-39-aarch64-linux-gnu.so +0 -0
  16. mindspore/amp.py +5 -26
  17. mindspore/bin/cache_admin +0 -0
  18. mindspore/bin/cache_server +0 -0
  19. mindspore/boost/adasum.py +1 -1
  20. mindspore/boost/base.py +1 -1
  21. mindspore/boost/boost_cell_wrapper.py +1 -1
  22. mindspore/boost/grad_freeze.py +2 -2
  23. mindspore/boost/less_batch_normalization.py +6 -9
  24. mindspore/common/__init__.py +1 -8
  25. mindspore/common/_register_for_tensor.py +9 -8
  26. mindspore/common/api.py +65 -275
  27. mindspore/common/dtype.py +4 -8
  28. mindspore/common/dump.py +5 -2
  29. mindspore/common/jit_config.py +1 -1
  30. mindspore/common/lazy_inline.py +2 -14
  31. mindspore/common/parameter.py +15 -14
  32. mindspore/common/recompute.py +5 -20
  33. mindspore/common/sparse_tensor.py +6 -21
  34. mindspore/common/tensor.py +52 -100
  35. mindspore/communication/__init__.py +11 -6
  36. mindspore/communication/management.py +94 -92
  37. mindspore/context.py +18 -180
  38. mindspore/dataset/engine/datasets.py +46 -69
  39. mindspore/dataset/engine/datasets_user_defined.py +53 -72
  40. mindspore/dataset/engine/datasets_vision.py +2 -2
  41. mindspore/dataset/engine/queue.py +38 -56
  42. mindspore/dataset/engine/validators.py +5 -11
  43. mindspore/dataset/vision/__init__.py +5 -5
  44. mindspore/dataset/vision/c_transforms.py +5 -5
  45. mindspore/dataset/vision/py_transforms_util.py +1 -1
  46. mindspore/dataset/vision/transforms.py +46 -591
  47. mindspore/dataset/vision/utils.py +1 -121
  48. mindspore/dataset/vision/validators.py +3 -9
  49. mindspore/hal/__init__.py +1 -7
  50. mindspore/hal/device.py +1 -1
  51. mindspore/include/api/model.h +0 -3
  52. mindspore/include/dataset/vision.h +2 -54
  53. mindspore/include/mindapi/base/types.h +0 -1
  54. mindspore/lib/libdnnl.so.2 +0 -0
  55. mindspore/lib/libmindspore.so +0 -0
  56. mindspore/lib/libmindspore_backend.so +0 -0
  57. mindspore/lib/libmindspore_common.so +0 -0
  58. mindspore/lib/libmindspore_core.so +0 -0
  59. mindspore/lib/libmindspore_glog.so.0 +0 -0
  60. mindspore/lib/libmindspore_gpr.so.15 +0 -0
  61. mindspore/lib/libmindspore_grpc++.so.1 +0 -0
  62. mindspore/lib/libmindspore_grpc.so.15 +0 -0
  63. mindspore/lib/libmindspore_shared_lib.so +0 -0
  64. mindspore/lib/libmpi_adapter.so +0 -0
  65. mindspore/lib/libmpi_collective.so +0 -0
  66. mindspore/lib/libnnacl.so +0 -0
  67. mindspore/lib/libopencv_core.so.4.5 +0 -0
  68. mindspore/lib/libps_cache.so +0 -0
  69. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +0 -35
  70. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/ai_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
  71. mindspore/lib/plugin/ascend/custom_aicore_ops/op_impl/vector_core/tbe/custom_aicore_ops_impl/kv_cache_mgr.py +0 -2
  72. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/aicpu_kernel/impl/libcust_cpu_kernels.so +0 -0
  73. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_impl/cpu/config/cust_aicpu_kernel.json +0 -72
  74. mindspore/lib/plugin/ascend/custom_aicpu_ops/op_proto/libcust_op_proto.so +0 -0
  75. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/{aclnn_all_finite.h → aclnn_add_custom.h} +11 -9
  76. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_decoder_kv_cache.h +1 -1
  77. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/include/aclnn_prompt_kv_cache.h +1 -1
  78. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_api/lib/libcust_opapi.so +0 -0
  79. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend310p/aic-ascend310p-ops-info.json +12 -184
  80. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910/aic-ascend910-ops-info.json +15 -7
  81. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/config/ascend910b/aic-ascend910b-ops-info.json +15 -7
  82. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.cpp +81 -0
  83. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/add_custom.py +134 -0
  84. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/decoder_kv_cache.py +31 -77
  85. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/prompt_kv_cache.py +31 -77
  86. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/lib/linux/aarch64/libcust_opmaster_rt2.0.so +0 -0
  87. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/op_tiling/liboptiling.so +0 -0
  88. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/inc/op_proto.h +5 -4
  89. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_proto/lib/linux/aarch64/libcust_opsproto_rt2.0.so +0 -0
  90. mindspore/lib/plugin/ascend/libascend_collective.so +0 -0
  91. mindspore/lib/plugin/ascend/libdvpp_utils.so +0 -0
  92. mindspore/lib/plugin/ascend/libhccl_plugin.so +0 -0
  93. mindspore/lib/plugin/ascend/liblowlatency_collective.so +0 -0
  94. mindspore/lib/plugin/ascend/libmindspore_cpu_kernels.so +0 -0
  95. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/DeviceBin +0 -0
  96. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/PkgInspect +0 -0
  97. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/bin/op_man +0 -0
  98. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/device/ascend910b/bin/ascend910b.bin +286 -275
  99. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_cann_host.so +0 -0
  100. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/host/libasdops_host.so +0 -0
  101. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops.so +0 -0
  102. mindspore/lib/plugin/ascend/ms_kernels_internal/asdops/lib/libasdops_static.a +0 -0
  103. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/add/add_impl.h +0 -1
  104. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/apply_rotary_pos_emb_impl.h +0 -1
  105. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/asdop/asd_op_impl.h +0 -3
  106. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/backend_param.h +0 -5
  107. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/cast/cast_tiling.h +45 -1
  108. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/compare/compare_impl.h +0 -1
  109. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_impl.h +4 -8
  110. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/flash_attention_score_tiling.h +4 -11
  111. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/flash_attention_score/kernel/flash_attention_score_mix_hwsync.h +0 -18
  112. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_kernel.h +0 -6
  113. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/internal_rtbackend.h +75 -1
  114. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/kernel/matmul.h +5 -5
  115. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul/matmul_impl.h +3 -18
  116. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_common_tiling.h +5 -5
  117. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/pp_matmul_info.h +2 -2
  118. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_common/tiling_data.h +3 -36
  119. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/kernel/matmul_stridedslice_fusion.h +2 -2
  120. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/matmul_stridedslice/matmul_stridedslice_fusion_impl.h +4 -22
  121. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/op_param.h +2 -16
  122. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/kernel/paged_attention_mix_hwsync.h +3 -1
  123. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_impl.h +4 -5
  124. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/paged_attention/paged_attention_tiling.h +4 -9
  125. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/attention_param.h +2 -5
  126. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_ext_param.h +0 -1
  127. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/matmul_qkv_param.h +4 -10
  128. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/sub_param.h +12 -0
  129. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/rms_norm/rms_norm_impl.h +0 -1
  130. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/sub/sub_impl.h +0 -1
  131. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/tune_repo/matmul_table.h +1 -1
  132. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/backend.h +2 -10
  133. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/elewise_utils.h +1 -5
  134. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log.h +0 -1
  135. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_tiling.h +0 -17
  136. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/math.h +7 -2
  137. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libAdd_impl.so +0 -0
  138. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libSub_impl.so +0 -0
  139. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_layernorm_impl.so +0 -0
  140. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libadd_rms_norm_impl.so +0 -0
  141. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libapply_rotary_pos_emb_impl.so +0 -0
  142. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libcast_impl.so +0 -0
  143. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libgelu_impl.so +0 -0
  144. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_impl.so +0 -0
  145. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libmatmul_stridedslice_fusion_impl.so +0 -0
  146. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libms_kernels_internal.so +0 -0
  147. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libnot_equal_impl.so +0 -0
  148. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/libreshape_and_cache_impl.so +0 -0
  149. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/lib/librms_norm_impl.so +0 -0
  150. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_full_mix.o +0 -0
  151. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bnsd_tri_mix.o +0 -0
  152. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_full_mix.o +0 -0
  153. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_bf16_bsh_tri_mix.o +0 -0
  154. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_full_mix.o +0 -0
  155. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bnsd_tri_mix.o +0 -0
  156. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_full_mix.o +0 -0
  157. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/flash_attention_score_fp16_bsh_tri_mix.o +0 -0
  158. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bnsd_full_mix.o +0 -0
  159. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_bf16_bsh_full_mix.o +0 -0
  160. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bnsd_full_mix.o +0 -0
  161. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/BSAttention/paged_attention_fp16_bsh_full_mix.o +0 -0
  162. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblcal.so +0 -0
  163. mindspore/lib/plugin/ascend/ms_kernels_internal/lccl/lib/liblccl_wrapper.so +0 -0
  164. mindspore/lib/plugin/libmindspore_ascend.so.2 +0 -0
  165. mindspore/mindrecord/filewriter.py +2 -2
  166. mindspore/mint/__init__.py +40 -720
  167. mindspore/mint/nn/__init__.py +7 -89
  168. mindspore/mint/nn/functional.py +16 -165
  169. mindspore/mint/optim/adamw.py +16 -15
  170. mindspore/nn/__init__.py +2 -0
  171. mindspore/nn/cell.py +98 -97
  172. mindspore/nn/extend/basic.py +2 -2
  173. mindspore/nn/extend/embedding.py +1 -1
  174. mindspore/nn/extend/layer/normalization.py +5 -7
  175. mindspore/nn/generator.py +297 -0
  176. mindspore/nn/layer/activation.py +3 -4
  177. mindspore/nn/layer/basic.py +16 -79
  178. mindspore/nn/layer/conv.py +8 -17
  179. mindspore/nn/layer/embedding.py +4 -1
  180. mindspore/nn/layer/math.py +1 -1
  181. mindspore/nn/layer/normalization.py +1 -1
  182. mindspore/nn/layer/pooling.py +0 -5
  183. mindspore/nn/layer/rnn_cells.py +2 -2
  184. mindspore/nn/loss/loss.py +19 -19
  185. mindspore/nn/optim/adasum.py +1 -1
  186. mindspore/nn/optim/sgd.py +2 -3
  187. mindspore/nn/probability/distribution/exponential.py +1 -1
  188. mindspore/nn/probability/distribution/geometric.py +1 -1
  189. mindspore/nn/probability/distribution/logistic.py +1 -1
  190. mindspore/nn/wrap/cell_wrapper.py +1 -25
  191. mindspore/nn/wrap/loss_scale.py +1 -24
  192. mindspore/numpy/array_ops.py +1 -5
  193. mindspore/numpy/dtypes.py +3 -3
  194. mindspore/numpy/math_ops.py +8 -8
  195. mindspore/ops/__init__.py +1 -1
  196. mindspore/ops/_grad_experimental/grad_comm_ops.py +16 -75
  197. mindspore/ops/_vmap/vmap_array_ops.py +0 -27
  198. mindspore/ops/_vmap/vmap_math_ops.py +1 -29
  199. mindspore/ops/_vmap/vmap_nn_ops.py +18 -19
  200. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +8 -34
  201. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +9 -2
  202. mindspore/ops/auto_generate/gen_arg_handler.py +0 -26
  203. mindspore/ops/auto_generate/gen_extend_func.py +27 -603
  204. mindspore/ops/auto_generate/gen_ops_def.py +203 -993
  205. mindspore/ops/auto_generate/gen_ops_prim.py +402 -1946
  206. mindspore/ops/auto_generate/pyboost_inner_prim.py +20 -90
  207. mindspore/ops/composite/base.py +6 -3
  208. mindspore/ops/composite/math_ops.py +1 -1
  209. mindspore/ops/composite/multitype_ops/_compile_utils.py +17 -24
  210. mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
  211. mindspore/ops/extend/__init__.py +3 -2
  212. mindspore/ops/extend/array_func.py +51 -10
  213. mindspore/ops/extend/nn_func.py +78 -2
  214. mindspore/ops/function/__init__.py +13 -8
  215. mindspore/ops/function/array_func.py +179 -455
  216. mindspore/ops/function/clip_func.py +1 -1
  217. mindspore/ops/function/grad/grad_func.py +3 -3
  218. mindspore/ops/function/math_func.py +103 -117
  219. mindspore/ops/function/nn_func.py +163 -275
  220. mindspore/ops/function/other_func.py +2 -2
  221. mindspore/ops/function/random_func.py +69 -202
  222. mindspore/ops/function/sparse_func.py +4 -4
  223. mindspore/ops/functional.py +327 -332
  224. mindspore/ops/operations/__init__.py +3 -13
  225. mindspore/ops/operations/_grad_ops.py +27 -3
  226. mindspore/ops/operations/_inner_ops.py +356 -53
  227. mindspore/ops/operations/_rl_inner_ops.py +2 -2
  228. mindspore/ops/operations/_tensor_array.py +8 -8
  229. mindspore/ops/operations/array_ops.py +65 -82
  230. mindspore/ops/operations/comm_ops.py +93 -784
  231. mindspore/ops/operations/custom_ops.py +28 -51
  232. mindspore/ops/operations/debug_ops.py +4 -4
  233. mindspore/ops/operations/inner_ops.py +2 -2
  234. mindspore/ops/operations/manually_defined/ops_def.py +4 -304
  235. mindspore/ops/operations/math_ops.py +50 -3
  236. mindspore/ops/operations/nn_ops.py +247 -14
  237. mindspore/ops/operations/other_ops.py +3 -3
  238. mindspore/ops/operations/random_ops.py +1 -1
  239. mindspore/ops/operations/sparse_ops.py +1 -1
  240. mindspore/ops/primitive.py +8 -9
  241. mindspore/ops/silent_check.py +5 -5
  242. mindspore/ops_generate/arg_dtype_cast.py +9 -2
  243. mindspore/ops_generate/arg_handler.py +0 -26
  244. mindspore/ops_generate/gen_aclnn_implement.py +4 -1
  245. mindspore/ops_generate/gen_ops.py +4 -26
  246. mindspore/ops_generate/gen_pyboost_func.py +12 -41
  247. mindspore/ops_generate/gen_utils.py +0 -21
  248. mindspore/ops_generate/pyboost_utils.py +2 -7
  249. mindspore/ops_generate/template.py +0 -1
  250. mindspore/parallel/_auto_parallel_context.py +1 -21
  251. mindspore/parallel/_tensor.py +5 -0
  252. mindspore/parallel/_transformer/transformer.py +1 -1
  253. mindspore/parallel/_utils.py +1 -15
  254. mindspore/parallel/algo_parameter_config.py +3 -1
  255. mindspore/parallel/checkpoint_transform.py +9 -12
  256. mindspore/parallel/cluster/process_entity/_api.py +29 -28
  257. mindspore/parallel/cluster/process_entity/_utils.py +3 -13
  258. mindspore/parallel/cluster/run.py +16 -13
  259. mindspore/parallel/parameter_broadcast.py +2 -2
  260. mindspore/parallel/shard.py +17 -31
  261. mindspore/profiler/__init__.py +2 -3
  262. mindspore/profiler/common/util.py +2 -107
  263. mindspore/profiler/envprofiling.py +1 -1
  264. mindspore/profiler/parser/ascend_analysis/constant.py +21 -8
  265. mindspore/profiler/parser/ascend_analysis/file_manager.py +0 -82
  266. mindspore/profiler/parser/ascend_analysis/function_event.py +28 -43
  267. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +27 -49
  268. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +10 -15
  269. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +20 -25
  270. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +5 -5
  271. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +1 -10
  272. mindspore/profiler/parser/ascend_hccl_generator.py +1 -4
  273. mindspore/profiler/parser/ascend_msprof_exporter.py +22 -43
  274. mindspore/profiler/parser/ascend_timeline_generator.py +5 -7
  275. mindspore/profiler/parser/minddata_parser.py +3 -72
  276. mindspore/profiler/profiling.py +59 -176
  277. mindspore/rewrite/api/node.py +1 -1
  278. mindspore/rewrite/common/namespace.py +5 -5
  279. mindspore/rewrite/parsers/assign_parser.py +0 -2
  280. mindspore/rewrite/parsers/class_def_parser.py +4 -8
  281. mindspore/run_check/_check_version.py +1 -1
  282. mindspore/scipy/fft.py +3 -1
  283. mindspore/scipy/linalg.py +3 -2
  284. mindspore/scipy/ops.py +3 -5
  285. mindspore/scipy/optimize/__init__.py +2 -2
  286. mindspore/train/__init__.py +4 -4
  287. mindspore/train/anf_ir_pb2.py +2 -8
  288. mindspore/train/callback/__init__.py +2 -5
  289. mindspore/train/callback/_backup_and_restore.py +2 -2
  290. mindspore/train/callback/_checkpoint.py +16 -104
  291. mindspore/train/callback/_landscape.py +1 -1
  292. mindspore/train/callback/_time_monitor.py +1 -1
  293. mindspore/train/data_sink.py +4 -5
  294. mindspore/train/dataset_helper.py +20 -45
  295. mindspore/train/model.py +38 -266
  296. mindspore/train/serialization.py +105 -256
  297. mindspore/train/summary/_summary_adapter.py +1 -1
  298. mindspore/version.py +1 -1
  299. {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/METADATA +2 -2
  300. {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/RECORD +303 -420
  301. mindspore/_extends/pijit/__init__.py +0 -23
  302. mindspore/_extends/pijit/pijit_func_white_list.py +0 -343
  303. mindspore/common/file_system.py +0 -48
  304. mindspore/common/generator.py +0 -260
  305. mindspore/common/no_inline.py +0 -54
  306. mindspore/common/np_dtype.py +0 -25
  307. mindspore/communication/comm_func.py +0 -1140
  308. mindspore/hal/memory.py +0 -326
  309. mindspore/lib/libavcodec.so.59 +0 -0
  310. mindspore/lib/libavdevice.so.59 +0 -0
  311. mindspore/lib/libavfilter.so.8 +0 -0
  312. mindspore/lib/libavformat.so.59 +0 -0
  313. mindspore/lib/libavutil.so.57 +0 -0
  314. mindspore/lib/libmindspore_np_dtype.so +0 -0
  315. mindspore/lib/libswresample.so.4 +0 -0
  316. mindspore/lib/libswscale.so.6 +0 -0
  317. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.cpp +0 -326
  318. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/custom_ascendc_ops_impl/dynamic/all_finite.py +0 -180
  319. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.json +0 -58
  320. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_576ceaeef5870c451cab59af55ea46ad.o +0 -0
  321. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.json +0 -58
  322. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_86a73ff6e28d734c96bb8d3054f7dd18.o +0 -0
  323. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.json +0 -58
  324. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/ascend910b/all_finite/AllFinite_f55e0ebaad1f2f572e43677336992fa0.o +0 -0
  325. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/all_finite.json +0 -109
  326. mindspore/lib/plugin/ascend/custom_ascendc_ops/op_impl/ai_core/tbe/kernel/config/ascend910b/binary_info_config.json +0 -38
  327. mindspore/lib/plugin/ascend/custom_compiler/OWNERS +0 -12
  328. mindspore/lib/plugin/ascend/custom_compiler/setup.py +0 -255
  329. mindspore/lib/plugin/ascend/custom_compiler/start.sh +0 -26
  330. mindspore/lib/plugin/ascend/custom_compiler/template.json +0 -40
  331. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme.h +0 -24
  332. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/acme_op.h +0 -69
  333. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/base_type.h +0 -133
  334. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_creator.h +0 -32
  335. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/op_param.h +0 -35
  336. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/include/tiling_info.h +0 -60
  337. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/kernel_register.h +0 -37
  338. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/platform_configs.h +0 -89
  339. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/core/platform/rt_funcs.h +0 -135
  340. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/add_op.h +0 -34
  341. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_backoff_base.h +0 -62
  342. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_elewise_op.h +0 -33
  343. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_ops.h +0 -88
  344. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/asd_pa_op.h +0 -45
  345. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/cast_op.h +0 -52
  346. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/ops/host_src/matmul_op.h +0 -95
  347. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/asd_utils.h +0 -84
  348. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/acme/src/utils/comm_utils.h +0 -61
  349. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/apply_rotary_pos_emb/kernel/apply_rotary_pos_emb_fp32.h +0 -224
  350. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/and_impl.h +0 -29
  351. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/div_impl.h +0 -29
  352. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_impl.h +0 -48
  353. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/elewise_binary_tiling.h +0 -25
  354. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/and_kernel.h +0 -46
  355. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/div_kernel.h +0 -46
  356. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_base.h +0 -260
  357. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/elewise_binary_kernel.h +0 -35
  358. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/max_kernel.h +0 -66
  359. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/min_kernel.h +0 -66
  360. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/mul_kernel.h +0 -66
  361. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/kernel/or_kernel.h +0 -46
  362. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/max_impl.h +0 -29
  363. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/min_impl.h +0 -29
  364. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/mul_impl.h +0 -29
  365. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_binary/or_impl.h +0 -29
  366. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/abs_impl.h +0 -29
  367. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_impl.h +0 -47
  368. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/elewise_unary_tiling.h +0 -24
  369. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/exp_impl.h +0 -29
  370. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/abs_kernel.h +0 -45
  371. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_base.h +0 -148
  372. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/elewise_unary_kernel.h +0 -31
  373. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/exp_kernel.h +0 -45
  374. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/ln_kernel.h +0 -45
  375. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/not_kernel.h +0 -45
  376. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/reciprocal_kernel.h +0 -45
  377. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/relu_kernel.h +0 -55
  378. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/rsqrt_kernel.h +0 -45
  379. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/kernel/sqrt_kernel.h +0 -45
  380. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/ln_impl.h +0 -29
  381. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/not_impl.h +0 -29
  382. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/reciprocal_impl.h +0 -29
  383. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/relu_impl.h +0 -29
  384. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/rsqrt_impl.h +0 -29
  385. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/elewise_unary/sqrt_impl.h +0 -29
  386. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_impl.h +0 -45
  387. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/grouped_matmul_tiling.h +0 -187
  388. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul.h +0 -245
  389. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_interface.h +0 -24
  390. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/kernel/grouped_matmul_utils.h +0 -111
  391. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/grouped_matmul/tiling_data.h +0 -54
  392. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/compare_param.h +0 -31
  393. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/elewise_param.h +0 -41
  394. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/param/grouped_matmul_param.h +0 -40
  395. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/profiling_util.h +0 -364
  396. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/log/log_utils.h +0 -69
  397. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_creator.h +0 -39
  398. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/register/kernel_registry.h +0 -114
  399. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/include/utils/utils.h +0 -98
  400. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.json +0 -19
  401. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix.o +0 -0
  402. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aic_0.o +0 -0
  403. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MatMulPostFusionMixTactic/matmul_postfusion_mix_mix_aiv_0.o +0 -0
  404. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.json +0 -19
  405. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix.o +0 -0
  406. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aic_0.o +0 -0
  407. mindspore/lib/plugin/ascend/ms_kernels_internal/internal_kernel/op_kernels/ascend910b/MultiMatMulPostFusionMixTactic/multi_matmul_postfusion_mix_mix_aiv_0.o +0 -0
  408. mindspore/mint/linalg/__init__.py +0 -22
  409. mindspore/nn/layer/embedding_service.py +0 -531
  410. mindspore/nn/layer/embedding_service_layer.py +0 -393
  411. mindspore/ops/function/reshard_func.py +0 -102
  412. mindspore/ops/operations/_infer_ops.py +0 -19
  413. mindspore/ops/operations/reshard_ops.py +0 -53
  414. mindspore/profiler/common/process_pool.py +0 -41
  415. mindspore/profiler/common/singleton.py +0 -28
  416. mindspore/profiler/parser/ascend_integrate_generator.py +0 -42
  417. mindspore/profiler/parser/ascend_memory_generator.py +0 -185
  418. mindspore/train/callback/_cluster_monitor.py +0 -201
  419. mindspore/train/callback/_flops_collector.py +0 -238
  420. mindspore/train/callback/_mindio_ttp.py +0 -443
  421. {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/WHEEL +0 -0
  422. {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/entry_points.txt +0 -0
  423. {mindspore-2.3.0.dist-info → mindspore-2.3.0rc2.dist-info}/top_level.txt +0 -0
@@ -18,7 +18,6 @@ Neural Networks Cells.
18
18
  Predefined building blocks or computing units to construct neural networks.
19
19
  """
20
20
  from __future__ import absolute_import
21
- from mindspore.nn.cell import Cell
22
21
  from mindspore.nn.extend import *
23
22
  from mindspore.nn.extend import basic, embedding
24
23
  from mindspore.nn.extend import MaxPool2d
@@ -33,9 +32,9 @@ from mindspore.nn.extend import MaxPool2d
33
32
  # 5
34
33
 
35
34
  # 6
36
- from mindspore.nn.layer.basic import UnfoldExt as Unfold
35
+
37
36
  # 7
38
- from mindspore.nn.layer.basic import Fold
37
+
39
38
  # 8
40
39
  from mindspore.nn.extend.layer import normalization
41
40
  from mindspore.nn.extend.layer.normalization import *
@@ -98,7 +97,7 @@ from mindspore.nn.layer.basic import DropoutExt as Dropout
98
97
  # 37
99
98
 
100
99
  # 38
101
- from mindspore.nn.extend.basic import Linear
100
+
102
101
  # 39
103
102
 
104
103
  # 40
@@ -222,92 +221,11 @@ from mindspore.nn.extend.basic import Linear
222
221
  # 99
223
222
 
224
223
  # 100
225
- from mindspore.ops.auto_generate import BCEWithLogitsLoss as BCEWithLogitsLoss_prim
226
-
227
-
228
- class BCEWithLogitsLoss(Cell):
229
- r"""
230
- Adds sigmoid activation function to `input` as logits, and uses this logits to compute binary cross entropy
231
- between the logits and the target.
232
-
233
- Sets input `input` as :math:`X`, input `target` as :math:`Y`, output as :math:`L`. Then,
234
-
235
- .. math::
236
- p_{ij} = sigmoid(X_{ij}) = \frac{1}{1 + e^{-X_{ij}}}
237
-
238
- .. math::
239
- L_{ij} = -[Y_{ij} \cdot \log(p_{ij}) + (1 - Y_{ij}) \cdot \log(1 - p_{ij})]
240
-
241
- Then,
242
-
243
- .. math::
244
- \ell(x, y) = \begin{cases}
245
- L, & \text{if reduction} = \text{'none';}\\
246
- \operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
247
- \operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
248
- \end{cases}
249
-
250
- Args:
251
- weight (Tensor, optional): A rescaling weight applied to the loss of each batch element.
252
- If not None, it can be broadcast to a tensor with shape of `target`, data type must be float16, float32 or
253
- bfloat16(only Atlas A2 series products are supported). Default: ``None`` .
254
- reduction (str, optional): Apply specific reduction method to the output: ``'none'`` , ``'mean'`` ,
255
- ``'sum'`` . Default: ``'mean'`` .
256
-
257
- - ``'none'``: no reduction will be applied.
258
- - ``'mean'``: compute and return the weighted mean of elements in the output.
259
- - ``'sum'``: the output elements will be summed.
260
-
261
- pos_weight (Tensor, optional): A weight of positive examples. Must be a vector with length equal to the
262
- number of classes. If not None, it must be broadcast to a tensor with shape of `input`, data type
263
- must be float16, float32 or bfloat16(only Atlas A2 series products are supported). Default: ``None`` .
264
-
265
- Inputs:
266
- - **input** (Tensor) - Input `input` with shape :math:`(N, *)` where :math:`*` means, any number
267
- of additional dimensions. The data type must be float16, float32 or bfloat16(only Atlas A2 series products
268
- are supported).
269
- - **target** (Tensor) - Ground truth label with shape :math:`(N, *)` where :math:`*` means, any number
270
- of additional dimensions. The same shape and data type as `input`.
271
-
272
- Outputs:
273
- Tensor or Scalar, if `reduction` is ``'none'``, its shape is the same as `input`.
274
- Otherwise, a scalar value will be returned.
275
-
276
- Raises:
277
- TypeError: If input `input` or `target` is not Tensor.
278
- TypeError: If `weight` or `pos_weight` is a parameter.
279
- TypeError: If data type of `reduction` is not string.
280
- ValueError: If `weight` or `pos_weight` can not be broadcast to a tensor with shape of `input`.
281
- ValueError: If `reduction` is not one of ``'none'``, ``'mean'``, ``'sum'``.
282
-
283
- Supported Platforms:
284
- ``Ascend``
285
-
286
- Examples:
287
- >>> import mindspore as ms
288
- >>> from mindspore import mint
289
- >>> import numpy as np
290
- >>> input = ms.Tensor(np.array([[-0.8, 1.2, 0.7], [-0.1, -0.4, 0.7]]).astype(np.float32))
291
- >>> target = ms.Tensor(np.array([[0.3, 0.8, 1.2], [-0.6, 0.1, 2.2]]).astype(np.float32))
292
- >>> loss = mint.nn.BCEWithLogitsLoss()
293
- >>> output = loss(input, target)
294
- >>> print(output)
295
- 0.3463612
296
- """
297
- def __init__(self, weight=None, reduction='mean', pos_weight=None):
298
- super(BCEWithLogitsLoss, self).__init__()
299
- self.bce_with_logits = BCEWithLogitsLoss_prim(reduction)
300
- self.weight = weight
301
- self.pos_weight = pos_weight
302
-
303
- def construct(self, input, target):
304
- out = self.bce_with_logits(input, target, self.weight, self.pos_weight)
305
- return out
306
224
 
307
225
  __all__ = [
308
226
  'MaxPool2d',
309
227
  # 1
310
- 'BCEWithLogitsLoss',
228
+
311
229
  # 2
312
230
 
313
231
  # 3
@@ -317,9 +235,9 @@ __all__ = [
317
235
  # 5
318
236
 
319
237
  # 6
320
- 'Fold',
238
+
321
239
  # 7
322
- 'Unfold',
240
+
323
241
  # 8
324
242
 
325
243
  # 9
@@ -381,7 +299,7 @@ __all__ = [
381
299
  # 37
382
300
 
383
301
  # 38
384
- 'Linear',
302
+
385
303
  # 39
386
304
 
387
305
  # 40
@@ -28,11 +28,11 @@ from mindspore.ops.functional import (
28
28
  # 4
29
29
 
30
30
  # 5
31
- from mindspore.ops.function.nn_func import pad_ext as pad
31
+ from mindspore.ops.functional import pad_ext as pad
32
32
  # 6
33
- from mindspore.ops.auto_generate import unfold_ext as unfold
33
+
34
34
  # 7
35
- from mindspore.ops.auto_generate import fold_ext as fold
35
+
36
36
  # 8
37
37
  from mindspore.ops.functional import layer_norm
38
38
  # 9
@@ -52,7 +52,7 @@ from mindspore.ops.function.nn_func import dropout_ext as dropout
52
52
  # 16
53
53
 
54
54
  # 17
55
- from mindspore.ops.function.nn_func import binary_cross_entropy
55
+
56
56
  # 18
57
57
 
58
58
  # 19
@@ -80,14 +80,13 @@ from mindspore.ops.function.nn_func import binary_cross_entropy
80
80
  # 30
81
81
 
82
82
  # 31
83
- from mindspore.ops.function.nn_func import softmax_ext as softmax
84
83
 
85
84
  # 32
86
85
 
87
86
  # 33
88
87
 
89
88
  # 34
90
- from mindspore.ops.function.nn_func import batch_norm_ext as batch_norm
89
+
91
90
  # 35
92
91
 
93
92
  # 36
@@ -95,7 +94,7 @@ from mindspore.ops.functional import gelu
95
94
  # 37
96
95
 
97
96
  # 38
98
- from mindspore.ops.functional import dense as linear
97
+
99
98
  # 39
100
99
  from mindspore.ops.functional import group_norm
101
100
  # 40
@@ -147,7 +146,6 @@ from mindspore.ops.functional import embedding
147
146
  # 63
148
147
 
149
148
  # 64
150
- from mindspore.ops.extend import one_hot as one_hot_ext
151
149
 
152
150
  # 65
153
151
 
@@ -206,7 +204,7 @@ from mindspore.ops.function.nn_func import avg_pool2d_ext as avg_pool2d
206
204
  # 92
207
205
  from mindspore.ops.extend import leaky_relu_ext as leaky_relu
208
206
  # 93
209
- from mindspore.ops.auto_generate import softplus_ext as softplus # pylint: disable=W0611
207
+ from mindspore.ops.function.nn_func import softplus_ext as softplus
210
208
  # 94
211
209
  from mindspore.ops.function.math_func import tanh
212
210
  # 95
@@ -220,153 +218,12 @@ from mindspore.ops.function.math_func import tanh
220
218
  # 99
221
219
 
222
220
  # 100
223
- from mindspore.ops.function import binary_cross_entropy_with_logits as bce_with_logits
224
- # 323
225
-
226
- # 324
227
- from mindspore.ops.auto_generate import elu_ext as elu
228
- # 325
229
-
230
-
231
- def binary_cross_entropy_with_logits(input, target, weight=None, reduction='mean', pos_weight=None):
232
- r"""
233
- Adds sigmoid activation function to `input` as logits, and uses this logits to compute binary cross entropy
234
- between the logits and the target.
235
- Consistent with the function of `mindspore.ops.binary_cross_entropy_with_logits` .
236
-
237
- Sets input `input` as :math:`X`, input `target` as :math:`Y`, input `weight` as :math:`W`, output as :math:`L`.
238
- Then,
239
-
240
- .. math::
241
-
242
- \begin{array}{ll} \\
243
- p_{ij} = sigmoid(X_{ij}) = \frac{1}{1 + e^{-X_{ij}}} \\
244
- L_{ij} = -[Y_{ij}log(p_{ij}) + (1 - Y_{ij})log(1 - p_{ij})]
245
- \end{array}
246
-
247
- :math:`i` indicates the :math:`i^{th}` sample, :math:`j` indicates the category. Then,
248
-
249
- .. math::
250
- \ell(x, y) = \begin{cases}
251
- L, & \text{if reduction} = \text{'none';}\\
252
- \operatorname{mean}(L), & \text{if reduction} = \text{'mean';}\\
253
- \operatorname{sum}(L), & \text{if reduction} = \text{'sum'.}
254
- \end{cases}
255
-
256
- :math:`\ell` indicates the method of calculating the loss. There are three methods:
257
- the first method is to provide the loss value directly,
258
- the second method is to calculate the average value of all losses,
259
- and the third method is to calculate the sum of all losses.
260
-
261
- This operator will multiply the output by the corresponding weight.
262
- The tensor :math:`weight` assigns different weights to each piece of data in the batch,
263
- and the tensor :math:`pos\_weight` adds corresponding weights to the positive examples of each category.
264
-
265
- In addition, it can trade off recall and precision by adding weights to positive examples.
266
- In the case of multi-label classification the loss can be described as:
267
-
268
- .. math::
269
- \begin{array}{ll} \\
270
- p_{ij,c} = sigmoid(X_{ij,c}) = \frac{1}{1 + e^{-X_{ij,c}}} \\
271
- L_{ij,c} = -[P_{c}Y_{ij,c} * log(p_{ij,c}) + (1 - Y_{ij,c})log(1 - p_{ij,c})]
272
- \end{array}
273
-
274
- where c is the class number (c>1 for multi-label binary classification, c=1 for single-label binary classification),
275
- n is the number of the sample in the batch and :math:`P_c` is the weight of the positive answer for the class c.
276
- :math:`P_c>1` increases the recall, :math:`P_c<1` increases the precision.
277
-
278
- Args:
279
- input (Tensor): Input `input` with shape :math:`(N, *)` where :math:`*` means, any number
280
- of additional dimensions. The data type must be float16, float32 or bfloat16(only Atlas A2 series products
281
- are supported).
282
- target (Tensor): Ground truth label, has the same shape as `input`.
283
- The data type must be float16, float32 or bfloat16(only Atlas A2 series products are supported).
284
- weight (Tensor, optional): A rescaling weight applied to the loss of each batch element. It can be
285
- broadcast to a tensor with shape of `input`. Data type must be float16, float32 or bfloat16(only
286
- Atlas A2 series products are supported).
287
- Default: ``None``, `weight` is a Tensor whose value is ``1``.
288
- reduction (str, optional): Apply specific reduction method to the output: ``'none'`` , ``'mean'`` ,
289
- ``'sum'`` . Default: ``'mean'`` .
290
-
291
- - ``'none'``: no reduction will be applied.
292
- - ``'mean'``: compute and return the weighted mean of elements in the output.
293
- - ``'sum'``: the output elements will be summed.
294
- pos_weight (Tensor, optional): A weight of positive examples. Must be a vector with length equal to the
295
- number of classes. It can be broadcast to a tensor with shape of `input`.
296
- Data type must be float16, float32 or bfloat16(only Atlas A2 series products are supported).
297
- Default: ``None``, it equals to `pos_weight` is a Tensor whose value is ``1``.
298
-
299
- Returns:
300
- Tensor or Scalar, if `reduction` is ``'none'``, it's a tensor with the same shape and type as input `input`.
301
- Otherwise, the output is a Scalar.
302
-
303
- Raises:
304
- TypeError: If input `input`, `target`, `weight`, `pos_weight` is not Tensor.
305
- TypeError: If data type of input `reduction` is not string.
306
- ValueError: If `weight` or `pos_weight` can not be broadcast to a tensor with shape of `input`.
307
- ValueError: If `reduction` is not one of ``'none'``, ``'mean'`` or ``'sum'``.
308
-
309
- Supported Platforms:
310
- ``Ascend``
311
-
312
- Examples:
313
- >>> import mindspore
314
- >>> import numpy as np
315
- >>> from mindspore import Tensor, mint
316
- >>> input = Tensor(np.array([[-0.8, 1.2, 0.7], [-0.1, -0.4, 0.7]]), mindspore.float32)
317
- >>> target = Tensor(np.array([[0.3, 0.8, 1.2], [-0.6, 0.1, 2.2]]), mindspore.float32)
318
- >>> weight = Tensor(np.array([1.0, 1.0, 1.0]), mindspore.float32)
319
- >>> pos_weight = Tensor(np.array([1.0, 1.0, 1.0]), mindspore.float32)
320
- >>> output = mint.nn.functional.binary_cross_entropy_with_logits(input, target, weight, pos_weight)
321
- >>> print(output)
322
- 0.3463612
323
- """
324
- return bce_with_logits(input, target, weight, pos_weight, reduction)
325
-
326
-
327
- def one_hot(tensor, num_classes=-1):
328
- r"""
329
- Computes a one-hot tensor.
330
-
331
- The locations represented by tensor in `tensor` take value `1`, while all
332
- other locations take value `0`.
333
-
334
- Args:
335
- tensor (Tensor): A tensor of indices. Tensor of shape :math:`(X_0, \ldots, X_n)`.
336
- Data type must be int32 or int64.
337
- num_classes (int): A scalar defining the depth of the one-hot dimension, default: ``-1``.
338
-
339
- Returns:
340
- Tensor, one-hot tensor.
341
-
342
- Raises:
343
- TypeError: If `num_classes` is not an int.
344
- TypeError: If dtype of `tensor` is not int32 or int64.
345
- ValueError: If `num_classes` is less than -1.
346
-
347
- Supported Platforms:
348
- ``Ascend`` ``GPU`` ``CPU``
349
-
350
- Examples:
351
- >>> import mindspore
352
- >>> import numpy as np
353
- >>> from mindspore import Tensor, mint
354
- >>> tensor = Tensor(np.array([0, 1, 2]), mindspore.int32)
355
- >>> num_classes = 3
356
- >>> output = mint.nn.functional.one_hot(tensor, num_classes)
357
- >>> print(output)
358
- [[1 0 0]
359
- [0 1 0]
360
- [0 0 1]]
361
- """
362
- return one_hot_ext(tensor, num_classes)
363
-
364
221
 
365
222
  __all__ = [
366
223
  'conv_transpose2d',
367
224
  'max_pool2d',
368
225
  # 1
369
- 'binary_cross_entropy_with_logits',
226
+
370
227
  # 2
371
228
 
372
229
  # 3
@@ -376,9 +233,9 @@ __all__ = [
376
233
  # 5
377
234
  'pad',
378
235
  # 6
379
- 'unfold',
236
+
380
237
  # 7
381
- 'fold',
238
+
382
239
  # 8
383
240
  'layer_norm',
384
241
  # 9
@@ -402,7 +259,7 @@ __all__ = [
402
259
  # 18
403
260
 
404
261
  # 19
405
- 'binary_cross_entropy',
262
+
406
263
  # 20
407
264
 
408
265
  # 21
@@ -426,13 +283,13 @@ __all__ = [
426
283
  # 30
427
284
 
428
285
  # 31
429
- 'softmax',
286
+
430
287
  # 32
431
288
 
432
289
  # 33
433
290
 
434
291
  # 34
435
- 'batch_norm',
292
+
436
293
  # 35
437
294
 
438
295
  # 36
@@ -440,7 +297,7 @@ __all__ = [
440
297
  # 37
441
298
 
442
299
  # 38
443
- 'linear',
300
+
444
301
  # 39
445
302
  'group_norm',
446
303
  # 40
@@ -492,7 +349,7 @@ __all__ = [
492
349
  # 63
493
350
 
494
351
  # 64
495
- 'one_hot',
352
+
496
353
  # 65
497
354
 
498
355
  # 66
@@ -550,7 +407,7 @@ __all__ = [
550
407
  # 92
551
408
  'leaky_relu',
552
409
  # 93
553
-
410
+ 'softplus',
554
411
  # 94
555
412
  'tanh',
556
413
  # 95
@@ -564,10 +421,4 @@ __all__ = [
564
421
  # 99
565
422
 
566
423
  # 100
567
-
568
- # 323
569
-
570
- # 324
571
- 'elu',
572
- # 325
573
424
  ]
@@ -86,20 +86,19 @@ class AdamW(Optimizer):
86
86
  \end{aligned}
87
87
 
88
88
  .. warning::
89
- - This is an experimental optimizer API that is subject to change.
90
- This module must be used with lr scheduler module in `LRScheduler Class
91
- <https://www.mindspore.cn/docs/en/master/api_python/mindspore.experimental.html#lrscheduler-class>`_ .
92
- - For Ascend, it is only supported on platforms above Atlas A2.
89
+ This is an experimental optimizer API that is subject to change.
90
+ This module must be used with lr scheduler module in `LRScheduler Class
91
+ <https://www.mindspore.cn/docs/en/master/api_python/mindspore.experimental.html#lrscheduler-class>`_ .
93
92
 
94
93
  Args:
95
94
  params (Union[list(Parameter), list(dict)]): list of parameters to optimize or dicts defining
96
- parameter groups.
97
- lr (float, optional): learning rate. Default: ``1e-3``.
95
+ parameter groups
96
+ lr (Union[int, float, Tensor], optional): learning rate. Default: ``1e-3``.
98
97
  betas (Tuple[float, float], optional): The exponential decay rate for the moment estimations.
99
98
  Default: ``(0.9, 0.999)``.
100
99
  eps (float, optional): term added to the denominator to improve
101
- numerical stability. Must be greater than 0. Default: ``1e-8``.
102
- weight_decay (float, optional): weight decay (L2 penalty). Default: ``1e-2.``.
100
+ numerical stability. Default: ``1e-8``.
101
+ weight_decay (float, optional): weight decay (L2 penalty). Default: ``0.``.
103
102
  amsgrad (bool, optional): whether to use the AMSGrad algorithm. Default: ``False``.
104
103
 
105
104
  Keyword Args:
@@ -110,14 +109,14 @@ class AdamW(Optimizer):
110
109
  - **gradients** (tuple[Tensor]) - The gradients of `params`.
111
110
 
112
111
  Raises:
113
- ValueError: If the learning rate is not float.
112
+ ValueError: If the learning rate is not int, float or Tensor.
114
113
  ValueError: If the learning rate is less than 0.
115
- ValueError: If the `eps` is less than 0.
114
+ ValueError: If the `eps` is less than 0.0.
116
115
  ValueError: If the `betas` not in the range of [0, 1).
117
116
  ValueError: If the `weight_decay` is less than 0.
118
117
 
119
118
  Supported Platforms:
120
- ``Ascend``
119
+ ``Ascend`` ``GPU`` ``CPU``
121
120
 
122
121
  Examples:
123
122
  >>> import mindspore
@@ -161,11 +160,11 @@ class AdamW(Optimizer):
161
160
  self.exp_avg = self.parameters.clone(prefix="exp_avg", init='zeros')
162
161
  self.exp_avg_sq = self.parameters.clone(prefix="exp_avg_sq", init='zeros')
163
162
  self.max_exp_avg_sq = self.parameters.clone(prefix="max_exp_avg_sq", init='zeros')
164
- self.state_step = Parameter(Tensor([-1], mstype.float32), "state_step")
163
+ self.state_step = Parameter(Tensor([0], mstype.float32), "state_step")
165
164
  self.increase_tensor = Tensor(1, mstype.float32)
166
165
  self.assignadd = P.AssignAdd()
167
166
  self.op_cast = P.Cast()
168
- self.adamw_opt = gen.AdamW()
167
+ self.adamw_opt = gen.AdamWeightDecayExt()
169
168
 
170
169
  def construct(self, gradients):
171
170
  self.assignadd(self.state_step, self.increase_tensor)
@@ -174,8 +173,10 @@ class AdamW(Optimizer):
174
173
  maximize = group.get("maximize")
175
174
  start_id = self.group_start_id[group_id]
176
175
  end_id = self.group_start_id[group_id + 1]
177
- lr = group.get("lr")
178
- grads = tuple(gradients[start_id: end_id])
176
+ lr = self.lrs[group_id]
177
+ if isinstance(group.get("lr"), float):
178
+ lr = self.op_cast(group.get("lr"), mstype.float32)
179
+ grads = tuple([grad if not maximize else F.neg(grad) for grad in gradients[start_id: end_id]])
179
180
 
180
181
  self.hyper_map(F.partial(_optim_adamw_opt, self.adamw_opt, beta1, beta2, float(lr),
181
182
  group.get("eps"), group.get("weight_decay"), self.state_step,
mindspore/nn/__init__.py CHANGED
@@ -21,6 +21,7 @@ from __future__ import absolute_import
21
21
 
22
22
  from mindspore.nn import layer, loss, optim, wrap, grad, metrics, probability, sparse, dynamic_lr, reinforcement
23
23
  from mindspore.nn.learning_rate_schedule import *
24
+ from mindspore.nn.generator import *
24
25
  from mindspore.nn.dynamic_lr import *
25
26
  from mindspore.nn.cell import Cell, GraphCell
26
27
  from mindspore.nn.layer import *
@@ -44,5 +45,6 @@ __all__.extend(sparse.__all__)
44
45
  __all__.extend(learning_rate_schedule.__all__)
45
46
  __all__.extend(dynamic_lr.__all__)
46
47
  __all__.extend(reinforcement.__all__)
48
+ __all__.extend(generator.__all__)
47
49
 
48
50
  __all__.sort()