[object Object]

[object Object][object Object]undefined
[object Object]
  • Description: The [object Object] API is added. The [object Object] function calculates the cumulative product of the input tensor along a specified dimension. For example, if a tensor represents a series of values, [object Object] can calculate the product sequence of these values from the start position to the current position.

  • Formulas:

    • One-dimensional tensor (vector)

      For a one-dimensional tensor, the cumulative product y=[y1,y2,y3...,yn]y=[y_1,y_2,y_3...,y_n] is calculated as follows:

      y1=x1y_1=x_1 y2=x1×x2y_2=x_1 \times x_2 y3=x1×x2×x3y_3=x_1 \times x_2\times x_3 ... yn=x1×x2×x3×xny_n=x_1\times x_2\times x_3\times x_n

      yi=j=1ixjy_i=\prod_{j=1}^ix_j, where i=1,2...,ni=1,2...,n.

    • High-dimensional tensor (using a two-dimensional tensor as an example, dim=0 along the row direction)

      For a two-dimensional tensor:

      X=[x11x12...x1mx21x22...x2m............xn1xn2...xnm]X=\begin{bmatrix}x_{11}&x_{12}&...&x_{1m}\\x_{21}&x_{22}&...&x_{2m}\\...&...&...&...&\\x_{n1}&x_{n2}&...&x_{nm}&\end{bmatrix}

      The result tensor after calculation is as follows:

      Y=[y11y12...y1my21y22...y2m............yn1yn2...ynm]Y=\begin{bmatrix}y_{11}&y_{12}&...&y_{1m}\\y_{21}&y_{22}&...&y_{2m}\\...&...&...&...&\\y_{n1}&y_{n2}&...&y_{nm}&\end{bmatrix}

      For the first column (j = 1):

      yi1=x11×x21×...×xi1(fori=1,2,...,n)y_{i1}=x_{11}\times x_{21}\times ...\times x_{i1} (for i = 1, 2,..., n)

      Therefore, for any column j, the following rule also applies:

      yij=k=1ixkjy_{ij}=\prod_{k=1}^{i} x_{kj}
    • High-dimensional tensor (using a two-dimensional tensor as an example, dim=1 along the column direction)

      Therefore, for any column j, the following rule also applies:

      yij=k=1jxiky_{ij}=\prod_{k=1}^{j} x_{ik}
    • Other parameters can be deduced based on the preceding rules.

[object Object]

Each operator has calls. First, [object Object] or [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] or [object Object] is called to perform computation.

  • [object Object]

  • [object Object]

  • [object Object]

  • [object Object]

[object Object]
  • Parameters

    • [object Object] (aclTensor*, computation input): current input value (indicating the data for which the cumulative product needs to be calculated), [object Object] on the device. are supported. Empty tensors are supported. The data type can be FLOAT, FLOAT16, BFLOAT16, DOUBLE, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, or UINT64. The can be ND.
    • [object Object] (aclScalar*, computation input): current input value, specifying the dimension for calculating the cumulative product. For a two-dimensional tensor, [object Object] indicates that the calculation is performed along the row direction, and [object Object] indicates that the calculation is performed along the column direction. It is an [object Object] on the device. The value range is [-rank(input), rank(input)). The data type can be INT32.
    • [object Object] (aclDataType, computation input): data type of the input during computation. If the value is [object Object], the original type of the input is used for computation. If a specific type is specified (within the range of data types supported by the input), the input is converted to this type before computation.
    • [object Object] (aclTensor*, computation output): cumulative product result, [object Object] on the device. The can be ND. When [object Object] is [object Object], the data type must be the same as that of the input. When [object Object] is specified, the data type must be the same as that of [object Object]. The shape of [object Object] must be identical to that of [object Object].
    • [object Object] (uint64_t*, output): size of the workspace to be allocated on the device.
    • [object Object] (aclOpExecutor**, output): operator executor, containing the operator computation process.
  • Returns

    [object Object]: status code. For details, see .

[object Object]
[object Object]
  • Parameters

    • [object Object] (void*, input): address of the workspace to be allocated on the device.
    • [object Object] (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by calling the first-phase API [object Object].
    • [object Object] (aclOpExecutor *, input): operator executor, containing the operator computation process.
    • [object Object] (aclrtStream, input): stream for executing the task.
  • Returns

    [object Object]: status code. For details, see .

[object Object]
  • Parameters

    • [object Object] (aclTensor*, computation input | computation output): input and output tensor for the cumulative product, [object Object] on the device. are supported. Empty tensors are not supported. The data type can be FLOAT, FLOAT16, BFLOAT16, DOUBLE, INT8, INT16, INT32, INT64, UINT8, UINT16, UINT32, or UINT64. The can be ND.
    • [object Object] (aclScalar*, computation input): dimension for calculating the cumulative product. For a two-dimensional tensor, [object Object] indicates that the calculation is performed along the row direction, and [object Object] indicates that the calculation is performed along the column direction. It is an [object Object] on the device. The value range is [-rank(x), rank(x)]. The data type can be INT32.
    • [object Object] (uint64_t*, output): size of the workspace to be allocated on the device.
    • [object Object] (aclOpExecutor*, output): operator executor, containing the operator computation process.
  • Returns

    [object Object]: status code. For details, see .

[object Object]
[object Object]
  • Parameters

    • [object Object] (void*, input): address of the workspace to be allocated on the device.
    • [object Object] (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by calling the first-phase API [object Object].
    • [object Object] (aclOpExecutor *, input): operator executor, containing the operator computation process.
    • [object Object] (aclrtStream, input): stream for executing the task.
  • Returns

    [object Object]: status code. For details, see .

[object Object]
  • Deterministic computation:
    • [object Object] and [object Object] default to a deterministic implementation.
[object Object]

The following example is for reference only. For details, see .

[object Object]