acldvppResize
Applicability
Product |
Supported |
|---|---|
Atlas 350 Accelerator Card |
√ |
√ |
|
√ |
|
☓ |
|
☓ |
|
☓ |
Description
Description: resizes images. Bilinear, nearest neighbour, and bicubic interpolation algorithms are supported.
Prototype
Each operator has two-phase API calls. First, acldvppResizeGetWorkspaceSize is called to calculate the required workspace size based on the computation process. Then, acldvppResize is called to perform computation. The two-phase APIs are as follows:
- First-phase API:
1acldvppStatus acldvppResizeGetWorkspaceSize(const aclTensor* self, uint32_t interpolationMode, aclTensor* out, uint64_t* workspaceSize, aclOpExecutor** executor)
- Second-phase API:
1acldvppStatus acldvppResize(void* workspace, uint64_t workspaceSize, aclOpExecutor* executor, aclrtStream stream)
acldvppResizeGetWorkspaceSize
- Parameters:
- self: input tensor of the operator. Call aclCreateTensor to create data of the aclTensor type (stored on the device). The data type of the input tensor can be UINT8 or FLOAT, and the format can be NCHW or NHWC. Discontinuous tensors are not supported, in addition, N can be 1 or empty, and C can be 1 or 3 (1 indicates the input GRAY image, and 3 indicates the input RGB image).
- interpolationMode: resizing algorithm. The options are as follows:
- 0: bilinear
- 1: nearest neighbour
- 2: bicubic
- out: output tensor of the operator. Call aclCreateTensor to create data of the aclTensor type (stored on the device). The data type of the output tensor can be UINT8 or FLOAT, and non-contiguous tensors are not supported. The data type and format must be the same as those of self, the sizes of the N and C axes in Shape must be the same as those of self. The sizes of the W and H axes in Shape must be the same as the width and height after resizing.
- workspaceSize: size of the workspace to be allocated on the device.
- executor: operator executor, containing the operator computation process.
- Returns:
The status code acldvppStatus is returned. For details, see acldvpp Return Codes.
acldvppResize
- Parameters:
- workspace: The aclrtMalloc API needs to be called to allocate the device memory. The memory size is workspaceSize. The memory address output by the aclrtMalloc API is passed here.
- workspaceSize: The value must be the same as that obtained by calling acldvppResizeGetWorkspaceSize.
- executor: op executor, which contains the operator computation process and is the same as the executor of the acldvppResizeGetWorkspaceSize API.
- stream: stream for executing the task. You can reuse the created stream to save resources or call aclrtCreateStream to create a stream, and then pass the stream as an input parameter.
- Returns
The status code acldvppStatus is returned. For details, see acldvpp Return Codes.
Constraints
1. The supported image resolution ranges from 6 x 4 to 32768 x 32768.
2. When the width in Shape of out exceeds 4096, the width x height in Shape of self must be greater than 128 x 16.