Description: Performs backpropagation of the Unfold operator and computes its gradient.
The Unfold operator computes all slices whose size is [object Object] in dimension [object Object] based on the input parameter [object Object]. The step between two slices is given by [object Object]. If [object Object] is the size of dimension [object Object] of the input parameter self, the size of dimension [object Object] in the returned tensor is . An additional dimension whose size is [object Object] is added to the returned tensor.
The shape of the input [object Object] of the UnfoldGrad operator is the shape of the forward output of the Unfold operator. The shape of the input [object Object] is the shape of the forward input [object Object] of the Unfold operator. The shape of the output [object Object] of the UnfoldGrad operator is the shape of the forward input [object Object] of the Unfold operator.
Examples:
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.
[object Object][object Object]
Parameters
[object Object](aclTensor*, compute input):[object Object]on the device, indicating the gradient update coefficient. The shape is (..., (sizedim – size)/step + 1, size). The[object Object]dimension of[object Object]must be equal to , and the size of[object Object]must be equal to size of inputSizes plus 1. The data type can be FLOAT, FLOAT16, or BFLOAT16. The can be ND.[object Object](aclIntArray*, compute input):[object Object]on the host, indicating the shape of the output tensor. The value is (..., sizedim). The size of[object Object]is less than or equal to 8. The data type can be INT64. The can be ND.[object Object](int64_t, compute input):[object Object]in the formula. Dimension.[object Object]must be greater than or equal to 0 and less than the size of[object Object].[object Object](int64_t, compute input):[object Object]in the formula. Size of each slice.[object Object]must be greater than 0 and less than or equal to the[object Object]dimension of[object Object].[object Object](int64_t, compute input):[object Object]in the formula. Indicates the step between slices. The value of[object Object]must be greater than 0.[object Object](aclTensor*, computation output): gradient of Unfold. It is[object Object]on the device. The shape is[object Object]. The data type can be FLOAT, FLOAT16, or BFLOAT16, and must be the same as that of gradOut.[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 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 computing:
[object Object]defaults to a deterministic implementation.
- The shape of
[object Object]must meet the following constraints: (1) The[object Object]dimension of[object Object]is equal to (inputSizes[dim] – size)/step + 1. (2) The[object Object]of[object Object]is equal to the size of[object Object]plus 1. - Requirements for
[object Object],[object Object], and[object Object]: (1)[object Object]must be greater than or equal to 0 and less than the[object Object]of[object Object]. (2)[object Object]must be greater than 0 and less than or equal to the[object Object]dimension of[object Object]. (3)[object Object]is greater than 0. (4)[object Object]and[object Object]are less than or equal to 100.
The following example is for reference only. For details, see .