Function: implements the reverse function of the Unfold operator and calculates the corresponding 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.Example:
[object Object]
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]Returns:
[object Object]: status code. For details, see .The first-phase API implements input parameter verification. The following errors may be thrown:
[object Object]
- Deterministic computing:
[object Object]defaults to a deterministic implementation.
- The shape of
[object Object]must meet the following constraints:- The dimth dimension of gradOut is equal to (inputSizes[dim] – size)/step + 1.
- The size of gradOut is equal to the size of inputSizes plus 1.
- Requirements for
[object Object],[object Object], and[object Object]:- The size is greater than 0 and less than or equal to the dimth dimension of inputSizes.
- The step is greater than 0.
- The dim is equal to len(inputSizes) – 1 or len(inputSizes) – 2.
- When dim is equal to len(inputSizes) – 1, the step and size are greater than 49088 for the fp32 data type. For the fp16 data type, the step and size are greater than 32720.
- When dim is equal to len(inputSizes) – 2, the step and size are greater than 88 for the fp32 data type. For the fp16 data type, the step and size are greater than 72.
The following example is for reference only. For details, see .