mindspore 2.3.0__cp310-cp310-win_amd64.whl → 2.4.0__cp310-cp310-win_amd64.whl

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

Potentially problematic release.


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

Files changed (308) 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 +3 -1
  5. mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
  6. mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
  7. mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
  8. mindspore/_checkparam.py +50 -9
  9. mindspore/_extends/parse/compile_config.py +41 -0
  10. mindspore/_extends/parse/parser.py +9 -7
  11. mindspore/_extends/parse/standard_method.py +52 -14
  12. mindspore/_extends/pijit/pijit_func_white_list.py +350 -24
  13. mindspore/amp.py +24 -10
  14. mindspore/atlprov.dll +0 -0
  15. mindspore/avcodec-59.dll +0 -0
  16. mindspore/avdevice-59.dll +0 -0
  17. mindspore/avfilter-8.dll +0 -0
  18. mindspore/avformat-59.dll +0 -0
  19. mindspore/avutil-57.dll +0 -0
  20. mindspore/c1.dll +0 -0
  21. mindspore/c1xx.dll +0 -0
  22. mindspore/c2.dll +0 -0
  23. mindspore/common/__init__.py +6 -4
  24. mindspore/common/_pijit_context.py +190 -0
  25. mindspore/common/_register_for_tensor.py +2 -1
  26. mindspore/common/_tensor_overload.py +139 -0
  27. mindspore/common/api.py +102 -87
  28. mindspore/common/dump.py +5 -6
  29. mindspore/common/generator.py +1 -7
  30. mindspore/common/hook_handle.py +14 -26
  31. mindspore/common/mindir_util.py +2 -2
  32. mindspore/common/parameter.py +46 -13
  33. mindspore/common/recompute.py +39 -9
  34. mindspore/common/sparse_tensor.py +7 -3
  35. mindspore/common/tensor.py +209 -29
  36. mindspore/communication/__init__.py +1 -1
  37. mindspore/communication/_comm_helper.py +38 -3
  38. mindspore/communication/comm_func.py +310 -55
  39. mindspore/communication/management.py +14 -14
  40. mindspore/context.py +123 -22
  41. mindspore/dataset/__init__.py +1 -1
  42. mindspore/dataset/audio/__init__.py +1 -1
  43. mindspore/dataset/core/config.py +7 -0
  44. mindspore/dataset/core/validator_helpers.py +7 -0
  45. mindspore/dataset/engine/cache_client.py +1 -1
  46. mindspore/dataset/engine/datasets.py +72 -44
  47. mindspore/dataset/engine/datasets_audio.py +7 -7
  48. mindspore/dataset/engine/datasets_standard_format.py +53 -3
  49. mindspore/dataset/engine/datasets_text.py +20 -20
  50. mindspore/dataset/engine/datasets_user_defined.py +174 -104
  51. mindspore/dataset/engine/datasets_vision.py +33 -33
  52. mindspore/dataset/engine/iterators.py +29 -0
  53. mindspore/dataset/engine/obs/util.py +7 -0
  54. mindspore/dataset/engine/queue.py +114 -60
  55. mindspore/dataset/engine/serializer_deserializer.py +2 -2
  56. mindspore/dataset/engine/validators.py +34 -14
  57. mindspore/dataset/text/__init__.py +1 -4
  58. mindspore/dataset/transforms/__init__.py +0 -3
  59. mindspore/dataset/utils/line_reader.py +2 -0
  60. mindspore/dataset/vision/__init__.py +1 -4
  61. mindspore/dataset/vision/utils.py +1 -1
  62. mindspore/dataset/vision/validators.py +2 -1
  63. mindspore/dnnl.dll +0 -0
  64. mindspore/dpcmi.dll +0 -0
  65. mindspore/{nn/extend → experimental/es}/__init__.py +4 -11
  66. mindspore/experimental/es/embedding_service.py +883 -0
  67. mindspore/{nn/layer → experimental/es}/embedding_service_layer.py +218 -30
  68. mindspore/experimental/llm_boost/__init__.py +21 -0
  69. mindspore/{nn/extend/layer → experimental/llm_boost/atb}/__init__.py +4 -8
  70. mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
  71. mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
  72. mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
  73. mindspore/experimental/llm_boost/register.py +129 -0
  74. mindspore/experimental/llm_boost/utils.py +31 -0
  75. mindspore/experimental/optim/adamw.py +85 -0
  76. mindspore/experimental/optim/optimizer.py +3 -0
  77. mindspore/hal/__init__.py +3 -3
  78. mindspore/hal/contiguous_tensors_handle.py +175 -0
  79. mindspore/hal/stream.py +18 -0
  80. mindspore/include/api/model_group.h +13 -1
  81. mindspore/include/api/types.h +10 -10
  82. mindspore/include/dataset/config.h +2 -2
  83. mindspore/include/dataset/constants.h +2 -2
  84. mindspore/include/dataset/execute.h +2 -2
  85. mindspore/include/dataset/vision.h +4 -0
  86. mindspore/jpeg62.dll +0 -0
  87. mindspore/log.py +1 -1
  88. mindspore/mindrecord/filewriter.py +68 -51
  89. mindspore/mindspore_backend.dll +0 -0
  90. mindspore/mindspore_common.dll +0 -0
  91. mindspore/mindspore_core.dll +0 -0
  92. mindspore/mindspore_glog.dll +0 -0
  93. mindspore/mindspore_np_dtype.dll +0 -0
  94. mindspore/mindspore_ops.dll +0 -0
  95. mindspore/mint/__init__.py +495 -46
  96. mindspore/mint/distributed/__init__.py +31 -0
  97. mindspore/mint/distributed/distributed.py +254 -0
  98. mindspore/mint/nn/__init__.py +266 -21
  99. mindspore/mint/nn/functional.py +125 -19
  100. mindspore/mint/nn/layer/__init__.py +39 -0
  101. mindspore/mint/nn/layer/activation.py +133 -0
  102. mindspore/mint/nn/layer/normalization.py +477 -0
  103. mindspore/mint/nn/layer/pooling.py +110 -0
  104. mindspore/mint/optim/adamw.py +28 -7
  105. mindspore/mint/special/__init__.py +63 -0
  106. mindspore/msobj140.dll +0 -0
  107. mindspore/mspdb140.dll +0 -0
  108. mindspore/mspdbcore.dll +0 -0
  109. mindspore/mspdbst.dll +0 -0
  110. mindspore/mspft140.dll +0 -0
  111. mindspore/msvcdis140.dll +0 -0
  112. mindspore/msvcp140_1.dll +0 -0
  113. mindspore/msvcp140_2.dll +0 -0
  114. mindspore/msvcp140_atomic_wait.dll +0 -0
  115. mindspore/msvcp140_codecvt_ids.dll +0 -0
  116. mindspore/multiprocessing/__init__.py +2 -1
  117. mindspore/nn/__init__.py +0 -1
  118. mindspore/nn/cell.py +275 -93
  119. mindspore/nn/layer/activation.py +211 -44
  120. mindspore/nn/layer/basic.py +113 -3
  121. mindspore/nn/layer/embedding.py +120 -2
  122. mindspore/nn/layer/normalization.py +101 -5
  123. mindspore/nn/layer/padding.py +34 -48
  124. mindspore/nn/layer/pooling.py +161 -7
  125. mindspore/nn/layer/transformer.py +3 -3
  126. mindspore/nn/loss/__init__.py +2 -2
  127. mindspore/nn/loss/loss.py +84 -6
  128. mindspore/nn/optim/__init__.py +2 -1
  129. mindspore/nn/optim/adadelta.py +1 -1
  130. mindspore/nn/optim/adam.py +1 -1
  131. mindspore/nn/optim/lamb.py +1 -1
  132. mindspore/nn/optim/tft_wrapper.py +127 -0
  133. mindspore/nn/wrap/cell_wrapper.py +12 -23
  134. mindspore/nn/wrap/grad_reducer.py +5 -5
  135. mindspore/nn/wrap/loss_scale.py +17 -3
  136. mindspore/numpy/__init__.py +1 -1
  137. mindspore/numpy/array_creations.py +65 -68
  138. mindspore/numpy/array_ops.py +64 -60
  139. mindspore/numpy/fft.py +610 -75
  140. mindspore/numpy/logic_ops.py +11 -10
  141. mindspore/numpy/math_ops.py +85 -84
  142. mindspore/numpy/utils_const.py +4 -4
  143. mindspore/opencv_core452.dll +0 -0
  144. mindspore/opencv_imgcodecs452.dll +0 -0
  145. mindspore/opencv_imgproc452.dll +0 -0
  146. mindspore/ops/__init__.py +6 -4
  147. mindspore/ops/_grad_experimental/grad_comm_ops.py +47 -3
  148. mindspore/ops/_grad_experimental/grad_math_ops.py +0 -22
  149. mindspore/ops/_vmap/vmap_array_ops.py +2 -4
  150. mindspore/ops/_vmap/vmap_math_ops.py +17 -1
  151. mindspore/ops/_vmap/vmap_nn_ops.py +43 -2
  152. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +85 -7
  153. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +2 -0
  154. mindspore/ops/auto_generate/gen_extend_func.py +734 -13
  155. mindspore/ops/auto_generate/gen_ops_def.py +2420 -381
  156. mindspore/ops/auto_generate/gen_ops_prim.py +5196 -1659
  157. mindspore/ops/auto_generate/pyboost_inner_prim.py +176 -56
  158. mindspore/ops/composite/base.py +85 -48
  159. mindspore/ops/composite/multitype_ops/_compile_utils.py +1 -0
  160. mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -2
  161. mindspore/ops/function/__init__.py +22 -0
  162. mindspore/ops/function/array_func.py +490 -153
  163. mindspore/ops/function/debug_func.py +113 -1
  164. mindspore/ops/function/fft_func.py +15 -2
  165. mindspore/ops/function/grad/grad_func.py +3 -2
  166. mindspore/ops/function/math_func.py +558 -207
  167. mindspore/ops/function/nn_func.py +817 -383
  168. mindspore/ops/function/other_func.py +3 -2
  169. mindspore/ops/function/random_func.py +184 -8
  170. mindspore/ops/function/reshard_func.py +13 -11
  171. mindspore/ops/function/sparse_unary_func.py +1 -1
  172. mindspore/ops/function/vmap_func.py +3 -2
  173. mindspore/ops/functional.py +24 -14
  174. mindspore/ops/op_info_register.py +3 -3
  175. mindspore/ops/operations/__init__.py +6 -1
  176. mindspore/ops/operations/_grad_ops.py +2 -76
  177. mindspore/ops/operations/_infer_ops.py +1 -1
  178. mindspore/ops/operations/_inner_ops.py +71 -94
  179. mindspore/ops/operations/array_ops.py +12 -146
  180. mindspore/ops/operations/comm_ops.py +42 -53
  181. mindspore/ops/operations/custom_ops.py +83 -19
  182. mindspore/ops/operations/debug_ops.py +42 -10
  183. mindspore/ops/operations/manually_defined/_inner.py +12 -0
  184. mindspore/ops/operations/manually_defined/ops_def.py +265 -10
  185. mindspore/ops/operations/math_ops.py +12 -223
  186. mindspore/ops/operations/nn_ops.py +20 -114
  187. mindspore/ops/operations/other_ops.py +7 -4
  188. mindspore/ops/operations/random_ops.py +46 -1
  189. mindspore/ops/primitive.py +18 -6
  190. mindspore/ops_generate/arg_dtype_cast.py +2 -0
  191. mindspore/ops_generate/gen_aclnn_implement.py +11 -11
  192. mindspore/ops_generate/gen_constants.py +36 -0
  193. mindspore/ops_generate/gen_ops.py +67 -52
  194. mindspore/ops_generate/gen_ops_inner_prim.py +1 -1
  195. mindspore/ops_generate/gen_pyboost_func.py +131 -47
  196. mindspore/ops_generate/op_proto.py +10 -3
  197. mindspore/ops_generate/pyboost_utils.py +14 -1
  198. mindspore/ops_generate/template.py +43 -21
  199. mindspore/parallel/__init__.py +3 -1
  200. mindspore/parallel/_auto_parallel_context.py +28 -8
  201. mindspore/parallel/_cell_wrapper.py +83 -0
  202. mindspore/parallel/_parallel_serialization.py +47 -19
  203. mindspore/parallel/_tensor.py +81 -11
  204. mindspore/parallel/_utils.py +13 -1
  205. mindspore/parallel/algo_parameter_config.py +5 -5
  206. mindspore/parallel/checkpoint_transform.py +46 -39
  207. mindspore/parallel/cluster/process_entity/__init__.py +1 -1
  208. mindspore/parallel/cluster/process_entity/_api.py +31 -23
  209. mindspore/parallel/cluster/process_entity/_utils.py +2 -27
  210. mindspore/parallel/parameter_broadcast.py +3 -4
  211. mindspore/parallel/shard.py +162 -31
  212. mindspore/parallel/transform_safetensors.py +993 -0
  213. mindspore/pgodb140.dll +0 -0
  214. mindspore/pgort140.dll +0 -0
  215. mindspore/profiler/__init__.py +2 -1
  216. mindspore/profiler/common/constant.py +29 -0
  217. mindspore/profiler/common/registry.py +47 -0
  218. mindspore/profiler/common/util.py +28 -0
  219. mindspore/profiler/dynamic_profiler.py +694 -0
  220. mindspore/profiler/envprofiling.py +17 -19
  221. mindspore/profiler/parser/ascend_analysis/constant.py +18 -0
  222. mindspore/profiler/parser/ascend_analysis/file_manager.py +25 -4
  223. mindspore/profiler/parser/ascend_analysis/function_event.py +43 -19
  224. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +31 -26
  225. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +56 -10
  226. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +55 -8
  227. mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
  228. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +27 -20
  229. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +9 -2
  230. mindspore/profiler/parser/ascend_msprof_exporter.py +5 -4
  231. mindspore/profiler/parser/ascend_timeline_generator.py +27 -25
  232. mindspore/profiler/parser/base_timeline_generator.py +19 -25
  233. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
  234. mindspore/profiler/parser/framework_parser.py +1 -391
  235. mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
  236. mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
  237. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
  238. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
  239. mindspore/profiler/parser/memory_usage_parser.py +0 -154
  240. mindspore/profiler/parser/profiler_info.py +78 -6
  241. mindspore/profiler/profiler.py +153 -0
  242. mindspore/profiler/profiling.py +280 -412
  243. mindspore/rewrite/__init__.py +1 -2
  244. mindspore/rewrite/common/namespace.py +4 -4
  245. mindspore/rewrite/symbol_tree/symbol_tree.py +3 -3
  246. mindspore/run_check/_check_version.py +36 -103
  247. mindspore/safeguard/rewrite_obfuscation.py +591 -247
  248. mindspore/swresample-4.dll +0 -0
  249. mindspore/swscale-6.dll +0 -0
  250. mindspore/tbbmalloc.dll +0 -0
  251. mindspore/tinyxml2.dll +0 -0
  252. mindspore/train/__init__.py +4 -3
  253. mindspore/train/_utils.py +28 -2
  254. mindspore/train/amp.py +171 -53
  255. mindspore/train/callback/__init__.py +2 -2
  256. mindspore/train/callback/_callback.py +4 -4
  257. mindspore/train/callback/_checkpoint.py +85 -22
  258. mindspore/train/callback/_cluster_monitor.py +1 -1
  259. mindspore/train/callback/_flops_collector.py +1 -0
  260. mindspore/train/callback/_loss_monitor.py +3 -3
  261. mindspore/train/callback/_on_request_exit.py +134 -31
  262. mindspore/train/callback/_summary_collector.py +5 -5
  263. mindspore/train/callback/_tft_register.py +352 -0
  264. mindspore/train/dataset_helper.py +7 -3
  265. mindspore/train/metrics/metric.py +3 -3
  266. mindspore/train/metrics/roc.py +4 -4
  267. mindspore/train/mind_ir_pb2.py +44 -39
  268. mindspore/train/model.py +134 -58
  269. mindspore/train/serialization.py +336 -112
  270. mindspore/turbojpeg.dll +0 -0
  271. mindspore/utils/__init__.py +21 -0
  272. mindspore/utils/utils.py +60 -0
  273. mindspore/vcmeta.dll +0 -0
  274. mindspore/vcruntime140.dll +0 -0
  275. mindspore/vcruntime140_1.dll +0 -0
  276. mindspore/version.py +1 -1
  277. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/METADATA +6 -2
  278. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/RECORD +281 -275
  279. mindspore/include/c_api/ms/abstract.h +0 -67
  280. mindspore/include/c_api/ms/attribute.h +0 -197
  281. mindspore/include/c_api/ms/base/handle_types.h +0 -43
  282. mindspore/include/c_api/ms/base/macros.h +0 -32
  283. mindspore/include/c_api/ms/base/status.h +0 -33
  284. mindspore/include/c_api/ms/base/types.h +0 -283
  285. mindspore/include/c_api/ms/context.h +0 -102
  286. mindspore/include/c_api/ms/graph.h +0 -160
  287. mindspore/include/c_api/ms/node.h +0 -606
  288. mindspore/include/c_api/ms/tensor.h +0 -161
  289. mindspore/include/c_api/ms/value.h +0 -84
  290. mindspore/mindspore_shared_lib.dll +0 -0
  291. mindspore/nn/extend/basic.py +0 -140
  292. mindspore/nn/extend/embedding.py +0 -143
  293. mindspore/nn/extend/layer/normalization.py +0 -109
  294. mindspore/nn/extend/pooling.py +0 -117
  295. mindspore/nn/layer/embedding_service.py +0 -531
  296. mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
  297. mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
  298. mindspore/ops/extend/__init__.py +0 -53
  299. mindspore/ops/extend/array_func.py +0 -218
  300. mindspore/ops/extend/math_func.py +0 -76
  301. mindspore/ops/extend/nn_func.py +0 -308
  302. mindspore/ops/silent_check.py +0 -162
  303. mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
  304. mindspore/profiler/parser/msadvisor_parser.py +0 -240
  305. mindspore/train/callback/_mindio_ttp.py +0 -443
  306. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/WHEEL +0 -0
  307. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/entry_points.txt +0 -0
  308. {mindspore-2.3.0.dist-info → mindspore-2.4.0.dist-info}/top_level.txt +0 -0
@@ -1,4 +1,4 @@
1
- # Copyright 2020-2021 Huawei Technologies Co., Ltd
1
+ # Copyright 2020-2024 Huawei Technologies Co., Ltd
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License");
4
4
  # you may not use this file except in compliance with the License.
@@ -278,7 +278,7 @@ def ones(shape, dtype=mstype.float32):
278
278
  Args:
279
279
  shape (Union[int, tuple, list]): the shape of the new tensor.
280
280
  dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype.
281
- Default is :class:`mstype.float32`.
281
+ Default is ``mstype.float32``.
282
282
 
283
283
  Returns:
284
284
  Tensor, with the designated `shape` and `dtype`, filled with ones.
@@ -311,7 +311,7 @@ def zeros(shape, dtype=mstype.float32):
311
311
  Args:
312
312
  shape (Union[int, tuple, list]): the shape of the new tensor.
313
313
  dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype.
314
- Default is :class:`mstype.float32`.
314
+ Default is mstype.float32.
315
315
 
316
316
  Returns:
317
317
  Tensor, with the designated `shape` and `dtype`, filled with zeros.
@@ -433,7 +433,7 @@ def randn(*shape, dtype=mstype.float32):
433
433
  *shape (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g.,
434
434
  :math:`(2, 3)` or :math:`2`.
435
435
  dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype, it must
436
- be float type. Default is :class:`mindspore.float32`.
436
+ be float type. Default is ``mindspore.float32``.
437
437
 
438
438
  Returns:
439
439
  Tensor, with the designated shape and dtype, filled with a sample (or samples)
@@ -474,7 +474,7 @@ def rand(*shape, dtype=mstype.float32):
474
474
  *shape (Union[int, tuple(int), list(int)]): Shape of the new tensor, e.g.,
475
475
  :math:`(2, 3)` or :math:`2`.
476
476
  dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype, it must
477
- be float type. Default is :class:`mindspore.float32`.
477
+ be float type. Default is ``mindspore.float32``.
478
478
 
479
479
  Returns:
480
480
  Tensor, with the designated shape and dtype, filled with random numbers from the
@@ -519,7 +519,7 @@ def randint(minval, maxval=None, shape=None, dtype=mstype.int32):
519
519
  maxval(Union[int], optional): End value of interval. The interval does not include this value.
520
520
  shape (Union[int, tuple(int)]): Shape of the new tensor, e.g., :math:`(2, 3)` or :math:`2`.
521
521
  dtype (Union[:class:`mindspore.dtype`, str], optional): Designated tensor dtype, it must
522
- be int type. Default is :class:`mindspore.int32`.
522
+ be int type. Default is `mindspore.int32`.
523
523
 
524
524
  Returns:
525
525
  Tensor, with the designated shape and dtype, filled with random integers from minval (inclusive)
@@ -1068,9 +1068,9 @@ def ones_like(a, dtype=None, shape=None):
1068
1068
  a (Union[Tensor, list, tuple]): The shape and data-type of a define these same
1069
1069
  attributes of the returned array.
1070
1070
  dtype (:class:`mindspore.dtype`, optional): Overrides the data type of the
1071
- result.
1072
- shape (int or sequence of ints, optional): Overrides the shape
1073
- of the result.
1071
+ result. Default: ``None``.
1072
+ shape (int, sequence of ints, optional): Overrides the shape
1073
+ of the result. Default: ``None``.
1074
1074
 
1075
1075
  Returns:
1076
1076
  Tensor, array of ones with the same shape and type as `a`.
@@ -1107,7 +1107,7 @@ def zeros_like(a, dtype=None, shape=None):
1107
1107
  attributes of the returned array.
1108
1108
  dtype (:class:`mindspore.dtype`, optional): Overrides the data type of the
1109
1109
  result.
1110
- shape (int or sequence of ints, optional): Overrides the shape
1110
+ shape (int, sequence of ints, optional): Overrides the shape
1111
1111
  of the result.
1112
1112
 
1113
1113
  Returns:
@@ -1137,8 +1137,8 @@ def full_like(a, fill_value, dtype=None, shape=None):
1137
1137
  Returns a full array with the same shape and type as a given array.
1138
1138
 
1139
1139
  Note:
1140
- Input array must have the same size across a dimension.
1141
- If `a` is not a Tensor, dtype is float32 by default if not provided.
1140
+ - Input array must have the same size across a dimension.
1141
+ - If `a` is not a Tensor, dtype is float32 by default if not provided.
1142
1142
 
1143
1143
  Args:
1144
1144
  a (Union[Tensor, list, tuple]): The shape and data-type of `a` define these same
@@ -1146,7 +1146,7 @@ def full_like(a, fill_value, dtype=None, shape=None):
1146
1146
  fill_value (scalar): Fill value.
1147
1147
  dtype (:class:`mindspore.dtype`, optional): Overrides the data type of the
1148
1148
  result.
1149
- shape (int or sequence of ints, optional): Overrides the shape
1149
+ shape (int, sequence of ints, optional): Overrides the shape
1150
1150
  of the result.
1151
1151
 
1152
1152
  Returns:
@@ -1178,7 +1178,7 @@ def tri(N, M=None, k=0, dtype=mstype.float32):
1178
1178
  Args:
1179
1179
  N(int): Number of rows in the array.
1180
1180
  M(int, optional): Number of columns in the array. By default, `M` is taken
1181
- equal to N.
1181
+ equal to N. Default: ``None`` .
1182
1182
  k(int, optional): The sub-diagonal at and below which the array is filled.
1183
1183
  :math:`k = 0` is the main diagonal, while :math:`k < 0` is below it, and :math:`k > 0` is above.
1184
1184
  Default: ``0`` .
@@ -1382,47 +1382,44 @@ def diagonal(a, offset=0, axis1=0, axis2=1):
1382
1382
 
1383
1383
  def trace(a, offset=0, axis1=0, axis2=1, dtype=None):
1384
1384
  """
1385
- Returns the sum along diagonals of the array.
1386
-
1387
- If `a` is 2-D, the sum along its diagonal with the given offset is returned,
1388
- i.e., the sum of elements ``a[i,i+offset]`` for all `i`.
1389
- If `a` has more than two dimensions, then the axes specified by `axis1` and
1390
- `axis2` are used to determine the 2-D sub-arrays whose traces are returned.
1391
- The shape of the resulting array is the same as that of a with `axis1` and
1392
- `axis2` removed.
1385
+ Return the sum along diagonals of the tensor.
1393
1386
 
1394
1387
  Note:
1395
- On GPU, the supported dtypes are np.float16, and np.float32.
1396
- On CPU, the supported dtypes are np.float16, np.float32, and np.float64.
1388
+ - `trace` is currently only used in `mindscience` scientific computing scenarios and
1389
+ dose not support other usage scenarios.
1390
+ - `trace` is not supported on Windows platform yet.
1397
1391
 
1398
1392
  Args:
1399
- a (Tensor): Array from which the diagonals are taken.
1393
+ a (Tensor): A matrix to be calculated.
1400
1394
  offset (int, optional): Offset of the diagonal from the main diagonal.
1401
- Can be positive or negative. Defaults to main diagonal.
1395
+ Can be positive or negative. Default: ``0``.
1402
1396
  axis1 (int, optional): Axis to be used as the first axis of the 2-D
1403
- sub-arrays from which the diagonals should be taken. Defaults to
1404
- first axis (0).
1397
+ sub-arrays from which the diagonals should be taken. Default: ``0``.
1405
1398
  axis2 (int, optional): Axis to be used as the second axis of the 2-D
1406
- sub-arrays from which the diagonals should be taken. Defaults to
1407
- second axis.
1408
- dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
1409
- output Tensor.
1399
+ sub-arrays from which the diagonals should be taken. Default: ``1``.
1400
+ dtype (:class:`mindspore.dtype`, optional): Overrides the dtype of the
1401
+ output Tensor if not ``None``. Default: ``None``.
1410
1402
 
1411
1403
  Returns:
1412
- Tensor, sum_along_diagonals. If `a` is 2-D, the sum along the diagonal
1413
- is returned. If `a` has larger dimensions, then an array of sums along
1414
- diagonals is returned.
1404
+ Tensor, the sum along diagonals. If `a` is 2-D, the sum along the diagonal is returned.
1405
+ If `a` has more than two dimensions, then the axes specified by `axis1` and `axis2` are used
1406
+ to determine the 2-D sub-arrays whose traces are returned. The shape of the resulting
1407
+ array is the same as that of `a` with `axis1` and `axis2` removed.
1415
1408
 
1416
1409
  Raises:
1417
- ValueError: If the input tensor has less than two dimensions.
1410
+ ValueError: If `a` has less than two dimensions.
1411
+ ValueError: If `axis1` or `axis2` is not in [-dims, dims), which dims is dimension of `a`.
1412
+ ValueError: If axes specified by `axis1` and `axis2` are same.
1418
1413
 
1419
1414
  Supported Platforms:
1420
1415
  ``Ascend`` ``GPU`` ``CPU``
1421
1416
 
1422
1417
  Examples:
1423
- >>> import mindspore.numpy as np
1424
- >>> output = np.trace(np.eye(3))
1425
- >>> print(output)
1418
+ >>> import numpy as np
1419
+ >>> from mindspore import Tensor
1420
+ >>> from mindspore.numpy import trace
1421
+ >>> x = Tensor(np.eye(3, dtype=np.float32))
1422
+ >>> print(trace(x))
1426
1423
  3.0
1427
1424
  """
1428
1425
  return a.trace(offset=offset, axis1=axis1, axis2=axis2, dtype=dtype)
@@ -1589,7 +1586,7 @@ class NdGrid:
1589
1586
 
1590
1587
  class MGridClass(NdGrid):
1591
1588
  """
1592
- mgrid is an :class:`NdGrid` instance with ``sparse=False``.
1589
+ mgrid is an `NdGrid` instance with ``sparse=False``.
1593
1590
 
1594
1591
  The dimension and number of the output arrays are equal to the number
1595
1592
  of indexing dimensions. If the step length is not a complex number,
@@ -1638,7 +1635,7 @@ class MGridClass(NdGrid):
1638
1635
 
1639
1636
  class OGridClass(NdGrid):
1640
1637
  """
1641
- ogrid is an :class:`NdGrid` instance with ``sparse=True``.
1638
+ ogrid is an `NdGrid` instance with ``sparse=True``.
1642
1639
 
1643
1640
  The dimension and number of the output arrays are equal to the number
1644
1641
  of indexing dimensions. If the step length is not a complex number,
@@ -1957,8 +1954,8 @@ def indices(dimensions, dtype=mstype.int32, sparse=False):
1957
1954
  varying only along the corresponding axis.
1958
1955
 
1959
1956
  Args:
1960
- dimensions (tuple or list of ints): The shape of the grid.
1961
- dtype (:class:`mindspore.dtype`, optional): Data type of the result.
1957
+ dimensions (Union[list(int), tuple]): The shape of the grid.
1958
+ dtype (:class:`mindspore.dtype`, optional): Data type of the result. Default: ``mstype.int32``.
1962
1959
  sparse (boolean, optional): Default: ``False`` . Return a sparse
1963
1960
  representation of the grid instead of a dense representation.
1964
1961
 
@@ -2167,7 +2164,7 @@ def triu_indices(n, k=0, m=None):
2167
2164
  n (int): The size of the arrays for which the returned indices will be valid.
2168
2165
  k (int, optional): Diagonal offset, default: ``0`` .
2169
2166
  m (int, optional): The column dimension of the arrays for which the returned
2170
- arrays will be valid. By default `m` is taken equal to `n`.
2167
+ arrays will be valid. By default `m` is taken equal to `n`. Default: ``None`` .
2171
2168
 
2172
2169
  Returns:
2173
2170
  The indices for the triangle. The returned tuple contains two tensors, each
@@ -2196,7 +2193,7 @@ def tril_indices(n, k=0, m=None):
2196
2193
  n (int): The size of the arrays for which the returned indices will be valid.
2197
2194
  k (int, optional): Diagonal offset, default: ``0`` .
2198
2195
  m (int, optional): The column dimension of the arrays for which the returned
2199
- arrays will be valid. By default `m` is taken equal to `n`.
2196
+ arrays will be valid. By default `m` is taken equal to `n`. Default: ``None`` .
2200
2197
 
2201
2198
  Returns:
2202
2199
  The indices for the triangle. The returned tuple contains two tensors, each
@@ -2259,7 +2256,7 @@ def tril_indices_from(arr, k=0):
2259
2256
 
2260
2257
  Returns:
2261
2258
  triu_indices_from, tuple of 2 tensor, shape(N)
2262
- Indices for the upper-triangle of `arr`.
2259
+ Indices for the lower-triangle of `arr`.
2263
2260
 
2264
2261
  Raises:
2265
2262
  TypeError: If `arr` cannot be converted to tensor, or `k` is not a number.
@@ -2291,15 +2288,15 @@ def histogram_bin_edges(a, bins=10, range=None, weights=None): # pylint: disabl
2291
2288
  Args:
2292
2289
  a (Union[int, float, bool, list, tuple, Tensor]): Input data. The histogram
2293
2290
  is computed over the flattened array.
2294
- bins ((Union[int, tuple, list, Tensor])): If `bins` is an int, it defines the number
2291
+ bins (Union[int, tuple, list, Tensor], optional): If `bins` is an int, it defines the number
2295
2292
  of equal-width bins in the given range (10, by default). If `bins` is a
2296
2293
  sequence, it defines the bin edges, including the rightmost edge,
2297
2294
  allowing for non-uniform bin widths.
2298
- range((float, float), optional): The lower and upper range of the bins. If
2295
+ range ((float, float), optional): The lower and upper range of the bins. If
2299
2296
  not provided, `range` is simply ``(a.min(), a.max())``. Values outside
2300
2297
  the range are ignored. The first element of the range must be less than
2301
2298
  or equal to the second. Default: ``None`` .
2302
- weights(Union[int, float, bool, list, tuple, Tensor], optional): An array of weights,
2299
+ weights (Union[int, float, bool, list, tuple, Tensor], optional): An array of weights,
2303
2300
  of the same shape as `a`. Each value in `a` only contributes its associated weight
2304
2301
  towards the bin count (instead of 1). This is currently not used by any of the bin
2305
2302
  estimators, but may be in the future. Default: ``None`` .
@@ -2623,10 +2620,10 @@ def pad(arr, pad_width, mode="constant", stat_length=None, constant_values=0,
2623
2620
  Args:
2624
2621
  arr (Union[list, tuple, Tensor]): The array to pad.
2625
2622
  pad_width (Union[int, tuple, list]): Number of values padded to the edges of
2626
- each axis. :class:`((before_1, after_1), ... (before_N, after_N))` creates
2627
- unique pad widths for each axis. :class:`((before, after),)` yields same
2628
- before and after pad for each axis. :class:`(pad,)` or int is a shortcut
2629
- for :class:`before = after = pad width` for all axes.
2623
+ each axis. ``((before_1, after_1), ... (before_N, after_N))`` creates
2624
+ unique pad widths for each axis. ``((before, after),)`` yields same
2625
+ before and after pad for each axis. ``(pad,)`` or int is a shortcut
2626
+ for ``before = after = pad width`` for all axes.
2630
2627
  mode (string, optional):
2631
2628
  One of the following string values:
2632
2629
 
@@ -2645,26 +2642,26 @@ def pad(arr, pad_width, mode="constant", stat_length=None, constant_values=0,
2645
2642
  are used to pad the end and the end values are used to pad the beginning.
2646
2643
  - empty: Pads with undefined values.
2647
2644
  - <function>: The padding function, if used, should modify and return a new 1-d tensor.
2648
- It has the following signature: :class:`padding_func(tensor, iaxis_pad_width, iaxis, kwargs)`
2645
+ It has the following signature: ``padding_func(tensor, iaxis_pad_width, iaxis, kwargs)``
2649
2646
  stat_length (Union[tuple, list, int], optional): Used in \'maximum\', \'mean\',
2650
2647
  \'median\', and \'minimum\'. Number of values at edge of each axis used
2651
- to calculate the statistic value. :class:`((before_1, after_1), ... (before_N, after_N))`
2652
- creates unique statistic lengths for each axis. :class:`((before, after),)`
2653
- yields same before and after statistic lengths for each axis. :class:`(stat_length,)`
2654
- or int is a shortcut for :class:`before = after = statistic length` for all
2648
+ to calculate the statistic value. ``((before_1, after_1), ... (before_N, after_N))``
2649
+ creates unique statistic lengths for each axis. ``((before, after),)``
2650
+ yields same before and after statistic lengths for each axis. ``(stat_length,)``
2651
+ or int is a shortcut for ``before = after = statistic length`` for all
2655
2652
  axes. Default: ``None``, to use the entire axis.
2656
2653
  constant_values (Union[tuple, list, int], optional):
2657
- Used in :class:`constant mode`. The values to set the padded values for each
2658
- axis. :class:`((before_1, after_1), ... (before_N, after_N))` creates unique pad
2659
- constants for each axis. :class:`((before, after),)` yields same before and
2660
- after constants for each axis. :class:`(constant,)` or :class:`constant` is
2661
- a shortcut for :class:`before = after = constant` for all axes. Default: ``0`` .
2654
+ Used in ``constant mode``. The values to set the padded values for each
2655
+ axis. ``((before_1, after_1), ... (before_N, after_N))`` creates unique pad
2656
+ constants for each axis. ``((before, after),)`` yields same before and
2657
+ after constants for each axis. ``(constant,)`` or ``constant`` is
2658
+ a shortcut for ``before = after = constant`` for all axes. Default: ``0`` .
2662
2659
  end_values (Union[tuple, list, int], optional): Used in 'linear_ramp'. The values
2663
2660
  used for the ending value of the linear_ramp and that will form the edge of
2664
- the padded `arr`. :class:`((before_1, after_1), ... (before_N, after_N))`
2665
- unique end values for each axis. :class:`((before, after),)` yields same before
2666
- and after end values for each axis. :class:`(constant,)` or :class:`constant`
2667
- is a shortcut for :class:`before = after = constant` for all axes. Default: ``0`` .
2661
+ the padded `arr`. ``((before_1, after_1), ... (before_N, after_N))``
2662
+ unique end values for each axis. ``((before, after),)`` yields same before
2663
+ and after end values for each axis. ``(constant,)`` or ``constant``
2664
+ is a shortcut for ``before = after = constant`` for all axes. Default: ``0`` .
2668
2665
  reflect_type(string, optional) can choose between \'even\' and \'odd\'. Used in
2669
2666
  \'reflect\', and \'symmetric\'. The \'even\' style is the default with an
2670
2667
  unaltered reflection around the edge value. For the \'odd\' style, the extended
@@ -2680,7 +2677,7 @@ def pad(arr, pad_width, mode="constant", stat_length=None, constant_values=0,
2680
2677
  TypeError: If `arr`, `pad_width`, `stat_length`, `constant_values` or `end_values`
2681
2678
  have types not specified above.
2682
2679
  ValueError: If `mode` cannot be recognized, or if `pad_width`, `stat_length`,
2683
- `constant_values`, `end_values` cannot broadcast to :class:`(arr.ndim, 2)`,
2680
+ `constant_values`, `end_values` cannot broadcast to ``(arr.ndim, 2)``,
2684
2681
  or if keyword arguments got unexpected inputs.
2685
2682
  NotImplementedError: If mode is function or \'median\'.
2686
2683