ReFormat
Availability
Function Usage
Reformats the input tensor x to the destination format without changing the dimensions and value.
This function unifies the viewFormat, originalFormat, and storageFormat of the input tensor to the specified format.
Prototype
const aclTensor *ReFormat(const aclTensor *x, const op::Format &format, aclOpExecutor *executor=nullptr)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
x |
Input |
Tensor to be converted. The data type can be FLOAT16, FLOAT32, INT32, UINT32, INT8, or UINT8. |
format |
Input |
Destination format of the input tensor. |
executor |
Input |
Operator executor, containing the operator computation process. |
Returns
A tensor in the destination format.
Constraints
The input tensor must have the same dimensions as the data in the specified format.
Example
1 2 3 | // Reformat the input to the NCHW format. auto reformatInput = l0op::ReFormat(unsqueezedInput, Format::FORMAT_NCHW); CHECK_RET(reformatInput != nullptr, nullptr); |
Parent topic: Basic Kernel Function APIs