ReFormat

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

Atlas A2 training products/Atlas A2 inference products

Atlas 200I/500 A2 inference products

x

Atlas inference products

Atlas training products

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.

Examples

1
2
3
// Reformat the input to the NCHW format.
auto reformatInput = l0op::ReFormat(unsqueezedInput, Format::FORMAT_NCHW);
CHECK_RET(reformatInput != nullptr, nullptr);