Mish#

  • Domain: ai.onnx

  • Since version: 22

Mish: A Self Regularized Non-Monotonic Neural Activation Function.

Perform the linear unit element-wise on the input tensor X using formula:

mish(x) = x * tanh(softplus(x)) = x * tanh(ln(1 + e^{x}))

Inputs

  • X (T): Input tensor

Outputs

  • Y (T): Output tensor

Type Constraints

  • T: Constrain input X and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_mish

Node:
  Mish(X) -> (Y)
Inputs:
  X: shape=(2, 3), dtype=float32
    [[-4., -1.,  0.],
     [ 1.,  2.,  4.]]

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[-0.07259175, -0.30340144,  0.        ],
     [ 0.8650984 ,  1.943959  ,  3.997413  ]]

test_cc_supported_dtype_Mish_BFLOAT16

Node:
  Mish(X) -> (Y)
Inputs:
  X: shape=(5,), dtype=bfloat16
    [-4, -0.5, 0, 0.5, 4]

Outputs:
  Y: shape=(5,), dtype=bfloat16
    [-0.0727539, -0.220703, 0, 0.375, 4]

test_cc_supported_dtype_Mish_DOUBLE

Node:
  Mish(X) -> (Y)
Inputs:
  X: shape=(5,), dtype=float64
    [-4. , -0.5,  0. ,  0.5,  4. ]

Outputs:
  Y: shape=(5,), dtype=float64
    [-0.07259174, -0.22074377,  0.        ,  0.37524521,  3.99741281]

test_cc_supported_dtype_Mish_FLOAT16

Node:
  Mish(X) -> (Y)
Inputs:
  X: shape=(5,), dtype=float16
    [-4. , -0.5,  0. ,  0.5,  4. ]

Outputs:
  Y: shape=(5,), dtype=float16
    [-0.0726, -0.2207,  0.    ,  0.3752,  3.998 ]

Differences with previous version (18)#

SchemaDiff: Mish (domain 'ai.onnx')

  • old version: 18

  • new version: 22

  • breaking: no

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Version History#