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 is calculated as follows:
...
, where .
High-dimensional tensor (using a two-dimensional tensor as an example, dim=0 along the row direction)
For a two-dimensional tensor:
The result tensor after calculation is as follows:
For the first column (j = 1):
Therefore, for any column j, the following rule also applies:
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:
Other parameters can be deduced based on the preceding rules.
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]
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
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
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
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
- Deterministic computation:
[object Object]and[object Object]default to a deterministic implementation.
The following example is for reference only. For details, see .