TransDataSpecial
Availability
Function Usage
Converts the tensor's format without changing its value. The function is similar to that of TransData.
Specifically, this API converts the format of an input tensor into the specified dstPrimaryFormat.
Prototype
const aclTensor *TransDataSpecial(const aclTensor *x, op::Format dstPrimaryFormat, int64_t groups, aclOpExecutor *executor)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
x |
Input |
Tensor to be converted. The data type can be FLOAT16, FLOAT32, INT32, UINT32, INT8, or UINT8. |
dstPrimaryFormat |
Input |
Destination format of the input tensor. |
groups |
Input |
Group parameter, which is used for conversion by group. The data type can be INT64. |
executor |
Input |
Operator executor, containing the operator computation process. |
Returns
A tensor of dstPrimaryFormat.
Constraints
When the input tensor is of type FLOAT32, INT32, or UINT32, C0 can only be processed based on 16.
Example
1 2 3 4 | // (Fixed writing) Create an OpExecutor. auto uniqueExecutor = CREATE_EXECUTOR(); // Convert the format of gradOutputReFormat to NC1HWC0. auto gradOutputTransData = l0op::TransDataSpecial(gradOutputReFormat, op::Format::FORMAT_NC1HWC0, 0,uniqueExecutor.get()); |