GetC0Format
Description
Obtains the value of C0 format based on the actual format. C0 is a parameter required by the specific data format of Ascend AI Processor. For example, NC1HWC0. The last dimension represents the C0 value. The C0 value varies in different Ascend 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 |
* ---------------------------------------------------
*/
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.) |
Returns
- If C0 format is contained, the value of C0 format is returned.
- If C0 format is not contained, 0 is returned.
Exception Handling
None.
Restrictions
None.