CumulativeLogsumexp
English | 简体中文
Product Support Status
| Product | Supported |
|---|---|
| Ascend 950PR&950DT products | √ |
| Atlas A3 products | × |
| Atlas A2 products | × |
| Atlas 200I/500 A2 inference products | × |
| Atlas inference products | × |
| Atlas training products | × |
Function Description
- Operator function: computes the cumulative log-sum-exp of the input tensor
xalong the dimension specified byaxisand saves the result to the output tensory. - Computation formula: let ii be the subscript on the
axisdimension, and SiS_i be the set of prefix or suffix subscripts involved in computing the ii-th output element, then:
yi=log∑j∈Siexjy_i = \log \sum_{j \in S_i} e^{x_j}
When exclusive is false, SiS_i includes the current position; when exclusive is true, SiS_i does not include the current position. When reverse is false, accumulation proceeds in the direction of increasing subscripts; when reverse is true, accumulation proceeds in the direction of decreasing subscripts.
Parameter Description
| Parameter Name | Input/Output/Attribute | Description | Data Type | Data Format |
|---|---|---|---|---|
| x | Input | Input Tensor. The shape supports 1 to 6 dimensions, and the length of the dimension specified by axis must be greater than 0. | FLOAT, FLOAT16 | ND |
| axis | Input | The dimension along which the cumulative log-sum-exp is computed. It must be a compile-time constant scalar, and the value range is [-rank(x), rank(x)-1]. | INT32, INT64, INT16 | ND |
| exclusive | Attribute | The default value is false. false indicates that the current position is included; true indicates that the current position is not included. | BOOL | - |
| reverse | Attribute | The default value is false. false indicates forward accumulation; true indicates backward accumulation. | BOOL | - |
| y | Output | Output Tensor, whose shape is the same as that of x. | FLOAT, FLOAT16 | ND |
Constraint Description
axismust be a constant scalar.xdoes not support scalar input. A parameter error is returned when the length of the dimension specified byaxisis 0.- The shape and data type of
ymust be the same as those ofx.
Invocation Description
| Invocation Method | Sample Code | Description |
|---|---|---|
| Graph-mode invocation | test_geir_cumulative_logsumexp.cpp | Invokes the CumulativeLogsumexp operator by building a graph through the operator IR. |