mindspore 2.3.0__cp39-cp39-win_amd64.whl → 2.4.1__cp39-cp39-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 (287) hide show
  1. mindspore/.commit_id +1 -1
  2. mindspore/__init__.py +3 -1
  3. mindspore/_c_dataengine.cp39-win_amd64.pyd +0 -0
  4. mindspore/_c_expression.cp39-win_amd64.pyd +0 -0
  5. mindspore/_c_mindrecord.cp39-win_amd64.pyd +0 -0
  6. mindspore/_checkparam.py +50 -9
  7. mindspore/_extends/parse/compile_config.py +41 -0
  8. mindspore/_extends/parse/parser.py +9 -7
  9. mindspore/_extends/parse/standard_method.py +52 -14
  10. mindspore/_extends/pijit/pijit_func_white_list.py +350 -24
  11. mindspore/amp.py +24 -10
  12. mindspore/avcodec-59.dll +0 -0
  13. mindspore/avdevice-59.dll +0 -0
  14. mindspore/avfilter-8.dll +0 -0
  15. mindspore/avformat-59.dll +0 -0
  16. mindspore/avutil-57.dll +0 -0
  17. mindspore/common/__init__.py +6 -4
  18. mindspore/common/_pijit_context.py +190 -0
  19. mindspore/common/_register_for_tensor.py +2 -1
  20. mindspore/common/_tensor_overload.py +139 -0
  21. mindspore/common/api.py +102 -87
  22. mindspore/common/dump.py +5 -6
  23. mindspore/common/generator.py +1 -7
  24. mindspore/common/hook_handle.py +14 -26
  25. mindspore/common/initializer.py +51 -15
  26. mindspore/common/mindir_util.py +2 -2
  27. mindspore/common/parameter.py +62 -15
  28. mindspore/common/recompute.py +39 -9
  29. mindspore/common/sparse_tensor.py +7 -3
  30. mindspore/common/tensor.py +183 -37
  31. mindspore/communication/__init__.py +1 -1
  32. mindspore/communication/_comm_helper.py +38 -3
  33. mindspore/communication/comm_func.py +315 -60
  34. mindspore/communication/management.py +14 -14
  35. mindspore/context.py +132 -22
  36. mindspore/dataset/__init__.py +1 -1
  37. mindspore/dataset/audio/__init__.py +1 -1
  38. mindspore/dataset/core/config.py +7 -0
  39. mindspore/dataset/core/validator_helpers.py +7 -0
  40. mindspore/dataset/engine/cache_client.py +1 -1
  41. mindspore/dataset/engine/datasets.py +72 -44
  42. mindspore/dataset/engine/datasets_audio.py +7 -7
  43. mindspore/dataset/engine/datasets_standard_format.py +53 -3
  44. mindspore/dataset/engine/datasets_text.py +20 -20
  45. mindspore/dataset/engine/datasets_user_defined.py +174 -104
  46. mindspore/dataset/engine/datasets_vision.py +33 -33
  47. mindspore/dataset/engine/iterators.py +29 -0
  48. mindspore/dataset/engine/obs/util.py +7 -0
  49. mindspore/dataset/engine/queue.py +114 -60
  50. mindspore/dataset/engine/serializer_deserializer.py +2 -2
  51. mindspore/dataset/engine/validators.py +34 -14
  52. mindspore/dataset/text/__init__.py +1 -4
  53. mindspore/dataset/transforms/__init__.py +0 -3
  54. mindspore/dataset/utils/line_reader.py +2 -0
  55. mindspore/dataset/vision/__init__.py +1 -4
  56. mindspore/dataset/vision/utils.py +1 -1
  57. mindspore/dataset/vision/validators.py +2 -1
  58. mindspore/dnnl.dll +0 -0
  59. mindspore/{nn/extend → experimental/es}/__init__.py +4 -11
  60. mindspore/experimental/es/embedding_service.py +883 -0
  61. mindspore/{nn/layer → experimental/es}/embedding_service_layer.py +218 -30
  62. mindspore/experimental/llm_boost/__init__.py +21 -0
  63. mindspore/{nn/extend/layer → experimental/llm_boost/atb}/__init__.py +4 -8
  64. mindspore/experimental/llm_boost/atb/boost_base.py +211 -0
  65. mindspore/experimental/llm_boost/atb/llama_boost.py +115 -0
  66. mindspore/experimental/llm_boost/atb/qwen_boost.py +101 -0
  67. mindspore/experimental/llm_boost/register.py +129 -0
  68. mindspore/experimental/llm_boost/utils.py +31 -0
  69. mindspore/experimental/optim/adamw.py +85 -0
  70. mindspore/experimental/optim/optimizer.py +3 -0
  71. mindspore/hal/__init__.py +3 -3
  72. mindspore/hal/contiguous_tensors_handle.py +175 -0
  73. mindspore/hal/stream.py +18 -0
  74. mindspore/include/api/model_group.h +13 -1
  75. mindspore/include/api/types.h +10 -10
  76. mindspore/include/dataset/config.h +2 -2
  77. mindspore/include/dataset/constants.h +2 -2
  78. mindspore/include/dataset/execute.h +2 -2
  79. mindspore/include/dataset/vision.h +4 -0
  80. mindspore/jpeg62.dll +0 -0
  81. mindspore/log.py +1 -1
  82. mindspore/mindrecord/filewriter.py +68 -51
  83. mindspore/mindspore_backend.dll +0 -0
  84. mindspore/mindspore_common.dll +0 -0
  85. mindspore/mindspore_core.dll +0 -0
  86. mindspore/mindspore_glog.dll +0 -0
  87. mindspore/mindspore_np_dtype.dll +0 -0
  88. mindspore/mindspore_ops.dll +0 -0
  89. mindspore/mint/__init__.py +983 -46
  90. mindspore/mint/distributed/__init__.py +31 -0
  91. mindspore/mint/distributed/distributed.py +254 -0
  92. mindspore/mint/nn/__init__.py +268 -23
  93. mindspore/mint/nn/functional.py +125 -19
  94. mindspore/mint/nn/layer/__init__.py +39 -0
  95. mindspore/mint/nn/layer/activation.py +133 -0
  96. mindspore/mint/nn/layer/normalization.py +477 -0
  97. mindspore/mint/nn/layer/pooling.py +110 -0
  98. mindspore/mint/optim/adamw.py +26 -13
  99. mindspore/mint/special/__init__.py +63 -0
  100. mindspore/multiprocessing/__init__.py +2 -1
  101. mindspore/nn/__init__.py +0 -1
  102. mindspore/nn/cell.py +276 -96
  103. mindspore/nn/layer/activation.py +211 -44
  104. mindspore/nn/layer/basic.py +137 -10
  105. mindspore/nn/layer/embedding.py +137 -2
  106. mindspore/nn/layer/normalization.py +101 -5
  107. mindspore/nn/layer/padding.py +34 -48
  108. mindspore/nn/layer/pooling.py +161 -7
  109. mindspore/nn/layer/transformer.py +3 -3
  110. mindspore/nn/loss/__init__.py +2 -2
  111. mindspore/nn/loss/loss.py +84 -6
  112. mindspore/nn/optim/__init__.py +2 -1
  113. mindspore/nn/optim/adadelta.py +1 -1
  114. mindspore/nn/optim/adam.py +1 -1
  115. mindspore/nn/optim/lamb.py +1 -1
  116. mindspore/nn/optim/tft_wrapper.py +124 -0
  117. mindspore/nn/wrap/cell_wrapper.py +12 -23
  118. mindspore/nn/wrap/grad_reducer.py +5 -5
  119. mindspore/nn/wrap/loss_scale.py +17 -3
  120. mindspore/numpy/__init__.py +1 -1
  121. mindspore/numpy/array_creations.py +65 -68
  122. mindspore/numpy/array_ops.py +64 -60
  123. mindspore/numpy/fft.py +610 -75
  124. mindspore/numpy/logic_ops.py +11 -10
  125. mindspore/numpy/math_ops.py +85 -84
  126. mindspore/numpy/utils_const.py +4 -4
  127. mindspore/opencv_core452.dll +0 -0
  128. mindspore/opencv_imgcodecs452.dll +0 -0
  129. mindspore/opencv_imgproc452.dll +0 -0
  130. mindspore/ops/__init__.py +6 -4
  131. mindspore/ops/_grad_experimental/grad_array_ops.py +0 -11
  132. mindspore/ops/_grad_experimental/grad_comm_ops.py +67 -4
  133. mindspore/ops/_grad_experimental/grad_math_ops.py +0 -22
  134. mindspore/ops/_vmap/vmap_array_ops.py +2 -4
  135. mindspore/ops/_vmap/vmap_math_ops.py +17 -1
  136. mindspore/ops/_vmap/vmap_nn_ops.py +43 -2
  137. mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +91 -7
  138. mindspore/ops/auto_generate/gen_arg_dtype_cast.py +2 -0
  139. mindspore/ops/auto_generate/gen_extend_func.py +767 -13
  140. mindspore/ops/auto_generate/gen_ops_def.py +2452 -364
  141. mindspore/ops/auto_generate/gen_ops_prim.py +5442 -1756
  142. mindspore/ops/auto_generate/pyboost_inner_prim.py +176 -56
  143. mindspore/ops/composite/base.py +85 -48
  144. mindspore/ops/composite/multitype_ops/_compile_utils.py +1 -0
  145. mindspore/ops/composite/multitype_ops/not_in_impl.py +2 -2
  146. mindspore/ops/function/__init__.py +22 -0
  147. mindspore/ops/function/array_func.py +492 -153
  148. mindspore/ops/function/debug_func.py +113 -1
  149. mindspore/ops/function/fft_func.py +15 -2
  150. mindspore/ops/function/grad/grad_func.py +3 -2
  151. mindspore/ops/function/math_func.py +564 -207
  152. mindspore/ops/function/nn_func.py +817 -383
  153. mindspore/ops/function/other_func.py +3 -2
  154. mindspore/ops/function/random_func.py +402 -12
  155. mindspore/ops/function/reshard_func.py +13 -11
  156. mindspore/ops/function/sparse_unary_func.py +1 -1
  157. mindspore/ops/function/vmap_func.py +3 -2
  158. mindspore/ops/functional.py +24 -14
  159. mindspore/ops/op_info_register.py +3 -3
  160. mindspore/ops/operations/__init__.py +7 -2
  161. mindspore/ops/operations/_grad_ops.py +2 -76
  162. mindspore/ops/operations/_infer_ops.py +1 -1
  163. mindspore/ops/operations/_inner_ops.py +71 -94
  164. mindspore/ops/operations/array_ops.py +14 -146
  165. mindspore/ops/operations/comm_ops.py +63 -53
  166. mindspore/ops/operations/custom_ops.py +83 -19
  167. mindspore/ops/operations/debug_ops.py +42 -10
  168. mindspore/ops/operations/manually_defined/_inner.py +12 -0
  169. mindspore/ops/operations/manually_defined/ops_def.py +273 -20
  170. mindspore/ops/operations/math_ops.py +12 -223
  171. mindspore/ops/operations/nn_ops.py +20 -114
  172. mindspore/ops/operations/other_ops.py +7 -4
  173. mindspore/ops/operations/random_ops.py +46 -1
  174. mindspore/ops/primitive.py +18 -6
  175. mindspore/ops_generate/arg_dtype_cast.py +2 -0
  176. mindspore/ops_generate/gen_aclnn_implement.py +11 -11
  177. mindspore/ops_generate/gen_constants.py +36 -0
  178. mindspore/ops_generate/gen_ops.py +67 -52
  179. mindspore/ops_generate/gen_ops_inner_prim.py +1 -1
  180. mindspore/ops_generate/gen_pyboost_func.py +131 -47
  181. mindspore/ops_generate/op_proto.py +10 -3
  182. mindspore/ops_generate/pyboost_utils.py +14 -1
  183. mindspore/ops_generate/template.py +43 -21
  184. mindspore/parallel/__init__.py +3 -1
  185. mindspore/parallel/_auto_parallel_context.py +31 -9
  186. mindspore/parallel/_cell_wrapper.py +85 -0
  187. mindspore/parallel/_parallel_serialization.py +47 -19
  188. mindspore/parallel/_tensor.py +127 -13
  189. mindspore/parallel/_utils.py +53 -22
  190. mindspore/parallel/algo_parameter_config.py +5 -5
  191. mindspore/parallel/checkpoint_transform.py +46 -39
  192. mindspore/parallel/cluster/process_entity/__init__.py +1 -1
  193. mindspore/parallel/cluster/process_entity/_api.py +31 -23
  194. mindspore/parallel/cluster/process_entity/_utils.py +2 -27
  195. mindspore/parallel/parameter_broadcast.py +3 -4
  196. mindspore/parallel/shard.py +162 -31
  197. mindspore/parallel/transform_safetensors.py +1146 -0
  198. mindspore/profiler/__init__.py +2 -1
  199. mindspore/profiler/common/constant.py +29 -0
  200. mindspore/profiler/common/registry.py +47 -0
  201. mindspore/profiler/common/util.py +28 -0
  202. mindspore/profiler/dynamic_profiler.py +694 -0
  203. mindspore/profiler/envprofiling.py +17 -19
  204. mindspore/profiler/parser/ascend_analysis/constant.py +18 -0
  205. mindspore/profiler/parser/ascend_analysis/file_manager.py +25 -4
  206. mindspore/profiler/parser/ascend_analysis/function_event.py +43 -19
  207. mindspore/profiler/parser/ascend_analysis/fwk_cann_parser.py +31 -26
  208. mindspore/profiler/parser/ascend_analysis/fwk_file_parser.py +56 -10
  209. mindspore/profiler/parser/ascend_analysis/msprof_timeline_parser.py +55 -8
  210. mindspore/profiler/parser/ascend_analysis/path_manager.py +313 -0
  211. mindspore/profiler/parser/ascend_analysis/profiler_info_parser.py +27 -20
  212. mindspore/profiler/parser/ascend_analysis/trace_event_manager.py +9 -2
  213. mindspore/profiler/parser/ascend_msprof_exporter.py +5 -4
  214. mindspore/profiler/parser/ascend_timeline_generator.py +27 -25
  215. mindspore/profiler/parser/base_timeline_generator.py +19 -25
  216. mindspore/profiler/parser/cpu_gpu_timeline_generator.py +25 -12
  217. mindspore/profiler/parser/framework_parser.py +1 -391
  218. mindspore/profiler/parser/gpu_analysis/__init__.py +14 -0
  219. mindspore/profiler/parser/gpu_analysis/function_event.py +44 -0
  220. mindspore/profiler/parser/gpu_analysis/fwk_file_parser.py +89 -0
  221. mindspore/profiler/parser/gpu_analysis/profiler_info_parser.py +72 -0
  222. mindspore/profiler/parser/memory_usage_parser.py +0 -154
  223. mindspore/profiler/parser/profiler_info.py +78 -6
  224. mindspore/profiler/profiler.py +153 -0
  225. mindspore/profiler/profiling.py +285 -413
  226. mindspore/rewrite/__init__.py +1 -2
  227. mindspore/rewrite/common/namespace.py +4 -4
  228. mindspore/rewrite/symbol_tree/symbol_tree.py +3 -3
  229. mindspore/run_check/_check_version.py +39 -104
  230. mindspore/safeguard/rewrite_obfuscation.py +591 -247
  231. mindspore/swresample-4.dll +0 -0
  232. mindspore/swscale-6.dll +0 -0
  233. mindspore/tinyxml2.dll +0 -0
  234. mindspore/train/__init__.py +4 -3
  235. mindspore/train/_utils.py +105 -19
  236. mindspore/train/amp.py +171 -53
  237. mindspore/train/callback/__init__.py +2 -2
  238. mindspore/train/callback/_callback.py +4 -4
  239. mindspore/train/callback/_checkpoint.py +97 -31
  240. mindspore/train/callback/_cluster_monitor.py +1 -1
  241. mindspore/train/callback/_flops_collector.py +1 -0
  242. mindspore/train/callback/_loss_monitor.py +3 -3
  243. mindspore/train/callback/_on_request_exit.py +145 -31
  244. mindspore/train/callback/_summary_collector.py +5 -5
  245. mindspore/train/callback/_tft_register.py +375 -0
  246. mindspore/train/dataset_helper.py +15 -3
  247. mindspore/train/metrics/metric.py +3 -3
  248. mindspore/train/metrics/roc.py +4 -4
  249. mindspore/train/mind_ir_pb2.py +44 -39
  250. mindspore/train/model.py +154 -58
  251. mindspore/train/serialization.py +342 -128
  252. mindspore/turbojpeg.dll +0 -0
  253. mindspore/utils/__init__.py +21 -0
  254. mindspore/utils/utils.py +60 -0
  255. mindspore/version.py +1 -1
  256. {mindspore-2.3.0.dist-info → mindspore-2.4.1.dist-info}/METADATA +13 -7
  257. {mindspore-2.3.0.dist-info → mindspore-2.4.1.dist-info}/RECORD +260 -254
  258. {mindspore-2.3.0.dist-info → mindspore-2.4.1.dist-info}/WHEEL +1 -1
  259. mindspore/include/c_api/ms/abstract.h +0 -67
  260. mindspore/include/c_api/ms/attribute.h +0 -197
  261. mindspore/include/c_api/ms/base/handle_types.h +0 -43
  262. mindspore/include/c_api/ms/base/macros.h +0 -32
  263. mindspore/include/c_api/ms/base/status.h +0 -33
  264. mindspore/include/c_api/ms/base/types.h +0 -283
  265. mindspore/include/c_api/ms/context.h +0 -102
  266. mindspore/include/c_api/ms/graph.h +0 -160
  267. mindspore/include/c_api/ms/node.h +0 -606
  268. mindspore/include/c_api/ms/tensor.h +0 -161
  269. mindspore/include/c_api/ms/value.h +0 -84
  270. mindspore/mindspore_shared_lib.dll +0 -0
  271. mindspore/nn/extend/basic.py +0 -140
  272. mindspore/nn/extend/embedding.py +0 -143
  273. mindspore/nn/extend/layer/normalization.py +0 -109
  274. mindspore/nn/extend/pooling.py +0 -117
  275. mindspore/nn/layer/embedding_service.py +0 -531
  276. mindspore/ops/_op_impl/aicpu/strided_slice_v2.py +0 -93
  277. mindspore/ops/_op_impl/aicpu/strided_slice_v2_grad.py +0 -66
  278. mindspore/ops/extend/__init__.py +0 -53
  279. mindspore/ops/extend/array_func.py +0 -218
  280. mindspore/ops/extend/math_func.py +0 -76
  281. mindspore/ops/extend/nn_func.py +0 -308
  282. mindspore/ops/silent_check.py +0 -162
  283. mindspore/profiler/parser/msadvisor_analyzer.py +0 -82
  284. mindspore/profiler/parser/msadvisor_parser.py +0 -240
  285. mindspore/train/callback/_mindio_ttp.py +0 -443
  286. {mindspore-2.3.0.dist-info → mindspore-2.4.1.dist-info}/entry_points.txt +0 -0
  287. {mindspore-2.3.0.dist-info → mindspore-2.4.1.dist-info}/top_level.txt +0 -0
@@ -467,9 +467,9 @@ def isclose(a, b, rtol=1e-05, atol=1e-08, equal_nan=False):
467
467
  Args:
468
468
  a (Union[Tensor, list, tuple]): Input first tensor to compare.
469
469
  b (Union[Tensor, list, tuple]): Input second tensor to compare.
470
- rtol (numbers.Number): The relative tolerance parameter (see Note).
471
- atol (numbers.Number): The absolute tolerance parameter (see Note).
472
- equal_nan (bool): Whether to compare ``NaN`` as equal. If True, ``NaN`` in
470
+ rtol (numbers.Number, optional): The relative tolerance parameter (see Note). Default: ``1e-05`` .
471
+ atol (numbers.Number, optional): The absolute tolerance parameter (see Note). Default: ``1e-08`` .
472
+ equal_nan (bool, optional): Whether to compare ``NaN`` as equal. If True, ``NaN`` in
473
473
  `a` will be considered equal to ``NaN`` in `b` in the output tensor.
474
474
  Default: ``False`` .
475
475
 
@@ -635,7 +635,7 @@ def logical_or(x1, x2, dtype=None):
635
635
  output Tensor.
636
636
 
637
637
  Returns:
638
- Tensor or scalar, element-wise comparison of `x1` and `x2`. Typically of type
638
+ Tensor or scalar, logical OR operation of `x1` and `x2`. Typically of type
639
639
  bool, unless ``dtype=object`` is passed. This is a scalar if both `x1` and `x2` are
640
640
  scalars.
641
641
 
@@ -704,7 +704,7 @@ def logical_xor(x1, x2, dtype=None):
704
704
 
705
705
  Returns:
706
706
  Tensor or scalar.
707
- Boolean result of the logical AND operation applied to the elements of `x1` and `x2`;
707
+ Boolean result of the logical XOR operation applied to the elements of `x1` and `x2`;
708
708
  the shape is determined by broadcasting. This is a scalar if both `x1` and `x2` are scalars.
709
709
 
710
710
  Supported Platforms:
@@ -733,12 +733,12 @@ def array_equal(a1, a2, equal_nan=False):
733
733
  In mindspore, a bool tensor is returned instead, since in Graph mode, the
734
734
  value cannot be traced and computed at compile time.
735
735
 
736
- Since on Ascend, :class:`nan` is treated differently, currently the argument
737
- `equal_nan` is not supported on Ascend.
736
+ Since on Ascend, ``nan`` is treated differently, currently the argument
737
+ ``equal_nan`` is not supported on Ascend.
738
738
 
739
739
  Args:
740
740
  a1/a2 (Union[int, float, bool, list, tuple, Tensor]): Input arrays.
741
- equal_nan (bool): Whether to compare NaN's as equal. Default: ``False`` .
741
+ equal_nan (bool, optional): Whether to compare NaN's as equal. Default: ``False`` .
742
742
 
743
743
  Returns:
744
744
  Scalar bool tensor, value is `True` if inputs are equal, `False` otherwise.
@@ -869,7 +869,7 @@ def sometrue(a, axis=None, keepdims=False):
869
869
 
870
870
  Raises:
871
871
  TypeError: If input is not array_like or `axis` is not int or tuple of integers or
872
- `keepdims` is not integer or `initial` is not scalar.
872
+ `keepdims` is not bool.
873
873
  ValueError: If any axis is out of range or duplicate axes exist.
874
874
 
875
875
  Supported Platforms:
@@ -900,7 +900,8 @@ def setdiff1d(ar1, ar2, assume_unique=False):
900
900
  Args:
901
901
  ar1 (Union[int, float, bool, list, tuple, Tensor]): Input tensor.
902
902
  ar2 (Union[int, float, bool, list, tuple, Tensor]): Input tensor.
903
- assume_unique (bool): If `True`, the input Tensors are assumed to be unique, which can speed up the calculation.
903
+ assume_unique (bool, optional): If `True`, the input Tensors are assumed to be unique,
904
+ which can speed up the calculation.
904
905
  If `True` but `ar1` or `ar2` are not unique,
905
906
  incorrect results and out-of-bounds indices could result.
906
907
  Default: ``False``.
@@ -79,7 +79,7 @@ def absolute(x, dtype=None):
79
79
  Numpy arguments `out`, `where`, `casting`, `order`, `subok`, `signature`, and `extobj` are
80
80
  not supported.
81
81
  Currently the backend kernel only supports float calculation, if the input
82
- is not a `float`, then it will be casted to :class:`mstype.float32` and casted back.
82
+ is not a `float`, then it will be casted to ``mstype.float32`` and casted back.
83
83
 
84
84
  Args:
85
85
  x (Tensor): Tensor to be used for calculation.
@@ -604,14 +604,14 @@ def mean(a, axis=None, keepdims=False, dtype=None):
604
604
  Args:
605
605
  a (Tensor): input tensor containing numbers whose mean is desired.
606
606
  If a is not an array, a conversion is attempted.
607
- axis (None or int or tuple of integers, optional): Axis or axes along
607
+ axis (Union[int, tuple(int), None], optional): Axis or axes along
608
608
  which the means are computed. The default is to compute
609
609
  the mean of the flattened array. If this is a tuple of
610
- ints, a mean is performed over multiple axes.
610
+ ints, a mean is performed over multiple axes. Default: ``None`` .
611
611
  keepdims (bool, optional): If this is set to ``True`` , the axes which
612
612
  are reduced are left in the result as dimensions with
613
613
  size one. With this option, the result will broadcast
614
- correctly against the input tensor.
614
+ correctly against the input tensor. Default: ``False`` .
615
615
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
616
616
  output Tensor.
617
617
 
@@ -902,7 +902,7 @@ def std(x, axis=None, ddof=0, keepdims=False):
902
902
 
903
903
  If ``None`` , compute the standard deviation of the flattened array.
904
904
  ddof (int): Means Delta Degrees of Freedom. The divisor used in calculations is :math:`N - ddof`,
905
- where :math:`N` represents the number of elements. Default: 0.
905
+ where :math:`N` represents the number of elements. Default: ``0``.
906
906
  keepdims: If this is set to True, the axes which are reduced are left in the result as
907
907
  dimensions with size one. With this option, the result will broadcast correctly against the input tensor.
908
908
  If the default value is passed, then keepdims will not be passed through to the std method of
@@ -1011,14 +1011,14 @@ def average(x, axis=None, weights=None, returned=False):
1011
1011
 
1012
1012
  Args:
1013
1013
  x (Tensor): A Tensor to be averaged.
1014
- axis (Union[None, int, tuple(int)]): Axis along which to average `x`. Default: ``None`` .
1014
+ axis (Union[None, int, tuple(int)], optional): Axis along which to average `x`. Default: ``None`` .
1015
1015
  If the axis is `None`, it will average over all of the elements of the tensor `x`.
1016
1016
  If the axis is negative, it counts from the last to the first axis.
1017
- weights (Union[None, Tensor]): Weights associated with the values in `x`. Default: ``None`` .
1017
+ weights (Union[None, Tensor], optional): Weights associated with the values in `x`. Default: ``None`` .
1018
1018
  If `weights` is `None`, all the data in `x` are assumed to have a weight equal to one.
1019
1019
  If `weights` is 1-D tensor, the length must be the same as the given axis.
1020
1020
  Otherwise, `weights` should have the same shape as `x`.
1021
- returned (bool): Default: ``False`` .
1021
+ returned (bool, optional): Default: ``False`` .
1022
1022
  If `True`, the tuple (average, sum_of_weights) is returned.
1023
1023
  If `False`, only the average is returned.
1024
1024
 
@@ -1154,7 +1154,7 @@ def square(x, dtype=None):
1154
1154
 
1155
1155
  Returns:
1156
1156
  Tensor or scalar, element-wise ``x*x``, of the same shape and dtype as `x`.
1157
- This is a scalar if `x` is a scalar..
1157
+ This is a scalar if `x` is a scalar.
1158
1158
 
1159
1159
  Supported Platforms:
1160
1160
  ``Ascend`` ``GPU`` ``CPU``
@@ -1402,7 +1402,7 @@ def amax(a, axis=None, keepdims=False, initial=None, where=True):
1402
1402
 
1403
1403
  Args:
1404
1404
  a (Tensor): Input data.
1405
- axis (None or int or tuple of integers, optional): Default: ``None`` . Axis or
1405
+ axis (Union[int, tuple(int), None], optional): Default: ``None`` . Axis or
1406
1406
  axes along which to operate. By default, flattened input is used. If
1407
1407
  this is a tuple of integers, the maximum is selected over multiple axes,
1408
1408
  instead of a single axis or all the axes as before.
@@ -1458,7 +1458,7 @@ def amin(a, axis=None, keepdims=False, initial=None, where=True):
1458
1458
 
1459
1459
  Args:
1460
1460
  a (Tensor): Input data.
1461
- axis (None or int or tuple of integers, optional): Default: ``None`` . Axis or
1461
+ axis (Union[int, tuple(int), None], optional): Default: ``None`` . Axis or
1462
1462
  axes along which to operate. By default, flattened input is used. If
1463
1463
  this is a tuple of integers, the minimum is selected over multiple axes,
1464
1464
  instead of a single axis or all the axes as before.
@@ -1992,10 +1992,10 @@ def ediff1d(ary, to_end=None, to_begin=None):
1992
1992
 
1993
1993
  Args:
1994
1994
  ary (Tensor): If necessary, will be flattened before the differences are taken.
1995
- to_end (Tensor or scalar, optional): Number(s) to append at the end of the
1996
- returned differences.
1997
- to_begin (Tensor or scalar, optional): Number(s) to prepend at the beginning
1998
- of the returned differences.
1995
+ to_end (Tensor, scalar, optional): Number(s) to append at the end of the
1996
+ returned differences. Default: ``None`` .
1997
+ to_begin (Tensor, scalar, optional): Number(s) to prepend at the beginning
1998
+ of the returned differences. Default: ``None`` .
1999
1999
 
2000
2000
  Returns:
2001
2001
  The differences.
@@ -2432,7 +2432,7 @@ def _shape_reduced(shape, axes):
2432
2432
  """Removes dimensions corresponding to argument axes"""
2433
2433
  ndim_orig = F.tuple_len(shape)
2434
2434
  ndim_out = ndim_orig - F.tuple_len(axes)
2435
- shape_out = [0]*ndim_out
2435
+ shape_out = [0] * ndim_out
2436
2436
  idx_out = 0
2437
2437
  for i in range(ndim_orig):
2438
2438
  if i not in axes:
@@ -2499,8 +2499,8 @@ def nanmax(a, axis=None, dtype=None, keepdims=False):
2499
2499
  Args:
2500
2500
  a (Union[int, float, list, tuple, Tensor]): Array containing numbers whose maximum
2501
2501
  is desired. If `a` is not an array, a conversion is attempted.
2502
- axis (Union[int, tuple of int, None], optional): Axis or axes along which the maximum is
2503
- computed. The default is to compute the maximum of the flattened array.
2502
+ axis (Union[int, tuple(int), None], optional): Axis or axes along which the maximum is
2503
+ computed. The default is to compute the maximum of the flattened array. Default: ``None`` .
2504
2504
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2505
2505
  output Tensor.
2506
2506
  keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
@@ -2531,7 +2531,7 @@ def nanmax(a, axis=None, dtype=None, keepdims=False):
2531
2531
  if not isinstance(keepdims, int):
2532
2532
  _raise_type_error("integer argument expected, got", keepdims)
2533
2533
  nan_mask = _isnan(a)
2534
- a = F.select(nan_mask, full(F.shape(a), -sys.maxsize - 1, F.dtype(a)), a)
2534
+ a = F.select(nan_mask, P.FillV2()(F.shape(a), Tensor(-sys.maxsize - 1, F.dtype(a))), a)
2535
2535
  reduce_fn = _reduce_max_keepdims if keepdims else _reduce_max_default
2536
2536
  return _reduce(a, reduce_fn, axis=axis, keepdims=keepdims, dtype=dtype)
2537
2537
 
@@ -2549,8 +2549,8 @@ def nanmin(a, axis=None, dtype=None, keepdims=False):
2549
2549
  Args:
2550
2550
  a (Union[int, float, list, tuple, Tensor]): Array containing numbers whose minimum
2551
2551
  is desired. If `a` is not an array, a conversion is attempted.
2552
- axis (Union[int, tuple of int, None], optional): Axis or axes along which the minimum is
2553
- computed. The default is to compute the minimum of the flattened array.
2552
+ axis (Union[int, tuple(int), None], optional): Axis or axes along which the minimum is
2553
+ computed. The default is to compute the minimum of the flattened array. Default: ``None`` .
2554
2554
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2555
2555
  output Tensor.
2556
2556
  keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
@@ -2581,7 +2581,7 @@ def nanmin(a, axis=None, dtype=None, keepdims=False):
2581
2581
  if not isinstance(keepdims, int):
2582
2582
  _raise_type_error("integer argument expected, got", keepdims)
2583
2583
  nan_mask = _isnan(a)
2584
- a = F.select(nan_mask, full(F.shape(a), sys.maxsize, F.dtype(a)), a)
2584
+ a = F.select(nan_mask, P.FillV2()(F.shape(a), Tensor(sys.maxsize, F.dtype(a))), a)
2585
2585
  reduce_fn = _reduce_min_keepdims if keepdims else _reduce_min_default
2586
2586
  return _reduce(a, reduce_fn, axis=axis, keepdims=keepdims, dtype=dtype)
2587
2587
 
@@ -2605,7 +2605,7 @@ def nansum(a, axis=None, dtype=None, keepdims=False):
2605
2605
  a (Union[int, float, list, tuple, Tensor]): Array containing numbers
2606
2606
  whose sum is desired. If `a` is not an array, a conversion is attempted.
2607
2607
  axis (Union[int, tuple of int, None], optional): Axis or axes along which the sum is
2608
- computed. The default is to compute the sum of the flattened array.
2608
+ computed. The default is to compute the sum of the flattened array. Default: ``None`` .
2609
2609
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2610
2610
  output Tensor.
2611
2611
  keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
@@ -2662,7 +2662,7 @@ def nanmean(a, axis=None, dtype=None, keepdims=False):
2662
2662
  a (Union[int, float, list, tuple, Tensor]): Array containing numbers
2663
2663
  whose mean is desired. If `a` is not an array, a conversion is attempted.
2664
2664
  axis (Union[int, tuple of int, None], optional): Axis or axes along which the mean is
2665
- computed. The default is to compute the mean of the flattened array.
2665
+ computed. The default is to compute the mean of the flattened array. Default: ``None`` .
2666
2666
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2667
2667
  output Tensor.
2668
2668
  keepdims (boolean, optional): Default: ``False`` . If this is set to True, the axes which
@@ -2724,7 +2724,7 @@ def nanvar(a, axis=None, dtype=None, ddof=0, keepdims=False):
2724
2724
  a (Union[int, float, list, tuple, Tensor]): Array containing numbers
2725
2725
  whose variance is desired. If `a` is not an array, a conversion is attempted.
2726
2726
  axis (Union[int, tuple of int, None], optional): Axis or axes along which the variance is
2727
- computed. The default is to compute the variance of the flattened array.
2727
+ computed. The default is to compute the variance of the flattened array. Default: ``None`` .
2728
2728
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2729
2729
  output Tensor.
2730
2730
  ddof (int, optional): "Delta Degrees of Freedom": the divisor used in the calculation is
@@ -2779,7 +2779,7 @@ def nanstd(a, axis=None, dtype=None, ddof=0, keepdims=False):
2779
2779
  a (Union[int, float, list, tuple, Tensor]): Calculates the standard deviation of the non-NaN values.
2780
2780
  axis (Union[int, tuple of int, None], optional): Axis or axes along which the standard
2781
2781
  deviation is computed. The default is to compute the standard deviation of the
2782
- flattened array.
2782
+ flattened array. Default: ``None`` .
2783
2783
  dtype (:class:`mindspore.dtype`, optional): Default: ``None`` . Overrides the dtype of the
2784
2784
  output Tensor.
2785
2785
  ddof (int, optional): "Delta Degrees of Freedom": the divisor used in the calculation is
@@ -2894,9 +2894,9 @@ def kron(a, b):
2894
2894
 
2895
2895
  # scales a by the shape of b
2896
2896
  kron_shape = _seq_prod(shape_a, shape_b)
2897
- a = F.reshape(a, _add_unit_axes(shape_a, 2*ndim, True))
2898
- a = F.tile(a, _add_unit_axes(shape_b, 2*ndim, False))
2899
- a = moveaxis(a, F.make_range(ndim, 2*ndim), F.make_range(1, 2*ndim, 2))
2897
+ a = F.reshape(a, _add_unit_axes(shape_a, 2 * ndim, True))
2898
+ a = F.tile(a, _add_unit_axes(shape_b, 2 * ndim, False))
2899
+ a = moveaxis(a, F.make_range(ndim, 2 * ndim), F.make_range(1, 2 * ndim, 2))
2900
2900
  a = F.reshape(a, kron_shape)
2901
2901
  # scales b by the shape of a
2902
2902
  b = F.tile(b, shape_a)
@@ -3118,8 +3118,8 @@ def cumsum(a, axis=None, dtype=None):
3118
3118
  Returns the cumulative sum of the elements along a given axis.
3119
3119
 
3120
3120
  Note:
3121
- If ``a.dtype`` is :class:`int8`, :class:`int16` or :class:`bool`, the result
3122
- `dtype` will be elevated to :class:`int32`.
3121
+ If ``a.dtype`` is `int8`, `int16` or `bool`, the result
3122
+ `dtype` will be elevated to `int32`.
3123
3123
 
3124
3124
  Args:
3125
3125
  a (Tensor): Input tensor.
@@ -3161,8 +3161,8 @@ def nancumsum(a, axis=None, dtype=None):
3161
3161
  Zeros are returned for slices that are all-NaN or empty.
3162
3162
 
3163
3163
  Note:
3164
- If ``a.dtype`` is :class:`int8`, :class:`int16` or :class:`bool`, the result
3165
- `dtype` will be elevated to :class:`int32`.
3164
+ If ``a.dtype`` is `int8`, `int16` or `bool`, the result
3165
+ `dtype` will be elevated to `int32`.
3166
3166
 
3167
3167
  Args:
3168
3168
  a (Tensor): Input tensor.
@@ -3171,7 +3171,7 @@ def nancumsum(a, axis=None, dtype=None):
3171
3171
  dtype (:class:`mindspore.dtype`, optional): If not specified, stay the same as `a`,
3172
3172
  unless `a` has an integer dtype with a precision less than that of the
3173
3173
  default platform integer. In that case, the default platform integer
3174
- is used.
3174
+ is used. Default: ``None`` .
3175
3175
 
3176
3176
  Returns:
3177
3177
  Tensor.
@@ -3231,7 +3231,7 @@ def cbrt(x, dtype=None):
3231
3231
  def _cbrt(x):
3232
3232
  compute_type = promote_types(x.dtype, "float32")
3233
3233
  x = x.astype(compute_type)
3234
- # TODO: use P.Sign() once gpu support is added
3234
+ # use P.Sign() once gpu support is added
3235
3235
  abs_x = F.absolute(x)
3236
3236
  sign_x = abs_x / x
3237
3237
  return sign_x * F.tensor_pow(abs_x, 1. / 3.)
@@ -3497,7 +3497,7 @@ def tan(x, dtype=None):
3497
3497
  Tensor or scalar. This is a scalar if `x` is a scalar.
3498
3498
 
3499
3499
  Raises:
3500
- TypeError: If the input is not a tensor or is :class:`tensor.dtype` is :class:`mindspore.float64`.
3500
+ TypeError: If the input is not a tensor or the dtype of tensor is mindspore.float64.
3501
3501
 
3502
3502
  Supported Platforms:
3503
3503
  ``Ascend`` ``CPU``
@@ -3932,11 +3932,11 @@ def _gradient_along_axis(f, h, axis):
3932
3932
  """compute the gradients of `f` along a given axis, a helper function of gradient."""
3933
3933
  end = f.shape[axis]
3934
3934
  upper_edge = _slice_along_axis(f, axis, 1, 2) - _slice_along_axis(f, axis, 0, 1)
3935
- lower_edge = _slice_along_axis(f, axis, end-1, end) - _slice_along_axis(f, axis, end-2, end-1)
3935
+ lower_edge = _slice_along_axis(f, axis, end - 1, end) - _slice_along_axis(f, axis, end - 2, end - 1)
3936
3936
  if end <= 2:
3937
3937
  a_grad = concatenate((upper_edge, lower_edge), axis)
3938
3938
  else:
3939
- middle = (_slice_along_axis(f, axis, 2, end) - _slice_along_axis(f, axis, 0, end-2)) * 0.5
3939
+ middle = (_slice_along_axis(f, axis, 2, end) - _slice_along_axis(f, axis, 0, end - 2)) * 0.5
3940
3940
  a_grad = concatenate((upper_edge, middle, lower_edge), axis)
3941
3941
  return a_grad / h
3942
3942
 
@@ -3978,10 +3978,10 @@ def gradient(f, *varargs, axis=None, edge_order=1):
3978
3978
  1. single scalar to specify a sample distance for all dimensions.
3979
3979
  2. N scalars to specify a constant sample distance for each dimension.
3980
3980
  axis (Union[None, int, tuple(int), list(int)], optional): Gradient is calculated
3981
- only along the given axis or axes. The default :class:`(axis = None)` is to calculate
3981
+ only along the given axis or axes. The default ``(axis = None)`` is to calculate
3982
3982
  the gradient for all the axes of the input tensor. `axis` may be negative,
3983
3983
  in which case it counts from the last to the first `axis`.
3984
- edge_order (int): Gradient is calculated using N-th order accurate differences
3984
+ edge_order (int, optional): Gradient is calculated using N-th order accurate differences
3985
3985
  at the boundaries. Default: ``1`` .
3986
3986
 
3987
3987
  Returns:
@@ -4050,21 +4050,22 @@ def sum_(a, axis=None, dtype=None, keepdims=False, initial=None):
4050
4050
  `extobj` are not supported.
4051
4051
 
4052
4052
  Args:
4053
- x (Union[int, float, bool, list, tuple, Tensor]): Elements to sum.
4054
- axis (Union[None, int, tuple(int)]): Axis or axes along which a sum is performed. Default: `None`.
4053
+ a (Union[int, float, bool, list, tuple, Tensor]): Elements to sum.
4054
+ axis (Union[None, int, tuple(int)], optional): Axis or axes along which a sum is performed. Default: ``None``.
4055
4055
  If `None`, sum all of the elements of the input array.
4056
4056
  If axis is negative it counts from the last to the first axis.
4057
4057
  If axis is a tuple of integers, a sum is performed on all of the axes specified in the tuple
4058
4058
  instead of a single axis or all the axes as before.
4059
4059
  dtype (:class:`mindspore.dtype`, optional): Defaults to `None`. Overrides the dtype of the
4060
4060
  output Tensor.
4061
- keepdims (bool): If this is set to True, the axes which are reduced are left in the result as
4061
+ keepdims (bool, optional): If this is set to True, the axes which are reduced are left in the result as
4062
4062
  dimensions with size one. With this option, the result will broadcast correctly against the input array.
4063
4063
  If the default value is passed, then keepdims will not be passed through to the sum method of
4064
4064
  sub-classes of ndarray, however any non-default value will be. If the sub-class method does not
4065
- implement keepdims any exceptions will be raised. Default: `False`.
4066
- initial (scalar): Starting value for the sum, if `None`, which refers to the first element of the reduction.
4067
- Default: `None`.
4065
+ implement keepdims any exceptions will be raised. Default: ``False``.
4066
+ initial (scalar, optional): Starting value for the sum, if `None`,
4067
+ which refers to the first element of the reduction.
4068
+ Default: ``None``.
4068
4069
 
4069
4070
  Returns:
4070
4071
  Tensor. An array with the same shape as a, with the specified axis removed.
@@ -4099,8 +4100,8 @@ def _min_cost_chain_matmul(dims):
4099
4100
  """
4100
4101
  dims = tuple(dims)
4101
4102
  n = len(dims) - 1
4102
- m = [[0]*n for _ in range(n)]
4103
- s = [[0]*n for _ in range(n)]
4103
+ m = [[0] * n for _ in range(n)]
4104
+ s = [[0] * n for _ in range(n)]
4104
4105
  for pos in range(1, n):
4105
4106
  for i in range(n - pos):
4106
4107
  j = i + pos
@@ -4309,12 +4310,12 @@ def searchsorted(a, v, side='left', sorter=None):
4309
4310
  None, then it must be sorted in ascending order, otherwise `sorter` must be
4310
4311
  an array of indices that sort it.
4311
4312
  v (Union[int, float, bool, list, tuple, Tensor]): Values to insert into `a`.
4312
- side ('left', 'right', optional): If ``'left'`` , the index of the first suitable
4313
+ side ('left', 'right', optional): If ``'left'`` (default value), the index of the first suitable
4313
4314
  location found is given. If ``'right'`` , return the last such index. If there is
4314
4315
  no suitable index, return either 0 or N (where N is the length of `a`).
4315
4316
  sorter (Union[int, float, bool, list, tuple, Tensor]): 1-D optional array of
4316
4317
  integer indices that sort array `a` into ascending order. They are typically
4317
- the result of argsort.
4318
+ the result of argsort. Default: ``None`` .
4318
4319
 
4319
4320
  Returns:
4320
4321
  Tensor, array of insertion points with the same shape as `v`.
@@ -4378,9 +4379,9 @@ def interp(x, xp, fp, left=None, right=None):
4378
4379
  fp (Union[int, float, bool, list, tuple, Tensor]): 1-D sequence of floats, the
4379
4380
  y-coordinates of the data points, same length as `xp`.
4380
4381
  left (float, optional): Value to return for ``x < xp[0]``, default is ``fp[0]``
4381
- once obtained.
4382
+ once obtained. Default: ``None`` .
4382
4383
  right (float, optional): Value to return for ``x > xp[-1]``, default is ``fp[-1]``
4383
- once obtained.
4384
+ once obtained. Default: ``None`` .
4384
4385
 
4385
4386
  Returns:
4386
4387
  Tensor, the interpolated values, same shape as `x`.
@@ -4421,7 +4422,7 @@ def interp(x, xp, fp, left=None, right=None):
4421
4422
  x_1 = F.gather_nd(xp, indices_1)
4422
4423
  y_0 = F.gather_nd(fp, indices_0)
4423
4424
  y_1 = F.gather_nd(fp, indices_1)
4424
- res = (y_0*(x_1 - x) + y_1*(x - x_0))/(x_1 - x_0)
4425
+ res = (y_0 * (x_1 - x) + y_1 * (x - x_0)) / (x_1 - x_0)
4425
4426
  res = F.select(F.equal(x_0, x_1), y_0, res)
4426
4427
 
4427
4428
  idx_0 = _to_tensor([0])
@@ -4685,21 +4686,21 @@ def histogram(a, bins=10, range=None, weights=None, density=False): # pylint: di
4685
4686
  bins (Union[int, tuple, list, Tensor], optional): If `bins` is an int, it
4686
4687
  defines the number of equal-width bins in the given range (10, by
4687
4688
  default). If `bins` is a sequence, it defines the bin edges, including
4688
- the rightmost edge, allowing for non-uniform bin widths.
4689
+ the rightmost edge, allowing for non-uniform bin widths. Default: ``10`` .
4689
4690
  range((float, float), optional): The lower and upper range of the bins. If
4690
4691
  not provided, `range` is simply ``(a.min(), a.max())``. Values outside
4691
4692
  the range are ignored. The first element of the range must be less than
4692
- or equal to the second.
4693
+ or equal to the second. Default: ``None`` .
4693
4694
  weights (Union[int, float, bool, list, tuple, Tensor], optional): An array
4694
4695
  of weights, of the same shape as `a`. If density is True, the weights
4695
4696
  are normalized, so that the integral of the density over the range
4696
- remains 1.
4697
+ remains 1. Default: ``None`` .
4697
4698
  density (boolean, optional): If False, the result will contain the number of
4698
4699
  samples in each bin. If True, the result is the value of the probability
4699
4700
  density function at the bin, normalized such that the integral over the
4700
4701
  range is 1. Note that the sum of the histogram values will not be equal
4701
4702
  to 1 unless bins of unity width are chosen; it is not a probability mass
4702
- function.
4703
+ function. Default: ``False`` .
4703
4704
 
4704
4705
  Returns:
4705
4706
  (Tensor, Tensor), the values of the histogram and the bin edges.
@@ -4739,7 +4740,7 @@ def histogram(a, bins=10, range=None, weights=None, density=False): # pylint: di
4739
4740
  return count, bin_edges
4740
4741
  if density:
4741
4742
  count = F.cast(count, mstype.float32)
4742
- count = count/diff(bin_edges)/F.reduce_sum(count)
4743
+ count = count / diff(bin_edges) / F.reduce_sum(count)
4743
4744
  return count, bin_edges
4744
4745
 
4745
4746
 
@@ -4795,7 +4796,7 @@ def histogramdd(sample, bins=10, range=None, weights=None, density=False): # pyl
4795
4796
  such as ``histogramdd((X, Y, Z))``.
4796
4797
 
4797
4798
  The first form should be preferred.
4798
- bins (Union[int, tuple, list], optional): The bin specification:
4799
+ bins (Union[int, tuple, list], optional): Default: ``10`` . The bin specification:
4799
4800
 
4800
4801
  A sequence of arrays describing the monotonically increasing bin edges along
4801
4802
  each dimension.
@@ -4807,12 +4808,12 @@ def histogramdd(sample, bins=10, range=None, weights=None, density=False): # pyl
4807
4808
  ``(lower, upper)`` tuple giving the outer bin edges to be used if the edges
4808
4809
  are not given explicitly in bins. An entry of None in the sequence results in
4809
4810
  the minimum and maximum values being used for the corresponding dimension.
4810
- The default, None, is equivalent to passing a tuple of `D` None values.
4811
+ The default, None, is equivalent to passing a tuple of `D` None values. Default: ``None`` .
4811
4812
  weights (Union[list, tuple, Tensor], optional): An array with shape `(N,)` of values
4812
- `w_i` weighing each sample ``(x_i, y_i, z_i, …)``.
4813
+ `w_i` weighing each sample ``(x_i, y_i, z_i, …)``. Default: ``None`` .
4813
4814
  density (boolean, optional): If False, the default, returns the number of samples
4814
4815
  in each bin. If True, returns the probability density function at the bin,
4815
- ``bin_count / sample_count / bin_volume``.
4816
+ ``bin_count / sample_count / bin_volume``. Default: ``False`` .
4816
4817
 
4817
4818
  Returns:
4818
4819
  (Tensor, list of Tensor), the values of the histogram and the bin edges.
@@ -4899,7 +4900,7 @@ def histogram2d(x, y, bins=10, range=None, weights=None, density=False): # pylin
4899
4900
  coordinates of the points to be histogrammed.
4900
4901
  y (Union[list, tuple, Tensor]): An array with shape `(N,)` containing the y
4901
4902
  coordinates of the points to be histogrammed.
4902
- bins (Union[int, tuple, list], optional): The bin specification:
4903
+ bins (Union[int, tuple, list], optional): Default: ``10`` . The bin specification:
4903
4904
 
4904
4905
  If int, the number of bins for the two dimensions ``(nx=ny=bins)``.
4905
4906
 
@@ -4914,12 +4915,12 @@ def histogram2d(x, y, bins=10, range=None, weights=None, density=False): # pylin
4914
4915
  range(Union[list, tuple], optional): has shape (2, 2), the leftmost and rightmost
4915
4916
  edges of the bins along each dimension (if not specified explicitly in the bins
4916
4917
  parameters): ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range
4917
- will be considered outliers and not tallied in the histogram.
4918
+ will be considered outliers and not tallied in the histogram. Default: ``None`` .
4918
4919
  weights (Union[list, tuple, Tensor], optional): An array with shape `(N,)` of values
4919
- `w_i` weighing each sample `(x_i, y_i)`.
4920
+ `w_i` weighing each sample `(x_i, y_i)`. Default: ``None`` .
4920
4921
  density (boolean, optional): If False, the default, returns the number of samples
4921
4922
  in each bin. If True, returns the probability density function at the bin,
4922
- ``bin_count / sample_count / bin_volume``.
4923
+ ``bin_count / sample_count / bin_volume``. Default: ``False`` .
4923
4924
 
4924
4925
  Returns:
4925
4926
  (Tensor, Tensor, Tensor), the values of the bi-directional histogram and the bin edges
@@ -5060,8 +5061,8 @@ def polyadd(a1, a2):
5060
5061
  Numpy object poly1d is currently not supported.
5061
5062
 
5062
5063
  Args:
5063
- a1 (Union[int, float, list, tuple, Tensor): Input polynomial.
5064
- a2 (Union[int, float, list, tuple, Tensor): Input polynomial.
5064
+ a1 (Union[int, float, list, tuple, Tensor]): Input polynomial.
5065
+ a2 (Union[int, float, list, tuple, Tensor]): Input polynomial.
5065
5066
 
5066
5067
  Returns:
5067
5068
  Tensor, the sum of the inputs.
@@ -5096,8 +5097,8 @@ def polysub(a1, a2):
5096
5097
  Numpy object poly1d is currently not supported.
5097
5098
 
5098
5099
  Args:
5099
- a1 (Union[int, float, list, tuple, Tensor): Minuend polynomial.
5100
- a2 (Union[int, float, list, tuple, Tensor): Subtrahend polynomial.
5100
+ a1 (Union[int, float, list, tuple, Tensor]): Minuend polynomial.
5101
+ a2 (Union[int, float, list, tuple, Tensor]): Subtrahend polynomial.
5101
5102
 
5102
5103
  Returns:
5103
5104
  Tensor, the difference of the inputs.
@@ -5128,10 +5129,10 @@ def polyval(p, x):
5128
5129
  Numpy object poly1d is currently not supported.
5129
5130
 
5130
5131
  Args:
5131
- p (Union[int, float, bool, list, tuple, Tensor): 1D array of polynomial
5132
+ p (Union[int, float, bool, list, tuple, Tensor]): 1D array of polynomial
5132
5133
  coefficients (including coefficients equal to zero) from highest
5133
5134
  degree to the constant term.
5134
- x (Union[int, float, bool, list, tuple, Tensor): A number, an array of
5135
+ x (Union[int, float, bool, list, tuple, Tensor]): A number, an array of
5135
5136
  numbers, at which to evaluate `p`.
5136
5137
 
5137
5138
  Returns:
@@ -5152,7 +5153,7 @@ def polyval(p, x):
5152
5153
  shape = F.shape(x)
5153
5154
  exp_p = arange(_type_convert(int, p.size) - 1, -1, -1).astype(mstype.float32)
5154
5155
  var_p = (x.reshape(shape + (1,)))**exp_p
5155
- return F.reduce_sum(p*var_p, -1)
5156
+ return F.reduce_sum(p * var_p, -1)
5156
5157
 
5157
5158
 
5158
5159
  def polyder(p, m=1):
@@ -5163,7 +5164,7 @@ def polyder(p, m=1):
5163
5164
  Numpy object poly1d is currently not supported.
5164
5165
 
5165
5166
  Args:
5166
- p (Union[int, float, bool, list, tuple, Tensor): Polynomial to differentiate.
5167
+ p (Union[int, float, bool, list, tuple, Tensor]): Polynomial to differentiate.
5167
5168
  A sequence is interpreted as polynomial coefficients.
5168
5169
  m (int, optional): Default: ``1`` , order of differentiation.
5169
5170
 
@@ -5200,8 +5201,8 @@ def polymul(a1, a2):
5200
5201
  Numpy object poly1d is currently not supported.
5201
5202
 
5202
5203
  Args:
5203
- a1 (Union[int, float, bool, list, tuple, Tensor): Input polynomial.
5204
- a2 (Union[int, float, bool, list, tuple, Tensor): Input polynomial.
5204
+ a1 (Union[int, float, bool, list, tuple, Tensor]): Input polynomial.
5205
+ a2 (Union[int, float, bool, list, tuple, Tensor]): Input polynomial.
5205
5206
 
5206
5207
  Returns:
5207
5208
  Tensor, a new polynomial representing the derivative.
@@ -5230,10 +5231,10 @@ def polyint(p, m=1, k=None):
5230
5231
  Numpy object poly1d is currently not supported.
5231
5232
 
5232
5233
  Args:
5233
- p (Union[int, float, bool, list, tuple, Tensor): Polynomial to integrate. A
5234
+ p (Union[int, float, bool, list, tuple, Tensor]): Polynomial to integrate. A
5234
5235
  sequence is interpreted as polynomial coefficients.
5235
5236
  m (int, optional): Defaults to 1, Order of the antiderivative.
5236
- k (Union[int, list of int]y, optinoal): Integration constants. They are given
5237
+ k (Union[int, list[int]], optional): Integration constants. They are given
5237
5238
  in the order of integration: those corresponding to highest-order terms
5238
5239
  come first. If None (default), all constants are assumed to be zero. If
5239
5240
  ``m = 1``, a single scalar can be given instead of a list.
@@ -5337,7 +5338,7 @@ def unwrap(p, discont=3.141592653589793, axis=-1):
5337
5338
  differently than numpy due to differences in round-off.
5338
5339
 
5339
5340
  Args:
5340
- p (Union[int, float, bool, list, tuple, Tensor): Input array.
5341
+ p (Union[int, float, bool, list, tuple, Tensor]): Input array.
5341
5342
  discont (float, optional): Maximum discontinuity between values, default: ``pi`` .
5342
5343
  axis (int, optional): Axis along which unwrap will operate, default: ``-1`` .
5343
5344
 
@@ -5472,14 +5473,14 @@ def ravel_multi_index(multi_index, dims, mode='clip', order='C'):
5472
5473
  Args:
5473
5474
  multi_index (tuple of array_like):
5474
5475
  A tuple of integer arrays, one array for each dimension.
5475
- dims (Union[int, tuple of integers]): The shape of array into which the indices from multi_index apply.
5476
- mode ({`wrap`, `clip`}): Specifies how out-of-bounds indices are handled. Default: ``clip''``.
5476
+ dims (Union[int, tuple(int)]): The shape of array into which the indices from multi_index apply.
5477
+ mode ({`wrap`, `clip`}, optional): Specifies how out-of-bounds indices are handled. Default: ``'clip'``.
5477
5478
 
5478
5479
  - `wrap`: wrap around
5479
5480
  - `clip`: clip to the range
5480
5481
 
5481
5482
  In `clip` mode, a negative index which would normally wrap will clip to 0 instead.
5482
- order ({`C`, `F`}): Determines whether the multi-index should be viewed as indexing in
5483
+ order ({`C`, `F`}, optional): Determines whether the multi-index should be viewed as indexing in
5483
5484
  row-major (C-style) or column-major (Fortran-style) order.
5484
5485
 
5485
5486
  Returns:
@@ -5534,7 +5535,7 @@ def _vector_norm(x, _ord, axis, keepdims):
5534
5535
  elif _ord == 0:
5535
5536
  res = P.ReduceSum(keepdims)(F.not_equal(x, 0).astype(mstype.float32), axis)
5536
5537
  else:
5537
- res = power(P.ReduceSum(keepdims)(power(absolute(x), _ord), axis), 1./_ord)
5538
+ res = power(P.ReduceSum(keepdims)(power(absolute(x), _ord), axis), 1. / _ord)
5538
5539
  return res
5539
5540
 
5540
5541
 
@@ -5581,7 +5582,7 @@ def norm(x, ord=None, axis=None, keepdims=False): # pylint: disable=redefined-bu
5581
5582
  the 2-norm of ``x.ravel`` will be returned.
5582
5583
  ord (Union[None, 'fro', 'nuc', inf, -inf, int, float], optional): Order of the norm.
5583
5584
  inf means numpy’s inf object. Default: ``None`` .
5584
- axis (Union[None, int, 2-tuple of integers], optional): If `axis` is an integer, it
5585
+ axis (Union[int, 2-tuple(int), None], optional): If `axis` is an integer, it
5585
5586
  specifies the axis of `x` along which to compute the vector norms. If `axis` is
5586
5587
  a 2-tuple, it specifies the axes that hold 2-D matrices, and the matrix norms of
5587
5588
  these matrices are computed. If `axis` is None then either a vector norm (when x
@@ -208,7 +208,7 @@ def _check_shape_aligned(shape1, shape2):
208
208
  @_primexpr
209
209
  def _tile_size(shape, out_shape, ndim):
210
210
  """Returns tile_size such that shape*tile_size = out_shape"""
211
- size = [1]*ndim
211
+ size = [1] * ndim
212
212
  for idx, (i, j) in enumerate(zip(shape, out_shape)):
213
213
  if i != j:
214
214
  size[idx] = j
@@ -441,7 +441,7 @@ def _add_unit_axes(shape, ndim, append=False):
441
441
 
442
442
 
443
443
  @constexpr
444
- def _check_element_int(lst):
444
+ def _check_element_int(lst):
445
445
  """
446
446
  Check whether each element in `lst` is an integer.
447
447
  """
@@ -508,7 +508,7 @@ def _iota(dtype, num, increasing=True):
508
508
  raise ValueError("zero shape Tensor is not currently supported.")
509
509
  if increasing:
510
510
  return Tensor(list(range(int(num))), dtype)
511
- return Tensor(list(range(int(num)-1, -1, -1)), dtype)
511
+ return Tensor(list(range(int(num) - 1, -1, -1)), dtype)
512
512
 
513
513
 
514
514
  @constexpr
@@ -520,7 +520,7 @@ def _ceil(number):
520
520
  @_primexpr
521
521
  def _seq_prod(seq1, seq2):
522
522
  """Returns the element-wise product of seq1 and seq2."""
523
- return tuple(map(lambda x, y: x*y, seq1, seq2))
523
+ return tuple(map(lambda x, y: x * y, seq1, seq2))
524
524
 
525
525
 
526
526
  @constexpr
Binary file
Binary file
Binary file