AscendStringToFormat
Function Usage
Converts a string into a value of the Format type.
To use this API, the type_utils.h header file must be included.
1 | #include "graph/utils/type_utils.h" |
Prototype
1 | static Format AscendStringToFormat(const AscendString &str) |
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
str |
Input |
Format string to be converted, which is of the AscendString type. |
Returns
If the input is valid, the Format enum value after conversion is returned. For details about the enumeration definition, see Format. If the input is invalid, FORMAT_RESERVED is returned and an error message is printed.
Constraints
None
Examples
1 2 | ge::AscendString format_str("NHWC"); auto format = ge::TypeUtils::AscendStringToFormat(format_str); // 1 |
Parent topic: TypeUtils