forked from mindspore-Ecosystem/mindspore
!19354 fix tensor.py api
Merge pull request !19354 from 杨林枫/code_docs_fix_numpy_api
This commit is contained in:
commit
8e76cc35b9
|
@ -888,6 +888,9 @@ class Tensor(Tensor_):
|
|||
tensor, unless it has an integer dtype with a precision less than :class:`float32`.
|
||||
In that case, :class:`float32` is used. Default: None.
|
||||
|
||||
Raises:
|
||||
ValueError: if axis is out of range.
|
||||
|
||||
Returns:
|
||||
Tensor.
|
||||
|
||||
|
@ -979,7 +982,7 @@ class Tensor(Tensor_):
|
|||
value. If `axis` is given, the result is an array of dimension ``self.ndim - 1``.
|
||||
|
||||
Raises:
|
||||
TypeError: if the input is not a tensor.
|
||||
TypeError: if arguments have types not specified above.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -1024,7 +1027,7 @@ class Tensor(Tensor_):
|
|||
value. If `axis` is given, the result is an array of dimension ``self.ndim - 1``.
|
||||
|
||||
Raises:
|
||||
TypeError: if the input is not a tensor.
|
||||
TypeError: if arguments have types not specified above.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -1099,7 +1102,7 @@ class Tensor(Tensor_):
|
|||
Tensor.
|
||||
|
||||
Raises:
|
||||
TypeError: if the input is not a tensor.
|
||||
TypeError: if `self` is not a tensor, or `axis` and `keepdims` have types not specified above.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -1147,6 +1150,10 @@ class Tensor(Tensor_):
|
|||
Tensor, a tensor with the elements of input tensor, but where values
|
||||
< `xmin` are replaced with `xmin`, and those > `xmax` with `xmax`.
|
||||
|
||||
Raises:
|
||||
TypeError: If inputs have types not specified above.
|
||||
ValueError: If the shapes of `x1` and `x2` cannot broadcast, or both `xmin` and `xmax` are `None`.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
||||
|
@ -1477,8 +1484,7 @@ class Tensor(Tensor_):
|
|||
Tensor, the indexed result.
|
||||
|
||||
Raises:
|
||||
ValueError: if axis is out of range.
|
||||
TypeError: if the input is not a Tensor.
|
||||
ValueError: if `axis` is out of range, or `mode` has values other than (‘raise’, ‘wrap’, ‘clip’)
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
@ -1824,7 +1830,7 @@ class Tensor(Tensor_):
|
|||
|
||||
Raises:
|
||||
ValueError: if axis is out of range.
|
||||
TypeError: if input is not a Tensor.
|
||||
TypeError: if arguments have types not specified above.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
|
|
@ -1689,7 +1689,7 @@ def vander(x, N=None, increasing=False):
|
|||
|
||||
Examples:
|
||||
>>> import mindspore.numpy as np
|
||||
>>> print(np.vander([1,2,3,4,5]))
|
||||
>>> print(np.vander([1., 2., 3., 4., 5.]))
|
||||
[[ 1 1 1 1 1]
|
||||
[ 16 8 4 2 1]
|
||||
[ 81 27 9 3 1]
|
||||
|
|
|
@ -121,6 +121,10 @@ def count_nonzero(x, axis=None, keepdims=False):
|
|||
Tensor, indicating number of non-zero values in the `x` along a given axis.
|
||||
Otherwise, the total number of non-zero values in `x` is returned.
|
||||
|
||||
Raises:
|
||||
TypeError: If axis is not int or tuple.
|
||||
ValueError: If axis is not in range [-x.ndim, x.ndim)
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
||||
|
@ -161,6 +165,10 @@ def clip(x, xmin, xmax, dtype=None):
|
|||
Tensor, a tensor with the elements of `x`, but where values
|
||||
< `xmin` are replaced with `xmin`, and those > `xmax` with `xmax`.
|
||||
|
||||
Raises:
|
||||
TypeError: If inputs have types not specified above.
|
||||
ValueError: If the shapes of `x1` and `x2` cannot broadcast, or both `xmin` and `xmax` are `None`.
|
||||
|
||||
Supported Platforms:
|
||||
``Ascend`` ``GPU`` ``CPU``
|
||||
|
||||
|
@ -3577,8 +3585,8 @@ def arctan(x, dtype=None):
|
|||
Examples:
|
||||
>>> import mindspore.numpy as np
|
||||
>>> x = np.arange(5).astype('float32')
|
||||
>>> print(np.tan(x))
|
||||
[ 0. 1.5574077 -2.1850398 -0.14254655 1.1578213 ]
|
||||
>>> print(np.arctan(x))
|
||||
[0. 0.7853982 1.1071488 1.2490457 1.3258177]
|
||||
"""
|
||||
x = _cast_type_for_trigonometric(x)
|
||||
return _apply_tensor_op(F.atan, x, dtype=dtype)
|
||||
|
|
Loading…
Reference in New Issue