forked from mindspore-Ecosystem/mindspore
modify flip docs
This commit is contained in:
parent
aacab0ca60
commit
c109c01f13
|
@ -8,11 +8,11 @@ mindspore.ops.flip
|
|||
Tensor的shape会被保留,但是元素将重新排序。
|
||||
|
||||
参数:
|
||||
- **x** (Tensor) - 输入tensor。
|
||||
- **x** (Tensor) - 输入Tensor。
|
||||
- **dims** (Union[list[int], tuple[int]]) - 需要翻转的一个轴或多个轴。在元组中指定的所有轴上执行翻转,如果 `dims` 是一个包含负数的整数元组,则该轴为按倒序计数的轴位置。
|
||||
|
||||
返回:
|
||||
返回沿给定轴翻转计算结果的tensor。
|
||||
返回沿给定轴翻转计算结果的Tensor。
|
||||
|
||||
异常:
|
||||
- **TypeError** - `x` 不是Tensor。
|
||||
|
|
|
@ -1777,13 +1777,13 @@ def flip(x, dims):
|
|||
>>> import mindspore as ms
|
||||
>>> import mindspore.ops as ops
|
||||
>>> import numpy as np
|
||||
>>> x = ms.Tensor(np.arange(8).reshape((2, 2, 2)))
|
||||
>>> x = ms.Tensor(np.arange(1, 9).reshape((2, 2, 2)))
|
||||
>>> output = ops.flip(x, (0, 2))
|
||||
>>> print(output)
|
||||
[[[5. 4.]
|
||||
[7. 6.]]
|
||||
[[1. 0.]
|
||||
[3. 2.]]]
|
||||
[[[6 5]
|
||||
[8 7]]
|
||||
[[2 1]
|
||||
[4 3]]]
|
||||
"""
|
||||
_check_input_tensor("flip", x)
|
||||
ndim = ops.rank(x)
|
||||
|
@ -1819,13 +1819,13 @@ def flipud(x):
|
|||
>>> import mindspore as ms
|
||||
>>> import mindspore.ops as ops
|
||||
>>> import numpy as np
|
||||
>>> x = ms.Tensor(np.arange(8).reshape((2, 2, 2)))
|
||||
>>> x = ms.Tensor(np.arange(1, 9).reshape((2, 2, 2)))
|
||||
>>> output = ops.flipud(x)
|
||||
>>> print(output)
|
||||
[[[4. 5.]
|
||||
[6. 7.]]
|
||||
[[0. 1.]
|
||||
[2. 3.]]]
|
||||
[[[5 6]
|
||||
[7 8]]
|
||||
[[1 2]
|
||||
[3 4]]]
|
||||
"""
|
||||
return flip(x, (0,))
|
||||
|
||||
|
@ -1851,13 +1851,13 @@ def fliplr(x):
|
|||
>>> import mindspore as ms
|
||||
>>> import mindspore.ops as ops
|
||||
>>> import numpy as np
|
||||
>>> x = ms.Tensor(np.arange(8).reshape((2, 2, 2)))
|
||||
>>> x = ms.Tensor(np.arange(1, 9).reshape((2, 2, 2)))
|
||||
>>> output = ops.fliplr(x)
|
||||
>>> print(output)
|
||||
[[[2. 3.]
|
||||
[0. 1.]]
|
||||
[[6. 7.]
|
||||
[4. 5.]]]
|
||||
[[[3 4]
|
||||
[1 2]]
|
||||
[[7 8]
|
||||
[5 6]]]
|
||||
"""
|
||||
return flip(x, (1,))
|
||||
|
||||
|
|
Loading…
Reference in New Issue