acldvppErase
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Description: erases pixels within a specified range in the input image by using a specified value.
Prototype
Each operator has two-phase API calls. First, acldvppEraseGetWorkspaceSize is called to calculate the required workspace size based on the computation process. Then, acldvppErase is called to perform computation. The two-phase APIs are as follows:
- First-phase API:
1acldvppStatus acldvppEraseGetWorkspaceSize(const aclTensor *self, uint32_t top, uint32_t left, uint32_t height, uint32_t width, const aclFloatArray* value, aclTensor *out, uint64_t *workspaceSize, aclOpExecutor **executor)
- Second-phase API:
1acldvppStatus acldvppErase(void *workspace, uint64_t workspaceSize, aclOpExecutor *executor, aclrtStream stream)
acldvppEraseGetWorkspaceSize
- Parameters:
- self: input tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the input tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can be 1 or left empty, and the value of C can be 1 or 3 (1: input GRAY image; 3: input RGB image).
When the data type of a tensor is set to FLOAT, the expected value range is [0, 1].
- top: vertical coordinate of the upper left corner of the area to be erased.
- left: horizontal coordinate of the upper left corner of the area to be erased.
- height: height of the area to be erased.
- width: width of the area to be erased.
- value: pixel filling value in the area to be erased. Call the aclCreateFloatArray API to create data of the aclFloatArray type. The length must be the same as the number of C channels of the input tensor. When the length is 3, value is used to fill in the R, G, and B channels, respectively.
If a null pointer is transferred, the default value 0 is used.
If the data type of the input tensor is FLOAT, the value range is [0, 1]. If the data type of the input tensor is UINT8, the value range is [0, 255].
- out: output tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the output tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can only be 1 or empty, the value of C can be 1 or 3 (1: GRAY image; 3: RGB image), and the values of dataType, Format and Shape must be the same as those of self.
- workspaceSize: size of the workspace to be allocated on the device.
- executor: operator executor, containing the operator computation process.
- self: input tensor of the operator, which is of the aclTensor type created by calling aclCreateTensor (the tensor data is stored on the device). The value of dataType of the input tensor can be UINT8 or FLOAT, the value of Format can be NCHW or NHWC, and non-contiguous tensors are not supported. The value of N can be 1 or left empty, and the value of C can be 1 or 3 (1: input GRAY image; 3: input RGB image).
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
acldvppErase
- Parameters:
- workspace: address of the device memory allocated by calling aclrtMalloc. The size of the device memory is specified by workspaceSize.
- workspaceSize: The value must be the same as that obtained by calling acldvppEraseGetWorkspaceSize.
- executor: op executor, which contains the operator computation process and is the same as the executor of the acldvppEraseGetWorkspaceSize API.
- stream: stream for executing a task, which can be a created stream for saving resources or newly created by the aclrtCreateStream API call.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
Constraints
The supported image resolution ranges from 6 x 4 to 4096 x 8192.
If dataType is set to UINT8, the result is the same as that of Torchvision. If dataType is set to FLOAT, the maximum difference between the result of area to be erased and Torchvision is +-1/255.