mindspore.ops.Mish
- class mindspore.ops.Mish[source]
Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise.
The function is shown as follows:
\[\text{output} = x * \tanh(\log(1 + \exp(\text{x})))\]See more details in A Self Regularized Non-Monotonic Neural Activation Function.
- Inputs:
x (Tensor) - Tensor of shape \((N, *)\), where \(*\) means, any number of additional dimensions, with float16 or float32 data type.
- Outputs:
Tensor, with the same type and shape as the x.
- Raises
TypeError – If dtype of x is neither float16 nor float32.
- Supported Platforms:
Ascend
GPU
CPU
Examples
>>> x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32) >>> mish = ops.Mish() >>> output = mish(x) >>> print(output) [[-0.3034014 3.9974129 -0.0026832] [ 1.9439590 -0.0033576 9.0000000]]