GetTypeByteSize interface
Function
Obtains the number of bytes of the InferDataType type.
Format
static size_t GetTypeByteSize(InferDataType dataType)
Parameters
Parameter |
Mandatory/Optional |
Description |
Value |
|---|---|---|---|
dataType |
Mandatory |
data type. |
InferDataType. For details, see InferDataType. |
Usage Example
Construct a tensor object whose name is INPUT_IDS, data type is INT64, and data dimension is {1, 2}, and obtain the number of bytes of the corresponding InferDataType type.
1 2 3 4 5 | std::string name = "INPUT_IDS"; mindie_llm::InferDataType dataType = mindie_llm::InferDataType::TYPE_INT64; std::vector<int64_t> dataShape = {1, 2}; auto inputsTensor = std::make_shared<mindie_llm::InferTensor>(name, dataType, dataShape); size_t size = inputsTensor->GetTypeByteSize(); |
Return Value
Number of bytes of the InferDataType type. The type is size_t.
Parent topic: InferTensor