The reorder primitive copies data between different memory formats but doesn't change the tensor from mathematical perspective (the variable names follow the standard Naming Conventions):
\[ \dst(\overline{x}) = \src(\overline{x}) \]
As described in Basic Concepts in order to achieve the best performance some primitives (such as convolution) require special memory format which is typically referred to as an optimized memory format. The optimized memory format may match or may not match memory format that data is currently kept in. In this case a user can use reorder primitive to copy (reorder) the data between the memory formats.
Using the attributes and post-ops users can also use reorder primitive to quantize the data (and if necessary change the memory format simultaneously).
When executed, the inputs and outputs should be mapped to an execution argument index as specified by the following table.
Primitive input/output | Execution argument index |
---|---|
\(\src\) | DNNL_ARG_FROM |
\(\dst\) | DNNL_ARG_TO |
The reorder primitive supports arbitrary data types for the source and destination according to the Data Types page.
When converting the data from one data type to a smaller one saturation is used. For instance:
The reorder primitive works with arbitrary data tensors. There is no special meaning associated with any logical dimensions.
The reorder primitive support the following attributes and post-ops:
Attributes / Post-ops | Mea |
---|---|
Output scales | Copy and scale the data according to the scaling factors |
Sum post-op | Instead of copy the data accumulate it to the previous data |
For instance, the following pseudo-code
would lead to the following operation:
\[ \dst(\overline{x}) = \alpha \cdot \src(\overline{x}) + \beta \cdot \dst(\overline{x}) \]
N/A