AscendStringToDataType
Description
Converts a DataType string into a DataType value.
To use this API, the type_utils.h header file must be included.
#include "graph/utils/type_utils.h"
Prototype
static DataType AscendStringToDataType(const AscendString &str)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
str |
Input |
DataType string to be converted, which is of the AscendString type. |
Returns
If the input is valid, the DataType enum value after conversion is returned. For details about the enumeration definition, see DataType. If the input is invalid, DT_UNDEFINED is returned and error logs are printed.
Restrictions
None
Example
ge::AscendString type_str("DT_UINT32");
auto data_type = ge::TypeUtils::AscendStringToDataType(type_str); // 8
Parent topic: TypeUtils