DataTypeToAscendString

Description

Converts a value of the DataType type into a string.

To use this API, the type_utils.h header file must be included.

#include "graph/utils/type_utils.h"

Prototype

static AscendString DataTypeToAscendString(const DataType &data_type)

Parameters

Parameter

Input/Output

Description

data_type

Input

DataType to be converted. For details about the supported DataTypes, see DataType.

Returns

DataType string after conversion, which is of the AscendString type.

Restrictions

None

Example

DataType data_type = ge::DT_UINT32;
auto type_str = ge::TypeUtils::DataTypeToAscendString(data_type); // "DT_UINT32"
const char *ptr = type_str.GetString();  // Obtain the char* pointer.