acldvppToDtype
Applicability
|
Product |
Supported |
|---|---|
|
|
√ |
|
|
√ |
|
|
x |
|
|
x |
|
|
x |
Function Usage
Converts the data type.
Prototype
Each operator has two-phase API calls. First, acldvppToDtypeGetWorkspaceSize is called to calculate the required workspace size based on the computation process. Then, acldvppToDtype is called to perform the computation. The two-phase APIs are as follows:
- First-phase API:
1acldvppStatus acldvppToDtypeGetWorkspaceSize(const aclTensor *self, aclDataType dtype, bool normalize, aclTensor *out, uint64_t *workspaceSize, aclOpExecutor **executor)
- Second-phase API:
1acldvppStatus acldvppToDtype(void *workspace, uint64_t workspaceSize, aclOpExecutor *executor, aclrtStream stream)
acldvppToDtypeGetWorkspaceSize
- 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).
- dtype: data type of the conversion destination. The value can be UINT8 or FLOAT.
- normalize: whether to perform normalization based on the data type. If the value is false, only the data type changes and the value remains unchanged. If the value is true, normalization is performed based on the data type.
- 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 be 1 or left empty, and the value of C can be 1 or 3 (1: input GRAY image; 3: input RGB image). The data type of out must be the same as that of self, and the C, H, and W dimensions of out 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.
- Returns:
acldvppStatus status code. For details, see acldvpp Return Codes.
acldvppToDtype
- 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 acldvppToDtypeGetWorkspaceSize.
- executor: op executor, which contains the operator computation process and is the same as the executor of acldvppToDtypeGetWorkspaceSize.
- 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.