DataType

tensorrt.DataType

Represents data types.

ivar itemsize

int The size in bytes of this DataType .

Members:

FLOAT : 32-bit floating point format.

HALF : IEEE 16-bit floating-point format.

INT8 : Signed 8-bit integer representing a quantized floating-point value.

INT32 : Signed 32-bit integer format.

BOOL : 8-bit boolean. 0 = false, 1 = true, other values undefined.

UINT8 :

Unsigned 8-bit integer format. Cannot be used to represent quantized floating-point values. Use the IdentityLayer to convert uint8 network-level inputs to {float32, float16} prior to use with other TensorRT layers, or to convert intermediate output before uint8 network-level outputs from {float32, float16} to uint8. uint8 conversions are only supported for {float32, float16}. uint8 to {float32, float16} conversion will convert the integer values to equivalent floating point values. {float32, float16} to uint8 conversion will convert the floating point values to integer values by truncating towards zero. This conversion has undefined behavior for floating point values outside the range [0.0f, 256.0) after truncation. uint8 conversions are not supported for {int8, int32, bool}.

FP8 :

Signed 8-bit floating point with 1 sign bit, 4 exponent bits, 3 mantissa bits, and exponent-bias 7.

Warning

fp8 is not supported yet and will result in an error or undefined behavior.

TensorRT also exposes some short-hand, NumPy-style DataType aliases that can be used across the library:

Type

Alias

tensorrt.DataType.FLOAT

tensorrt.float32

tensorrt.DataType.HALF

tensorrt.float16

tensorrt.DataType.INT32

tensorrt.int32

tensorrt.DataType.INT8

tensorrt.int8

tensorrt.DataType.BOOL

tensorrt.bool

tensorrt.nptype(trt_type)

Returns the numpy-equivalent of a TensorRT DataType .

Parameters

trt_type – The TensorRT data type to convert.

Returns

The equivalent numpy type.