mindspore.ops.Mish
- class mindspore.ops.Mish[源代码]
Computes MISH(A Self Regularized Non-Monotonic Neural Activation Function) of input tensors element-wise.
The function is shown as follows:
\[\text{output} = x * \tan(\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.
- Supported Platforms:
Ascend
- Raises
TypeError – If dtype of x is neither float16 nor float32.
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.30273438 3.9974136 -0.015625] [ 1.9439697 -0.02929688 8.999999]]