ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
DLDataType Struct Reference

The data type the tensor can hold. The data type is assumed to follow the native endian-ness. An explicit error message should be raised when attempting to export an array with non-native endianness. More...

#include <DLPack.h>

Collaboration diagram for DLDataType:

Public Attributes

uint8_t code
 Type code of base types. We keep it uint8_t instead of DLDataTypeCode for minimal memory footprint, but the value should be one of DLDataTypeCode enum values. More...
 
uint8_t bits
 Number of bits, common choices are 8, 16, 32. More...
 
uint16_t lanes
 Number of lanes in the type, used for vector types. More...
 

Detailed Description

The data type the tensor can hold. The data type is assumed to follow the native endian-ness. An explicit error message should be raised when attempting to export an array with non-native endianness.

Examples

  • float: type_code = 2, bits = 32, lanes = 1
  • float4(vectorized 4 float): type_code = 2, bits = 32, lanes = 4
  • int8: type_code = 0, bits = 8, lanes = 1
  • std::complex<float>: type_code = 5, bits = 64, lanes = 1
  • bool: type_code = 6, bits = 8, lanes = 1 (as per common array library convention, the underlying storage size of bool is 8 bits)
  • float8_e4m3: type_code = 8, bits = 8, lanes = 1 (packed in memory)
  • float6_e3m2fn: type_code = 16, bits = 6, lanes = 1 (packed in memory)
  • float4_e2m1fn: type_code = 17, bits = 4, lanes = 1 (packed in memory)

When a sub-byte type is packed, DLPack requires the data to be in little bit-endian, i.e., for a packed data set D ((D >> (i * bits)) && bit_mask) stores the i-th element.

Definition at line 226 of file DLPack.h.

Member Data Documentation

◆ bits

uint8_t DLDataType::bits

Number of bits, common choices are 8, 16, 32.

Definition at line 236 of file DLPack.h.

Referenced by cloudViewer::core::DLDataTypeToDtype().

◆ code

uint8_t DLDataType::code

Type code of base types. We keep it uint8_t instead of DLDataTypeCode for minimal memory footprint, but the value should be one of DLDataTypeCode enum values.

Definition at line 232 of file DLPack.h.

Referenced by cloudViewer::core::DLDataTypeToDtype().

◆ lanes

uint16_t DLDataType::lanes

Number of lanes in the type, used for vector types.

Definition at line 238 of file DLPack.h.

Referenced by cloudViewer::core::DLDataTypeToDtype().


The documentation for this struct was generated from the following file: