GetSizeByDataType

Description

Obtains the memory size occupied by data_type that is transferred. To obtain the memory size of multiple elements, use GetSizeInBytes.

Prototype

inline int GetSizeByDataType(DataType data_type)

Parameters

Parameter

Input/Output

Description

data_type

Input

Data type. For details, see DataType.

Returns

Size of the memory occupied by data_type, in bytes.

If the memory occupied by data_type is less than 1 byte, the result of 1000 + the number of bits of the data type is returned. For example, if the data type is DT_INT4, 1004 is returned.

If an invalid value or an unsupported data type is passed, -1 is returned.

Exception Handling

None

Restrictions

None