This commit is contained in:
Henry 2023-02-08 19:19:34 +08:00
parent 8876c073bb
commit 986dd61e79
2 changed files with 13 additions and 16 deletions

View File

@ -6245,7 +6245,7 @@ def _get_moved_perm(ndim, source, destination):
from source to destination.
"""
dest_sorted_idx = [i for i, _ in sorted(enumerate(destination), key=operator.itemgetter(1))]
axis_orig = [i for i in np.arange(ndim) if i not in source]
axis_orig = [i for i in builtins.range(0, ndim) if i not in source]
k = 0
m = 0
@ -6310,21 +6310,7 @@ def moveaxis(x, source, destination):
"""
Alias for `ops.movedim`. Moves axis of an array from source to destination.
Other axis remain in their original order.
Args:
x (Tensor): The array whose axis should be reordered.
source (Union[int, sequence[int]]): Original positions of the
axis to move. These must be unique.
destination (Union[int, sequence[int]]): Destination positions
for each of the original axis. These must also be unique.
Returns:
Tensor, array with moved axis.
Raises:
ValueError: If axis are out of the range of [-a.ndim, a.ndim), or
if the axis contain duplicates.
Refer to :func:`mindspore.ops.movedim` for more detail.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``

View File

@ -2254,6 +2254,17 @@ def silu(x):
where :math:`x_i` is an element of the x.
For more details, please refer to :class:`mindspore.nn.SiLU`.
Supported Platforms:
``Ascend`` ``GPU`` ``CPU``
Examples:
>>> import mindspore
>>> from mindspore import Tensor, ops
>>> x = Tensor(np.array([-1, 2, -3, 2, -1]), mindspore.float16)
>>> output = ops.silu(x)
>>> print(output)
[-0.269 1.762 -0.1423 1.762 -0.269]
"""
return sigmoid_(x) * x