fix docstring

pull/12888/head
huangmengxi 4 years ago committed by yanglf1121
parent 609a518068
commit 59810d69b2

@ -530,11 +530,12 @@ def logspace(start, stop, num=50, endpoint=True, base=10.0, dtype=None, axis=0):
start) and ends with base ** stop (see endpoint below).
Args:
start (Union[int, list(int), tuple(int), tensor]): The starting value of the sequence.
stop (Union[int, list(int), tuple(int), tensor]): The end value of the sequence,
unless `endpoint` is set to False. In that case, the sequence consists
of all but the last of `num + 1` evenly spaced samples, so that `stop`
is excluded. Note that the step size changes when `endpoint` is False.
start (Union[int, list(int), tuple(int), tensor]): ``base ** start`` is the starting
value of the sequence.
stop (Union[int, list(int), tuple(int), tensor]): ``base ** stop`` is the final value of
the sequence, unless `endpoint` is False. In that case, ``num + 1`` values are spaced
over the interval in log-space, of which all but the last (a sequence of length num)
are returned.
num (int, optional): Number of samples to generate. Default is 50.
endpoint (bool, optional): If True, `stop` is the last sample. Otherwise, it is
not included. Default is True.

@ -809,13 +809,13 @@ def atleast_1d(*arys):
>>> c = np.ones(5)
>>> output = np.atleast_1d(a, b, c)
>>> print(output)
(Tensor(shape=[2, 3], dtype=Float32, value=
[Tensor(shape=[2, 3], dtype=Float32, value=
[[1.00000000e+000, 1.00000000e+000, 1.00000000e+000],
[1.00000000e+000, 1.00000000e+000, 1.00000000e+000]]),
Tensor(shape=[1], dtype=Float32, value= [1.00000000e+000]),
Tensor(shape=[5], dtype=Float32,
value= [1.00000000e+000, 1.00000000e+000, 1.00000000e+000,
1.00000000e+000, 1.00000000e+000]))
1.00000000e+000, 1.00000000e+000])]
"""
return _atleast_xd(1, arys)
@ -846,13 +846,13 @@ def atleast_2d(*arys):
>>> c = np.ones(5)
>>> output = np.atleast_2d(a, b, c)
>>> print(output)
(Tensor(shape=[2, 3], dtype=Float32, value=
[Tensor(shape=[2, 3], dtype=Float32, value=
[[1.00000000e+000, 1.00000000e+000, 1.00000000e+000],
[1.00000000e+000, 1.00000000e+000, 1.00000000e+000]]),
Tensor(shape=[1, 1], dtype=Float32, value= [[1.00000000e+000]]),
Tensor(shape=[1, 5], dtype=Float32,
value= [[1.00000000e+000, 1.00000000e+000, 1.00000000e+000,
1.00000000e+000, 1.00000000e+000]]))
1.00000000e+000, 1.00000000e+000]])]
"""
return _atleast_xd(2, arys)
@ -886,13 +886,13 @@ def atleast_3d(*arys):
>>> c = np.ones(5)
>>> output = np.atleast_3d(a, b, c)
>>> print(output)
(Tensor(shape=[2, 3, 1], dtype=Float32, value=
[Tensor(shape=[2, 3, 1], dtype=Float32, value=
[[[1.00000000e+000], [1.00000000e+000], [1.00000000e+000]],
[[1.00000000e+000], [1.00000000e+000], [1.00000000e+000]]]),
Tensor(shape=[1, 1, 1], dtype=Float32, value= [[[1.00000000e+000]]]),
Tensor(shape=[1, 5, 1], dtype=Float32,
value= [[[1.00000000e+000], [1.00000000e+000], [1.00000000e+000],
[1.00000000e+000], [1.00000000e+000]]]))
[1.00000000e+000], [1.00000000e+000]]])]
"""
res = []
for arr in arys:
@ -1378,7 +1378,7 @@ def split(x, indices_or_sections, axis=0):
Examples:
>>> import mindspore.numpy as np
>>> input_x = np.arange(9)
>>> input_x = np.arange(9).astype('float32')
>>> output = np.split(input_x, 3)
>>> print(output)
(Tensor(shape=[3], dtype=Float32,
@ -1455,7 +1455,7 @@ def vsplit(x, indices_or_sections):
Examples:
>>> import mindspore.numpy as np
>>> input_x = np.arange(9).reshape((3, 3))
>>> input_x = np.arange(9).reshape((3, 3)).astype('float32')
>>> output = np.vsplit(input_x, 3)
>>> print(output)
(Tensor(shape=[1, 3], dtype=Float32,
@ -1497,7 +1497,7 @@ def hsplit(x, indices_or_sections):
Examples:
>>> import mindspore.numpy as np
>>> input_x = np.arange(6).reshape((2, 3))
>>> input_x = np.arange(6).reshape((2, 3)).astype('float32')
>>> output = np.hsplit(input_x, 3)
>>> print(output)
(Tensor(shape=[2, 1], dtype=Float32,
@ -1542,7 +1542,7 @@ def dsplit(x, indices_or_sections):
Examples:
>>> import mindspore.numpy as np
>>> input_x = np.arange(6).reshape((1, 2, 3))
>>> input_x = np.arange(6).reshape((1, 2, 3)).astype('float32')
>>> output = np.dsplit(input_x, 3)
>>> print(output)
(Tensor(shape=[1, 2, 1], dtype=Float32,

@ -1474,10 +1474,10 @@ def log(x, out=None, where=True, dtype=None):
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> x = np.array([1, 2, 3]).astype('float32')
>>> x = np.array([2, 3, 4]).astype('float32')
>>> output = np.log(x)
>>> print(output)
[1.09861 1.3862929 1.6094407]
[0.69314575 1.09861 1.3862929 ]
"""
return _apply_tensor_op(F.log, x, out=out, where=where, dtype=dtype)
@ -1718,8 +1718,8 @@ def amin(a, axis=None, keepdims=False, initial=None, where=True):
[0. 1.]
>>> output = np.amin(a, axis=1)
>>> print(output)
[1. 3.]
>>> output = np.amax(a, where=np.array([False, True]), initial=10, axis=0)
[0, 2]
>>> output = np.amin(a, where=np.array([False, True]), initial=10, axis=0)
>>> print(output)
[10. 1.]
"""
@ -2288,10 +2288,10 @@ def positive(a, out=None, where=True, dtype=None):
Examples:
>>> import mindspore.numpy as np
>>> a = np.asarray([1, -1])
>>> a = np.asarray([1, -1]).astype('float32')
>>> output = np.positive(a)
>>> print(output)
[1, -1]
[1. -1.]
"""
_check_input_tensor(a)
neg_tensor = F.neg_tensor(a)
@ -2328,10 +2328,10 @@ def negative(a, out=None, where=True, dtype=None):
Examples:
>>> import mindspore.numpy as np
>>> a = np.asarray([1, -1])
>>> a = np.asarray([1, -1]).astype('float32')
>>> output = np.negative(a)
>>> print(output)
[-1, 1]
[-1. 1.]
"""
_check_input_tensor(a)
return _apply_tensor_op(F.neg_tensor, a, out=out, where=where, dtype=dtype)

Loading…
Cancel
Save