mindspore 2.7.0__cp310-cp310-win_amd64.whl → 2.7.0rc1__cp310-cp310-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of mindspore might be problematic. Click here for more details.
- mindspore/.commit_id +1 -1
- mindspore/__init__.py +1 -1
- mindspore/_c_dataengine.cp310-win_amd64.pyd +0 -0
- mindspore/_c_expression.cp310-win_amd64.pyd +0 -0
- mindspore/_c_mindrecord.cp310-win_amd64.pyd +0 -0
- mindspore/_checkparam.py +2 -2
- mindspore/_extends/builtin_operations.py +3 -3
- mindspore/_extends/parallel_compile/akg_compiler/gen_custom_op_files.py +1 -1
- mindspore/_extends/parse/__init__.py +3 -3
- mindspore/_extends/parse/deprecated/deprecated_tensor_method.py +1 -0
- mindspore/_extends/parse/parser.py +22 -28
- mindspore/_extends/parse/standard_method.py +1 -15
- mindspore/_extends/pijit/pijit_func_white_list.py +5 -2
- mindspore/_extends/remote/kernel_build_server_ascend.py +75 -0
- mindspore/amp.py +18 -0
- mindspore/avcodec-59.dll +0 -0
- mindspore/avdevice-59.dll +0 -0
- mindspore/avfilter-8.dll +0 -0
- mindspore/avformat-59.dll +0 -0
- mindspore/avutil-57.dll +0 -0
- mindspore/common/__init__.py +12 -18
- mindspore/common/_tensor_cpp_method.py +1 -1
- mindspore/common/_tensor_docs.py +38 -102
- mindspore/common/_utils.py +1 -9
- mindspore/common/api.py +106 -155
- mindspore/common/{dynamic_shape/auto_dynamic_shape.py → auto_dynamic_shape.py} +23 -17
- mindspore/common/dtype.py +57 -98
- mindspore/common/dump.py +1 -1
- mindspore/common/file_system.py +9 -59
- mindspore/common/hook_handle.py +3 -22
- mindspore/common/np_dtype.py +3 -3
- mindspore/common/parameter.py +20 -4
- mindspore/common/recompute.py +4 -2
- mindspore/common/tensor.py +52 -38
- mindspore/communication/_hccl_management.py +297 -0
- mindspore/context.py +21 -15
- mindspore/dataset/__init__.py +1 -1
- mindspore/dataset/audio/transforms.py +1 -1
- mindspore/dataset/core/config.py +1 -35
- mindspore/dataset/engine/datasets.py +315 -330
- mindspore/dataset/engine/datasets_user_defined.py +22 -38
- mindspore/dataset/transforms/c_transforms.py +2 -2
- mindspore/dataset/transforms/transforms.py +3 -3
- mindspore/dataset/vision/__init__.py +1 -1
- mindspore/dataset/vision/py_transforms.py +8 -8
- mindspore/dataset/vision/transforms.py +5 -17
- mindspore/dataset/vision/utils.py +21 -632
- mindspore/device_context/ascend/op_tuning.py +1 -35
- mindspore/dnnl.dll +0 -0
- mindspore/experimental/llm_boost/ascend_native/llama_boost_ascend_native.py +0 -3
- mindspore/include/api/cell.h +4 -28
- mindspore/include/api/cfg.h +7 -24
- mindspore/include/api/context.h +0 -1
- mindspore/include/api/delegate.h +2 -0
- mindspore/include/api/dual_abi_helper.h +19 -100
- mindspore/include/api/graph.h +1 -14
- mindspore/include/api/kernel.h +3 -16
- mindspore/include/api/kernel_api.h +1 -9
- mindspore/include/api/metrics/accuracy.h +0 -9
- mindspore/include/api/model.h +1 -5
- mindspore/include/api/model_group.h +0 -4
- mindspore/include/api/model_parallel_runner.h +0 -2
- mindspore/include/api/status.h +10 -48
- mindspore/include/api/types.h +1 -6
- mindspore/include/dataset/constants.h +0 -9
- mindspore/jpeg62.dll +0 -0
- mindspore/mindrecord/tools/cifar10.py +2 -3
- mindspore/mindrecord/tools/cifar10_to_mr.py +5 -5
- mindspore/mindspore_backend_common.dll +0 -0
- mindspore/mindspore_backend_manager.dll +0 -0
- mindspore/mindspore_common.dll +0 -0
- mindspore/mindspore_core.dll +0 -0
- mindspore/mindspore_cpu_res_manager.dll +0 -0
- mindspore/mindspore_dump.dll +0 -0
- mindspore/mindspore_frontend.dll +0 -0
- mindspore/mindspore_glog.dll +0 -0
- mindspore/mindspore_memory_pool.dll +0 -0
- mindspore/mindspore_ms_backend.dll +0 -0
- mindspore/mindspore_ops.dll +0 -0
- mindspore/mindspore_ops_host.dll +0 -0
- mindspore/mindspore_ops_kernel_common.dll +0 -0
- mindspore/mindspore_profiler.dll +0 -0
- mindspore/mindspore_pyboost.dll +0 -0
- mindspore/mindspore_pynative.dll +0 -0
- mindspore/mindspore_res_manager.dll +0 -0
- mindspore/mindspore_runtime_pipeline.dll +0 -0
- mindspore/mint/distributed/__init__.py +0 -4
- mindspore/mint/distributed/distributed.py +14 -217
- mindspore/mint/nn/layer/_functions.py +2 -1
- mindspore/mint/nn/layer/conv.py +6 -6
- mindspore/mint/nn/layer/normalization.py +3 -3
- mindspore/nn/cell.py +174 -216
- mindspore/nn/layer/activation.py +2 -4
- mindspore/nn/layer/basic.py +13 -7
- mindspore/nn/layer/image.py +1 -1
- mindspore/nn/optim/adam.py +3 -1
- mindspore/nn/optim/lamb.py +3 -1
- mindspore/nn/optim/tft_wrapper.py +3 -2
- mindspore/nn/probability/distribution/_utils/utils.py +2 -2
- mindspore/nn/wrap/cell_wrapper.py +5 -39
- mindspore/nn/wrap/grad_reducer.py +15 -0
- mindspore/numpy/array_creations.py +2 -2
- mindspore/numpy/utils_const.py +1 -1
- mindspore/opencv_core452.dll +0 -0
- mindspore/opencv_imgcodecs452.dll +0 -0
- mindspore/opencv_imgproc452.dll +0 -0
- mindspore/ops/_grad_experimental/grad_inner_ops.py +9 -0
- mindspore/ops/_op_impl/cpu/__init__.py +0 -1
- mindspore/ops/auto_generate/cpp_create_prim_instance_helper.py +2 -12
- mindspore/ops/auto_generate/gen_extend_func.py +4 -4
- mindspore/ops/auto_generate/gen_ops_def.py +16 -290
- mindspore/ops/auto_generate/gen_ops_prim.py +76 -563
- mindspore/ops/composite/base.py +1 -1
- mindspore/ops/composite/multitype_ops/_constexpr_utils.py +1 -1
- mindspore/ops/function/__init__.py +0 -1
- mindspore/ops/function/array_func.py +6 -10
- mindspore/ops/function/debug_func.py +2 -4
- mindspore/ops/function/grad/grad_func.py +12 -4
- mindspore/ops/function/math_func.py +32 -44
- mindspore/ops/function/nn_func.py +20 -18
- mindspore/ops/functional.py +1 -2
- mindspore/ops/functional_overload.py +12 -23
- mindspore/ops/operations/_inner_ops.py +12 -11
- mindspore/ops/operations/array_ops.py +50 -4
- mindspore/ops/operations/comm_ops.py +15 -1
- mindspore/ops/operations/custom_ops.py +4 -10
- mindspore/ops/operations/debug_ops.py +6 -6
- mindspore/ops/operations/manually_defined/ops_def.py +12 -12
- mindspore/ops/operations/math_ops.py +5 -5
- mindspore/ops/operations/nn_ops.py +1 -1
- mindspore/ops/primitive.py +10 -3
- mindspore/ops/tensor_method.py +7 -16
- mindspore/ops_generate/pyboost/gen_pyboost_func.py +16 -0
- mindspore/parallel/_auto_parallel_context.py +15 -5
- mindspore/parallel/_parallel_serialization.py +2 -3
- mindspore/parallel/_ps_context.py +2 -2
- mindspore/parallel/_transformer/transformer.py +4 -4
- mindspore/parallel/_utils.py +11 -5
- mindspore/parallel/auto_parallel.py +9 -23
- mindspore/parallel/checkpoint_transform.py +0 -2
- mindspore/parallel/cluster/process_entity/_api.py +1 -4
- mindspore/parallel/cluster/run.py +3 -5
- mindspore/parallel/function/reshard_func.py +5 -6
- mindspore/parallel/nn/parallel_cell_wrapper.py +3 -40
- mindspore/parallel/nn/parallel_grad_reducer.py +8 -0
- mindspore/parallel/shard.py +21 -7
- mindspore/parallel/transform_safetensors.py +4 -10
- mindspore/profiler/analysis/viewer/ascend_kernel_details_viewer.py +9 -10
- mindspore/profiler/analysis/viewer/ascend_op_memory_viewer.py +1 -1
- mindspore/profiler/common/msprof_cmd_tool.py +2 -2
- mindspore/profiler/common/path_manager.py +0 -9
- mindspore/profiler/common/profiler_context.py +2 -25
- mindspore/profiler/common/profiler_meta_data.py +0 -1
- mindspore/profiler/common/profiler_op_analyse.py +6 -10
- mindspore/{ops/_op_impl/cpu/joinedstr_op.py → profiler/common/validator/__init__.py} +1 -15
- mindspore/profiler/common/validator/validate_path.py +84 -0
- mindspore/profiler/dynamic_profiler.py +46 -91
- mindspore/profiler/envprofiler.py +5 -30
- mindspore/profiler/experimental_config.py +1 -16
- mindspore/profiler/platform/cpu_profiler.py +4 -10
- mindspore/profiler/platform/npu_profiler.py +1 -1
- mindspore/profiler/profiler.py +145 -193
- mindspore/profiler/profiler_action_controller.py +1 -1
- mindspore/profiler/profiler_interface.py +2 -2
- mindspore/rewrite/symbol_tree/symbol_tree.py +1 -1
- mindspore/runtime/__init__.py +4 -6
- mindspore/runtime/executor.py +0 -27
- mindspore/runtime/memory.py +0 -1
- mindspore/runtime/thread_bind_core.py +1 -1
- mindspore/swresample-4.dll +0 -0
- mindspore/swscale-6.dll +0 -0
- mindspore/tinyxml2.dll +0 -0
- mindspore/train/_utils.py +3 -3
- mindspore/train/amp.py +3 -0
- mindspore/train/callback/_callback.py +1 -2
- mindspore/train/callback/_checkpoint.py +8 -1
- mindspore/train/callback/_flops_collector.py +6 -10
- mindspore/train/callback/_train_fault_tolerance.py +7 -3
- mindspore/train/data_sink.py +4 -4
- mindspore/train/dataset_helper.py +5 -5
- mindspore/train/model.py +20 -4
- mindspore/train/serialization.py +15 -35
- mindspore/train/train_thor/model_thor.py +2 -2
- mindspore/turbojpeg.dll +0 -0
- mindspore/utils/hooks.py +81 -0
- mindspore/utils/utils.py +8 -8
- mindspore/version.py +1 -1
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/METADATA +1 -1
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/RECORD +193 -192
- mindspore/_extends/parallel_compile/akg_compiler/custom.py +0 -1109
- mindspore/common/dynamic_shape/__init__.py +0 -0
- mindspore/common/dynamic_shape/enable_dynamic.py +0 -197
- /mindspore/common/{dynamic_shape/_auto_dynamic.py → _auto_dynamic.py} +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/WHEEL +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/entry_points.txt +0 -0
- {mindspore-2.7.0.dist-info → mindspore-2.7.0rc1.dist-info}/top_level.txt +0 -0
mindspore/common/_tensor_docs.py
CHANGED
|
@@ -72,7 +72,7 @@ Note:
|
|
|
72
72
|
- When `self` and `other` have different shapes,
|
|
73
73
|
they must be able to broadcast to a common shape.
|
|
74
74
|
- `self` and `other` can not be bool type at the same time,
|
|
75
|
-
[True, Tensor(True), Tensor(np.array([True]))] are all considered bool type.
|
|
75
|
+
[True, Tensor(True, bool\_), Tensor(np.array([True]), bool\_)] are all considered bool type.
|
|
76
76
|
- `self` and `other` comply with the implicit type conversion rules to make the data types
|
|
77
77
|
consistent.
|
|
78
78
|
- The dimension of `self` should be greater than or equal to 1.
|
|
@@ -80,7 +80,7 @@ Note:
|
|
|
80
80
|
Args:
|
|
81
81
|
other (Union[Tensor, number.Number, bool]): `other` is a number.Number or a bool or a tensor whose data type is
|
|
82
82
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
83
|
-
`
|
|
83
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
84
84
|
|
|
85
85
|
Returns:
|
|
86
86
|
Tensor with a shape that is the same as the broadcasted shape of `self` and `other`,
|
|
@@ -131,7 +131,7 @@ Note:
|
|
|
131
131
|
Args:
|
|
132
132
|
other (Union[Tensor, number.Number, bool]): `other` is a number.Number or a bool or a tensor whose data type is
|
|
133
133
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
134
|
-
`
|
|
134
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
135
135
|
|
|
136
136
|
Keyword Args:
|
|
137
137
|
alpha (number.Number): A scaling factor applied to `other`, default 1.
|
|
@@ -319,7 +319,29 @@ Examples:
|
|
|
319
319
|
.. method:: Tensor.any(dim=None, keepdim=False) -> Tensor
|
|
320
320
|
:noindex:
|
|
321
321
|
|
|
322
|
-
|
|
322
|
+
Tests if any element in tensor evaluates to `True` along the given axes.
|
|
323
|
+
|
|
324
|
+
Args:
|
|
325
|
+
dim (int, optional): The dimensions to reduce. If ``None`` , all dimensions are reduced. Default ``None`` .
|
|
326
|
+
keepdim (bool, optional): Whether the output tensor has dim retained or not. Default ``False`` .
|
|
327
|
+
|
|
328
|
+
Returns:
|
|
329
|
+
Tensor
|
|
330
|
+
|
|
331
|
+
Supported Platforms:
|
|
332
|
+
``Ascend`` ``GPU`` ``CPU``
|
|
333
|
+
|
|
334
|
+
Examples:
|
|
335
|
+
>>> import mindspore
|
|
336
|
+
>>> x = mindspore.tensor([[True, False], [True, True]])
|
|
337
|
+
>>>
|
|
338
|
+
>>> # case 1: By default, mindspore.Tensor.any tests along all the axes.
|
|
339
|
+
>>> x.any()
|
|
340
|
+
Tensor(shape=[], dtype=Bool, value= True)
|
|
341
|
+
>>>
|
|
342
|
+
>>> # case 2: Reduces a dimension along dim 1, with keepdim False.
|
|
343
|
+
>>> x.any(dim=1)
|
|
344
|
+
Tensor(shape=[2], dtype=Bool, value= [ True, True])
|
|
323
345
|
""")
|
|
324
346
|
attach_docstr("arccosh", r"""arccosh() -> Tensor
|
|
325
347
|
|
|
@@ -797,17 +819,11 @@ Copies the elements from `src` into `self` tensor and returns `self`.
|
|
|
797
819
|
|
|
798
820
|
.. warning::
|
|
799
821
|
This is an experimental API that is subject to change or deletion.
|
|
800
|
-
|
|
801
|
-
If Copying is performed between Ascend and Ascend, the `src` tensor must be broadcastable with the `self` tensor,
|
|
802
|
-
and they can be of different data types.
|
|
803
|
-
Copying is performed between CPU and Ascend or CPU and CPU are only supported if `self` and `src` have
|
|
804
|
-
the same shape and data type and they are all contiguous.
|
|
822
|
+
The `src` tensor must be broadcastable with the `self` tensor. It may be of a different data type.
|
|
805
823
|
|
|
806
824
|
Args:
|
|
807
825
|
src (Tensor): the source tensor to copy from.
|
|
808
|
-
non_blocking (bool, optional):
|
|
809
|
-
have the same shape and data type and are contiguous. The copy may occur asynchronously with respect to the
|
|
810
|
-
host. For other cases, this argument has no effect. Default: ``False``.
|
|
826
|
+
non_blocking (bool, optional): no effect currently. Default: ``False``.
|
|
811
827
|
|
|
812
828
|
Returns:
|
|
813
829
|
Return self Tensor.
|
|
@@ -885,7 +901,7 @@ Args:
|
|
|
885
901
|
keep_dims (bool, optional): Whether to maintain dimensions specified by `axis`.
|
|
886
902
|
If true, keep these reduced dimensions and the length is 1.
|
|
887
903
|
If false, don't keep these dimensions. Default: ``False`` .
|
|
888
|
-
dtype (Union[Number, mindspore.bool], optional): The data type of the output tensor.
|
|
904
|
+
dtype (Union[Number, mindspore.bool\_], optional): The data type of the output tensor.
|
|
889
905
|
Default: ``None`` .
|
|
890
906
|
|
|
891
907
|
Returns:
|
|
@@ -1486,7 +1502,7 @@ where params represents the input `input_params`, and indices represents the ind
|
|
|
1486
1502
|
On CPU and GPU, an error is raised if an out of bound indice is found. On Ascend, the results may be
|
|
1487
1503
|
undefined.
|
|
1488
1504
|
- The data type of self cannot be
|
|
1489
|
-
`
|
|
1505
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ on Ascend
|
|
1490
1506
|
platform currently.
|
|
1491
1507
|
|
|
1492
1508
|
Args:
|
|
@@ -1907,13 +1923,13 @@ Examples:
|
|
|
1907
1923
|
>>> import mindspore
|
|
1908
1924
|
>>> import numpy as np
|
|
1909
1925
|
>>> from mindspore import Tensor
|
|
1910
|
-
>>> input = Tensor(np.array([True, False, True]), mindspore.
|
|
1911
|
-
>>> other = Tensor(np.array([True, True, False]), mindspore.
|
|
1926
|
+
>>> input = Tensor(np.array([True, False, True]), mindspore.bool_)
|
|
1927
|
+
>>> other = Tensor(np.array([True, True, False]), mindspore.bool_)
|
|
1912
1928
|
>>> output = input.logical_xor(other)
|
|
1913
1929
|
>>> print(output)
|
|
1914
1930
|
[ False True True]
|
|
1915
|
-
>>> x = Tensor(1, mindspore.
|
|
1916
|
-
>>> other = Tensor(0, mindspore.
|
|
1931
|
+
>>> x = Tensor(1, mindspore.bool_)
|
|
1932
|
+
>>> other = Tensor(0, mindspore.bool_)
|
|
1917
1933
|
>>> output = input.logical_xor(other)
|
|
1918
1934
|
>>> print(output)
|
|
1919
1935
|
True
|
|
@@ -1947,43 +1963,6 @@ In-place version of :func:`mindspore.Tensor.masked_fill`.
|
|
|
1947
1963
|
.. warning::
|
|
1948
1964
|
This is an experimental API that is subject to change or deletion.
|
|
1949
1965
|
""")
|
|
1950
|
-
attach_docstr("masked_scatter", r"""masked_scatter(mask, source) -> Tensor
|
|
1951
|
-
|
|
1952
|
-
Returns a Tensor. Updates the value in the "self Tensor" with the `tensor` value according to the mask.
|
|
1953
|
-
The shape of `mask` and the shape of the "self Tensor" must be the same or `mask` is broadcastable.
|
|
1954
|
-
|
|
1955
|
-
.. warning::
|
|
1956
|
-
This is an experimental API that is subject to change or deletion.
|
|
1957
|
-
|
|
1958
|
-
Args:
|
|
1959
|
-
mask (Tensor[bool]): A bool tensor with a shape broadcastable to the "self Tensor".
|
|
1960
|
-
source (Tensor): A tensor with the same data type as the "self Tensor". The number
|
|
1961
|
-
of elements must be greater than or equal to the number of True's in `mask`.
|
|
1962
|
-
|
|
1963
|
-
Returns:
|
|
1964
|
-
Tensor, with the same type and shape as the "self Tensor".
|
|
1965
|
-
|
|
1966
|
-
Raises:
|
|
1967
|
-
TypeError: If `mask` or `source` is not a Tensor.
|
|
1968
|
-
TypeError: If data type of the "self Tensor" is not be supported.
|
|
1969
|
-
TypeError: If dtype of `mask` is not bool.
|
|
1970
|
-
TypeError: If the dim of the "self Tensor" is less than the dim of `mask`.
|
|
1971
|
-
ValueError: If `mask` can not be broadcastable to the "self Tensor".
|
|
1972
|
-
ValueError: If the number of elements in `source` is less than the number of elements to be updated in the tensor.
|
|
1973
|
-
|
|
1974
|
-
Supported Platforms:
|
|
1975
|
-
``Ascend`` ``CPU``
|
|
1976
|
-
|
|
1977
|
-
Examples:
|
|
1978
|
-
>>> import numpy as np
|
|
1979
|
-
>>> import mindspore
|
|
1980
|
-
>>> from mindspore import Tensor
|
|
1981
|
-
>>> source = Tensor(np.array([1., 2., 3., 4.]), mindspore.float32)
|
|
1982
|
-
>>> mask = Tensor(np.array([True, True, False, True]), mindspore.bool_)
|
|
1983
|
-
>>> tensor = Tensor(np.array([5., 6., 7.]), mindspore.float32)
|
|
1984
|
-
>>> output = source.masked_scatter(mask, tensor)
|
|
1985
|
-
>>> print(output)
|
|
1986
|
-
[5. 6. 3. 7.]""")
|
|
1987
1966
|
attach_docstr("masked_select", r"""masked_select(mask) -> Tensor
|
|
1988
1967
|
|
|
1989
1968
|
For details, please refer to :func:`mindspore.ops.masked_select`.""")
|
|
@@ -2510,7 +2489,7 @@ Note:
|
|
|
2510
2489
|
- When `self` and `other` have different shapes,
|
|
2511
2490
|
`other` be able to broadcast to a `self`.
|
|
2512
2491
|
- `self` and `other` can not be bool type at the same time,
|
|
2513
|
-
[True, Tensor(True), Tensor(np.array([True]))] are all considered bool type.
|
|
2492
|
+
[True, Tensor(True, bool\_), Tensor(np.array([True]), bool\_)] are all considered bool type.
|
|
2514
2493
|
|
|
2515
2494
|
Args:
|
|
2516
2495
|
other (Union[Tensor, number.Number, bool]): `other` is a number.Number or
|
|
@@ -2956,11 +2935,11 @@ Supports broadcasting to a common shape and implicit type promotion.
|
|
|
2956
2935
|
|
|
2957
2936
|
The dividend `self` is a tensor whose data type is
|
|
2958
2937
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
2959
|
-
`
|
|
2938
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
2960
2939
|
|
|
2961
2940
|
Args:
|
|
2962
2941
|
other (Union[Tensor, numbers.Number, bool]): The divisor is a numbers.Number or
|
|
2963
|
-
a bool or a tensor whose data type is number or bool when the dividend is a tensor.
|
|
2942
|
+
a bool or a tensor whose data type is number or bool\_ when the dividend is a tensor.
|
|
2964
2943
|
|
|
2965
2944
|
Returns:
|
|
2966
2945
|
Tensor, with dtype promoted and shape broadcasted.
|
|
@@ -3028,49 +3007,6 @@ Examples:
|
|
|
3028
3007
|
>>> print(output)
|
|
3029
3008
|
[2. 1. 0.]
|
|
3030
3009
|
""")
|
|
3031
|
-
attach_docstr("remainder_", r"""remainder_(other) -> Tensor
|
|
3032
|
-
|
|
3033
|
-
Computes the remainder of `self` divided by `other` element-wise. The result has the same sign as the divisor `other`
|
|
3034
|
-
and its absolute value is less than that of `other`.
|
|
3035
|
-
|
|
3036
|
-
.. code-block::
|
|
3037
|
-
|
|
3038
|
-
remainder(self, other) == self - self.div(other, rounding_mode="floor") * other
|
|
3039
|
-
|
|
3040
|
-
.. warning::
|
|
3041
|
-
This is an experimental API that is subject to change or deletion.
|
|
3042
|
-
|
|
3043
|
-
Note:
|
|
3044
|
-
- Complex inputs are not supported.
|
|
3045
|
-
- The dividend `self` is a tensor whose data type is
|
|
3046
|
-
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
3047
|
-
- When `self` and `other` have different shapes, `other` should be able to broadcast to a `self`.
|
|
3048
|
-
|
|
3049
|
-
Args:
|
|
3050
|
-
other (Union[Tensor, number, bool]): The divisor is a number or
|
|
3051
|
-
a bool or a tensor whose data type is number or bool.
|
|
3052
|
-
|
|
3053
|
-
Returns:
|
|
3054
|
-
Tensor, the shape and the data type are the same as those of `self` .
|
|
3055
|
-
|
|
3056
|
-
Raises:
|
|
3057
|
-
RuntimeError: If `other` cannot be broadcast to `self`.
|
|
3058
|
-
|
|
3059
|
-
Supported Platforms:
|
|
3060
|
-
``Ascend``
|
|
3061
|
-
|
|
3062
|
-
Examples:
|
|
3063
|
-
>>> import mindspore
|
|
3064
|
-
>>> from mindspore import Tensor
|
|
3065
|
-
>>> import numpy as np
|
|
3066
|
-
>>> x = Tensor(np.array([2, 4, -1]), mindspore.int32)
|
|
3067
|
-
>>> other = Tensor(np.array([3, -6, -2]), mindspore.int32)
|
|
3068
|
-
>>> output = x.remainder_(other)
|
|
3069
|
-
>>> print(output)
|
|
3070
|
-
[ 2 -2 -1]
|
|
3071
|
-
>>> print(x)
|
|
3072
|
-
[ 2 -2 -1]
|
|
3073
|
-
""")
|
|
3074
3010
|
attach_docstr("repeat", r"""repeat(*repeats)
|
|
3075
3011
|
|
|
3076
3012
|
Copy the elements in each dimension of a Tensor based on the specified number of repetition times.
|
|
@@ -4169,7 +4105,7 @@ Args:
|
|
|
4169
4105
|
other (Union[Tensor, number.Number, bool]): The second self, is a number.Number or
|
|
4170
4106
|
a bool or a tensor whose data type is
|
|
4171
4107
|
`number <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_ or
|
|
4172
|
-
`
|
|
4108
|
+
`bool_ <https://www.mindspore.cn/docs/en/master/api_python/mindspore/mindspore.dtype.html>`_.
|
|
4173
4109
|
|
|
4174
4110
|
Keyword Args:
|
|
4175
4111
|
alpha (number.Number, optional): A scaling factor applied to `other`, default ``1``.
|
mindspore/common/_utils.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# This is the Python adaptation and derivative work of Myia (https://github.com/mila-iqia/myia/).
|
|
2
2
|
#
|
|
3
|
-
# Copyright 2022
|
|
3
|
+
# Copyright 2022 Huawei Technologies Co., Ltd
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
6
|
# you may not use this file except in compliance with the License.
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
|
|
19
19
|
import os
|
|
20
20
|
import math
|
|
21
|
-
import types
|
|
22
21
|
import ctypes
|
|
23
22
|
import functools
|
|
24
23
|
|
|
@@ -47,13 +46,6 @@ def is_dim_unknown(shape):
|
|
|
47
46
|
return False
|
|
48
47
|
|
|
49
48
|
|
|
50
|
-
def get_func(func):
|
|
51
|
-
"""Get function object"""
|
|
52
|
-
if isinstance(func, types.MethodType):
|
|
53
|
-
return func.__func__
|
|
54
|
-
return func
|
|
55
|
-
|
|
56
|
-
|
|
57
49
|
def get_slice_num(dtype, shape):
|
|
58
50
|
"""Check whether size of data is too huge, and cut it to a smaller one, return slice num."""
|
|
59
51
|
slice_num = 1
|