Operator description: Performs backpropagation of . RoiAlign is a pooling layer used to input a feature map with a non-uniform size and output a fixed-size feature map.
Each operator has calls. First, aclnnRoiAlignV2BackwardGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnRoiAlignV2Backward is called to perform computation.
[object Object][object Object]
Parameters:
gradOutput (aclTensor*, compute input): input of backpropagation. aclTensor on the device. The data type can be FLOAT, which must be the same as those of boxes and gradInput. are supported. The can be NCHW. The shape is 4D (K, C, pooledHeight, pooledWidth), indicating that the input gradient tensor for backpropagation has K elements in a batch, and each element has C feature maps whose size is pooledHeight * pooledWidth. K must be the same as the 0th dimension of boxes.
boxes (aclTensor*, compute input): box coordinates of the ROI. aclTensor on the device. The data type can be FLOAT, which must be the same as that of gradOutput and gradInput. are supported. The can be ND. The shape is 2D (K, 5), where 5 indicates the box information (image_id, x1, y1, x2, y2). The value range of image_id is [0, B), rounded down to an integer multiple of the image ID. B is the first value of inputShape. The coordinates must meet these requirements: 0 ≤ x1 ≤ x2 ≤ inputWidth/spatialScale and 0 ≤ y1 ≤ y2 ≤ inputHeight/spatialScale.
inputShape (aclIntArray*, compute input): shape of the forward input, which is used to specify the shape of the backpropagation output. aclIntArray on the host. The supported data types are INT32 and INT64. The size is 4, and the shape is (B, C, inputHeight, inputWidth), indicating that the forward RoiAlign input tensor has B images in a batch, and each image has C feature maps whose size is inputHeight * inputWidth.
pooledHeight (int64_t, compute input): height of the output image after forward RoiAlign pooling. It is an input parameter on the host.
pooledWidth (int64_t, compute input): width of the output image after forward RoiAlign pooling. It is an input parameter on the host.
spatialScale (float, compute input): multiplication spatial scale factor. It is used to convert the ROI coordinates from the input spatial scale to the scale used for pooling, that is, the spatial scale of the input feature map X relative to the input image. It is an input parameter on the host. The value must be greater than 0.
samplingRatio (int64_t, compute input): sampling frequency for calculating each output element in the H and W directions in RoiAlign. It is an input parameter on the host. The value must be greater than or equal to 0.
aligned (bool, compute input): If the value is false, is implemented. If the value is true, the box coordinates are pixel shifted by -0.5 to better align adjacent pixel indexes. It is an input parameter on the host.
gradInput (aclTensor*, compute output): output of backpropagation. aclTensor on the device. The data type can be FLOAT, which must be the same as that of gradOutput and boxes. are supported. The can be NCHW. The shape is 4D (B, C, inputHeight, inputWidth).
workspaceSize (uint64_t*, output): size of the workspace to be allocated on the device.
executor (aclOpExecutor**, output): operator executor, containing the operator computation process.
Returns:
Parameters:
workspace (void*, input): address of the workspace to be allocated on the device.
workspaceSize (uint64_t, input): size of the workspace to be allocated on the device, which is obtained by the first-phase API aclnnRoiAlignV2BackwardGetWorkspaceSize.
executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computing:
- aclnnRoiAlignV2Backward defaults to a non-deterministic implementation. You can call aclrtCtxSetSysParamOpt to enable deterministic computing.
The following example is for reference only. For details, see .