Function: This API is the reverse of the repeatInterleave operator. It performs ReduceSum on the axis dimension of the yGrad tensor based on the repeats.
Example: Assume that the ([[a[object Object]1[object Object], b[object Object]1[object Object], c[object Object]1[object Object], d[object Object]1[object Object], e[object Object]1[object Object], f[object Object]1[object Object]], [a[object Object]2[object Object], b[object Object]2[object Object], c[object Object]2[object Object], d[object Object]2[object Object], e[object Object]2[object Object], f[object Object]2[object Object]]]), repeats of tensor yGrad is [1, 2, 2, 1] and the axis is 1. The final generated tensor is tensor([[a[object Object]1[object Object], b[object Object]1[object Object] + c[object Object]1[object Object], d[object Object]1[object Object] + e[object Object]1[object Object], f[object Object]1[object Object]], [a[object Object]2[object Object], b[object Object]2[object Object] + c[object Object]2[object Object], d[object Object]2[object Object] + e[object Object]2[object Object], f[object Object]2[object Object]]]). ReduceSum is performed on the axis of tensor yGrad based on repeats.
Assume that the tensor yGrad is ([[a[object Object]1[object Object], b[object Object]1[object Object], c[object Object]1[object Object], d[object Object]1[object Object], e[object Object]1[object Object], f[object Object]1[object Object]], [a[object Object]2[object Object], b[object Object]2[object Object], c[object Object]2[object Object], d[object Object]2[object Object], e[object Object]2[object Object], f[object Object]2[object Object]]]), repeats ([2]) and the axis is 1. The final generated tensor is tensor([[a[object Object]1[object Object] + b[object Object]1[object Object], c[object Object]1[object Object] + d[object Object]1[object Object], e[object Object]1[object Object] + f[object Object]1[object Object], , [a[object Object]2[object Object] + b[object Object]2[object Object], c[object Object]2[object Object] + d[object Object]2[object Object], e[object Object]2[object Object] + f[object Object]2[object Object]]]]). ReduceSum is performed on every two axes of tensor yGrad based on the value of repeats. Note: This scenario is equivalent to repeats being (2).
Each operator has calls. First, [object Object] is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, [object Object] is called to perform computation.
Parameters
[object Object]- Ascend 950PR/Ascend 950DT: The data type of yGrad can be FLOAT16, BFLOAT16, or FLOAT.
Returns
[object Object]: status code. For details, see .The first-phase API implements input parameter validation. The following error codes may be returned.
[object Object]
- Deterministic computation:
- The aclnnRepeatInterleaveGrad is implemented in deterministic mode by default.
The following conditions must be met during computation:
- If repeats is a 0D tensor or a 1D tensor with a size of 1, the element value of repeats must be a divisor of the dimension of yGrad on axis. If repeats is a 1D tensor with a size greater than 1, the sum of the elements of repeats must be the dimension of yGrad on axis. The value in the repeats tensor must be a natural number.
- The shape of out must be the same as that of yGrad after ReduceSum is performed on the axis. For example, if the shape of yGrad is [64], the value of repeat is [2], and the value of axis is 0, the shape of out can be [32], [2, 16], or [2, 4, 4], as long as the shape of out is 32.
The following example is for reference only. For details, see .