mindspore.ops.Mish

class mindspore.ops.Mish(*args, **kwargs)[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 * \tan(\log(1 + \exp(\text{x})))\]

See more details in A Self Regularized Non-Monotonic Neural Activation Function.

Inputs:
  • x (Tensor) - The input tensor. Only support float16 and float32.

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

>>> input_x = Tensor(np.array([[-1.0, 4.0, -8.0], [2.0, -5.0, 9.0]]), mindspore.float32)
>>> mish = ops.Mish()
>>> output = mish(input_x)
>>> print(output)
[[-0.30273438  3.9974136 -0.015625]
 [ 1.9439697  -0.02929688 8.999999]]