获取数据类型所占内存大小。
使用该接口需要包含type_utils.h头文件。
1 | #include "graph/utils/type_utils.h"
|
1 | static bool GetDataTypeLength(const ge::DataType data_type, uint32_t &length)
|
参数 |
输入/输出 |
说明 |
---|---|---|
data_type |
输入 |
数据类型。 |
length |
输出 |
数据类型所占内存大小,单位:字节。 |
获取成功时返回true;data_type不支持时返回false。
无。
1 2 3 4 5 6 | uint32_t type_length;
ge::DataType data_type = ge::DT_INT8;
const bool ret = ge::TypeUtils::GetDataTypeLength(data_type, type_length); // type_length 1
if (!ret) {
// ...
}
|