DataType

tensorrt.DataType

Represents data types.

Members:

FLOAT : Represents a 32-bit floating point number.

INT8 : Represents an 8-bit integer.

INT32 : Represents a 32-bit integer.

HALF : Represents a 16-bit floating point number.

TensorRT also exposes some DataType aliases that can be used across the library.

  • tensorrt.float32 corresponds to DataType.FLOAT
  • tensorrt.float16 corresponds to DataType.HALF
  • tensorrt.int32 corresponds to DataType.INT32
  • tensorrt.int8 corresponds to DataType.INT8

The size in bytes of a data type can be retrieved with tensorrt.DataType.itemsize. For example, tensorrt.float32.itemsize would return 4.

tensorrt.nptype(trt_type)

Returns the numpy type equivalent of a TensorRT DataType .

Parameters:trt_type – The TensorRT data type to convert.
Returns:The equivalent numpy type.