Expm1#

  • Domain: ai.onnx

  • Since version: 29

Computes exp(x) - 1 element-wise, where exp is the exponential to base e. The input may have any shape, including a scalar or an empty tensor. The output has the same shape and element type as the input.

For finite nonzero x, the output is a floating-point approximation of the real-valued function exp(x) - 1 at the exact value represented by x. The computation must preserve nonzero results representable in the output type when an intermediate floating-point exp(x) would round to 1. For example, a FLOAT input 1e-8 produces a result approximately equal to 1e-8, rather than zero.

Special values are defined element-wise as follows:

Input x | Output y |
— | — |
Positive zero | Positive zero |
Negative zero | Negative zero |
Negative infinity | -1 |
Positive infinity | Positive infinity |
NaN | NaN |

The sign and payload of an output NaN are unspecified. Finite positive inputs whose results overflow the output type produce positive infinity.

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The exponential of the input minus one, computed element-wise

Type Constraints

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

Examples#

test_cc_supported_dtype_Expm1_BFLOAT16

Node:
  Expm1(X) -> (Y)
Inputs:
  X: shape=(7,), dtype=bfloat16
    [-2, -0.5, -5.96046e-08, 0, 5.96046e-08, 0.5, 2]

Outputs:
  Y: shape=(7,), dtype=bfloat16
    [-0.863281, -0.392578, -5.96046e-08, 0, 5.96046e-08, 0.648438, 6.375]

test_cc_supported_dtype_Expm1_DOUBLE

Node:
  Expm1(X) -> (Y)
Inputs:
  X: shape=(7,), dtype=float64
    [-2.00000000e+00, -5.00000000e-01, -5.96046448e-08,  0.00000000e+00,
      5.96046448e-08,  5.00000000e-01,  2.00000000e+00]

Outputs:
  Y: shape=(7,), dtype=float64
    [-8.64664717e-01, -3.93469340e-01, -5.96046430e-08,  0.00000000e+00,
      5.96046466e-08,  6.48721271e-01,  6.38905610e+00]

test_cc_supported_dtype_Expm1_FLOAT16

Node:
  Expm1(X) -> (Y)
Inputs:
  X: shape=(7,), dtype=float16
    [-2.e+00, -5.e-01, -6.e-08,  0.e+00,  6.e-08,  5.e-01,  2.e+00]

Outputs:
  Y: shape=(7,), dtype=float16
    [-8.647e-01, -3.936e-01, -5.960e-08,  0.000e+00,  5.960e-08,  6.489e-01,
      6.391e+00]

test_cc_supported_dtype_Expm1_empty_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(0, 3), dtype=bfloat16
    []

Outputs:
  y: shape=(0, 3), dtype=bfloat16
    []

test_cc_supported_dtype_Expm1_empty_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(0, 3), dtype=float16
    []

Outputs:
  y: shape=(0, 3), dtype=float16
    []

test_cc_supported_dtype_Expm1_empty_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(0, 3), dtype=float32
    []

Outputs:
  y: shape=(0, 3), dtype=float32
    []

test_cc_supported_dtype_Expm1_empty_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(0, 3), dtype=float64
    []

Outputs:
  y: shape=(0, 3), dtype=float64
    []

test_cc_supported_dtype_Expm1_finite_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2, 4), dtype=bfloat16
    [[-10, -0.5, 0, 0.25],
     [0.5, 1, 3, 5]]

Outputs:
  y: shape=(2, 4), dtype=bfloat16
    [[-1, -0.392578, 0, 0.283203],
     [0.648438, 1.71875, 19.125, 147]]

test_cc_supported_dtype_Expm1_finite_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2, 4), dtype=float16
    [[-10.  ,  -0.5 ,   0.  ,   0.25],
     [  0.5 ,   1.  ,   3.  ,   5.  ]]

Outputs:
  y: shape=(2, 4), dtype=float16
    [[ -1.    ,  -0.3936,   0.    ,   0.284 ],
     [  0.649 ,   1.719 ,  19.08  , 147.4   ]]

test_cc_supported_dtype_Expm1_finite_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2, 4), dtype=float32
    [[-10.  ,  -0.5 ,   0.  ,   0.25],
     [  0.5 ,   1.  ,   3.  ,   5.  ]]

Outputs:
  y: shape=(2, 4), dtype=float32
    [[ -0.9999546 ,  -0.39346933,   0.        ,   0.28402543],
     [  0.6487213 ,   1.7182819 ,  19.085537  , 147.41316   ]]

test_cc_supported_dtype_Expm1_finite_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2, 4), dtype=float64
    [[-10.  ,  -0.5 ,   0.  ,   0.25],
     [  0.5 ,   1.  ,   3.  ,   5.  ]]

Outputs:
  y: shape=(2, 4), dtype=float64
    [[ -0.9999546 ,  -0.39346934,   0.        ,   0.28402542],
     [  0.64872127,   1.71828183,  19.08553692, 147.4131591 ]]

test_cc_supported_dtype_Expm1_overflow_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2,), dtype=bfloat16
    [1000, -1000]

Outputs:
  y: shape=(2,), dtype=bfloat16
    [inf, -1]

test_cc_supported_dtype_Expm1_overflow_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2,), dtype=float16
    [ 1.e+03, -1.e+03]

Outputs:
  y: shape=(2,), dtype=float16
    [inf, -1.]

test_cc_supported_dtype_Expm1_overflow_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2,), dtype=float32
    [ 1000., -1000.]

Outputs:
  y: shape=(2,), dtype=float32
    [inf, -1.]

test_cc_supported_dtype_Expm1_overflow_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(2,), dtype=float64
    [ 1000., -1000.]

Outputs:
  y: shape=(2,), dtype=float64
    [inf, -1.]

test_cc_supported_dtype_Expm1_scalar_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(), dtype=bfloat16
    1

Outputs:
  y: shape=(), dtype=bfloat16
    1.71875

test_cc_supported_dtype_Expm1_scalar_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(), dtype=float16
    1.

Outputs:
  y: shape=(), dtype=float16
    1.719

test_cc_supported_dtype_Expm1_scalar_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(), dtype=float32
    1.

Outputs:
  y: shape=(), dtype=float32
    1.7182819

test_cc_supported_dtype_Expm1_scalar_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(), dtype=float64
    1.

Outputs:
  y: shape=(), dtype=float64
    1.71828183

test_cc_supported_dtype_Expm1_small_inputs_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(4,), dtype=bfloat16
    [-0.000976562, -0, 0, 0.000976562]

Outputs:
  y: shape=(4,), dtype=bfloat16
    [-0.000976562, -0, 0, 0.000976562]

test_cc_supported_dtype_Expm1_small_inputs_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float16
    [-6.104e-05, -0.000e+00,  0.000e+00,  6.104e-05]

Outputs:
  y: shape=(4,), dtype=float16
    [-6.104e-05, -0.000e+00,  0.000e+00,  6.104e-05]

test_cc_supported_dtype_Expm1_small_inputs_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float32
    [-1.e-08, -0.e+00,  0.e+00,  1.e-08]

Outputs:
  y: shape=(4,), dtype=float32
    [-1.e-08, -0.e+00,  0.e+00,  1.e-08]

test_cc_supported_dtype_Expm1_small_inputs_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float64
    [-1.e-20, -0.e+00,  0.e+00,  1.e-20]

Outputs:
  y: shape=(4,), dtype=float64
    [-1.e-20, -0.e+00,  0.e+00,  1.e-20]

test_cc_supported_dtype_Expm1_special_values_bfloat16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(5,), dtype=bfloat16
    [-0, 0, -inf, inf, nan]

Outputs:
  y: shape=(5,), dtype=bfloat16
    [-0, 0, -1, inf, nan]

test_cc_supported_dtype_Expm1_special_values_float16

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(5,), dtype=float16
    [ -0.,   0., -inf,  inf,  nan]

Outputs:
  y: shape=(5,), dtype=float16
    [-0.,  0., -1., inf, nan]

test_cc_supported_dtype_Expm1_special_values_float32

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(5,), dtype=float32
    [ -0.,   0., -inf,  inf,  nan]

Outputs:
  y: shape=(5,), dtype=float32
    [-0.,  0., -1., inf, nan]

test_cc_supported_dtype_Expm1_special_values_float64

Node:
  Expm1(x) -> (y)
Inputs:
  x: shape=(5,), dtype=float64
    [ -0.,   0., -inf,  inf,  nan]

Outputs:
  y: shape=(5,), dtype=float64
    [-0.,  0., -1., inf, nan]