LogCumSumExp#

  • Domain: ai.onnx

  • Since version: 29

Computes inclusive, forward cumulative log-sum-exp along axis (default 0). X must have rank >= 1 and axis must be in [-rank(X), rank(X)-1]. Y has the same shape and type as X; empty dimensions produce an empty output. NaN propagates through each prefix, positive infinity dominates finite values, and an all-negative-infinity prefix produces negative infinity. Stable accumulation uses at least float32 for float16, bfloat16 and float32, and float64 for float64, without rounding the intermediate state to Y’s type.

Inputs

  • X (T): Floating-point input tensor of rank at least one. Dimensions may be zero.

Outputs

  • Y (T): Tensor with the same shape and element type as X, containing inclusive cumulative log-sum-exp values.

Attributes

  • axis (int): Axis along which to compute the cumulative sum. Defaults to 0.

Type Constraints

  • T: Input and output have the same floating-point element type. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_logcumsumexp_axis_-1

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = -1
Inputs:
  x: shape=(2, 3), dtype=float64
    [[0., 0., 0.],
     [0., 0., 0.]]

Outputs:
  y: shape=(2, 3), dtype=float64
    [[0.        , 0.69314718, 1.09861229],
     [0.        , 0.69314718, 1.09861229]]

test_cc_logcumsumexp_axis_-2

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = -2
Inputs:
  x: shape=(2, 3), dtype=float64
    [[0., 0., 0.],
     [0., 0., 0.]]

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

test_cc_logcumsumexp_axis_0

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 0
Inputs:
  x: shape=(2, 3), dtype=float64
    [[0., 0., 0.],
     [0., 0., 0.]]

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

test_cc_logcumsumexp_axis_1

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 1
Inputs:
  x: shape=(2, 3), dtype=float64
    [[0., 0., 0.],
     [0., 0., 0.]]

Outputs:
  y: shape=(2, 3), dtype=float64
    [[0.        , 0.69314718, 1.09861229],
     [0.        , 0.69314718, 1.09861229]]

test_cc_logcumsumexp_default_dtype_1

Node:
  LogCumSumExp(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float32
    [0., 0., 0., 0.]

Outputs:
  y: shape=(4,), dtype=float32
    [0.       , 0.6931472, 1.0986123, 1.3862944]

test_cc_logcumsumexp_default_dtype_10

Node:
  LogCumSumExp(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float16
    [0., 0., 0., 0.]

Outputs:
  y: shape=(4,), dtype=float16
    [0.    , 0.6934, 1.099 , 1.387 ]

test_cc_logcumsumexp_default_dtype_11

Node:
  LogCumSumExp(x) -> (y)
Inputs:
  x: shape=(4,), dtype=float64
    [0., 0., 0., 0.]

Outputs:
  y: shape=(4,), dtype=float64
    [0.        , 0.69314718, 1.09861229, 1.38629436]

test_cc_logcumsumexp_default_dtype_16

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

Outputs:
  y: shape=(4,), dtype=bfloat16
    [0, 0.691406, 1.10156, 1.38281]

test_cc_logcumsumexp_dynamic_range

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = -1
Inputs:
  x: shape=(2, 3), dtype=float64
    [[ 1000.,  1000., -1000.],
     [-1000., -1000.,  1000.]]

Outputs:
  y: shape=(2, 3), dtype=float64
    [[ 1000.        ,  1000.69314718,  1000.69314718],
     [-1000.        ,  -999.30685282,  1000.        ]]

test_cc_logcumsumexp_empty_axis_0

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 0
Inputs:
  x: shape=(2, 0, 3), dtype=float32
    []

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

test_cc_logcumsumexp_empty_axis_1

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 1
Inputs:
  x: shape=(2, 0, 3), dtype=float32
    []

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

test_cc_logcumsumexp_empty_axis_2

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 2
Inputs:
  x: shape=(2, 0, 3), dtype=float32
    []

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

test_cc_logcumsumexp_special_values

Node:
  LogCumSumExp(x) -> (y)
  Attributes:
    axis = 0
Inputs:
  x: shape=(6,), dtype=float32
    [-inf, -inf,   0.,  inf,  nan,   1.]

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