目录

GetC0Format

Function Description

Obtains the value of C0 format based on the actual format. C0 is a parameter required by the specific data format of the AI processor. For example, NC1HWC0. The last dimension represents the C0 value. The C0 value varies in different AI processors and is carried in C0 format.

The actual format is 4-byte long. The higher 4 bits of the first byte are reserved, and the lower 4 bits are c0 format. The second and third bytes describe the sub-format, and the fourth byte describes the primary format, as shown in the following:

/*

* ---------------------------------------------------

* | 4 bits | 4bits | 2 bytes | 1 byte |

* |------------|-------------|----------------|--------|

* | reserved | c0-format | sub-format | format |

* ---------------------------------------------------

*/

Function Prototype

inline int32_t GetC0Format(int32_t format)

Parameters

Parameter Input/Output Description
format Input Actual format. (4-byte long. The higher 4 bits of the first byte are reserved, and the lower 4 bits are c0 format. The second and third bytes describe the sub-format, and the fourth byte describes the primary format.)

Return Value

Exception Handling

None

Restrictions

None