Operator description: 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, aclnnRoiAlignGetWorkspaceSize is called to obtain the workspace size required for computation and the executor that contains the operator computation process. Then, aclnnRoiAlign is called to perform computation.
[object Object][object Object]
Parameters:
self (aclTensor*, compute input): aclTensor on the device. The data type can be FLOAT or FLOAT16, and must be the same as that of rois and out. are supported. The can be NCHW. The shape is (N, C, H, W), which is 4-dimensional.
rois (aclTensor*, compute input): region of interest. aclTensor on the device. The data type can be FLOAT or FLOAT16, and must be the same as that of self and out. are supported. The can be ND. The shape is (numRois, 4), which is 2-dimensional. The coordinates must be in the (x1, y1, x2, y2) format and meet these requirements: 0 ≤ x1 ≤ x2 ≤ W/spatialScale and 0 ≤ y1 ≤ y2 ≤ H/spatialScale.
batchIndices (aclTensor*, compute input): aclTensor on the device. The data type can be INT32. are supported. The can be ND. This parameter indicates the indexes of the images in each batch. The shape is (numRois,), which is 1-dimensional.
out (aclTensor*, compute output): aclTensor on the device. The data type can be FLOAT or FLOAT16, and must be the same as that of self and rois. are supported. The can be NCHW. The shape is (numRois, C, outputHeight, outputWidth), which is 4-dimensional.
mode (char*, compute input): The value can be avg or max. It indicates the pooling mode.
outputHeight (int, compute input): height of the output image. Integer type. The recommended value is 1.
outputWidth (int, compute input): width of the output image. Integer type. The recommended value is 1.
samplingRatio (int, compute input): sampling frequency for calculating each output element in the H and W directions. Integer type. The recommended value is 0.
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. Floating point. The recommended value is 1.0.
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 calling the first-phase API aclnnRoiAlignGetWorkspaceSize.
executor (aclOpExecutor*, input): operator executor, containing the operator computation process.
stream (aclrtStream, input): stream for executing the task.
Returns:
- Deterministic computing:
- aclnnRoiAlign defaults to a deterministic implementation.
The following example is for reference only. For details, see .