Layer Base Classes

ITensor

tensorrt.TensorLocation

The physical location of the data.

Members:

HOST : Data is stored on the device.

DEVICE : Data is stored on the device.

class tensorrt.ITensor

A tensor in an INetworkDefinition .

Variables:
  • namestr The tensor name. For a network input, the name is assigned by the application. For tensors which are layer outputs, a default name is assigned consisting of the layer name followed by the index of the output in brackets.
  • shapeDims The shape of a tensor. For a network input the shape is assigned by the application. For a network output it is computed based on the layer parameters and the inputs to the layer. If a tensor size or a parameter is modified in the network, the shape of all dependent tensors will be recomputed. This call is only legal for network input tensors, since the shape of layer output tensors are inferred based on layer inputs and parameters.
  • dtypeDataType The data type of a tensor. The type is unchanged if the type is invalid for the given tensor. If the tensor is a network input or output, then the tensor type cannot be tensorrt.int8 .
  • broadcast_across_batchbool Whether to enable broadcast of tensor across the batch. When a tensor is broadcast across a batch, it has the same value for every member in the batch. Memory is only allocated once for the single member. This method is only valid for network input tensors, since the flags of layer output tensors are inferred based on layer inputs and parameters. If this state is modified for a tensor in the network, the states of all dependent tensors will be recomputed.
  • locationTensorLocation The storage location of a tensor.
  • is_network_inputbool Whether the tensor is a network input.
  • is_network_outputbool Whether the tensor is a network output.

ILayer

tensorrt.LayerType

Type of Layer

Members:

UNARY : Unary layer

RAGGED_SOFTMAX : Ragged softmax layer

DECONVOLUTION : Deconvolution layer

ELEMENTWISE : Elementwise layer

PLUGIN : Plugin layer

SCALE : Scale layer

RNN_V2 : RNN v2 layer

CONVOLUTION : Convolution layer

TOPK : TopK layer

MATRIX_MULTIPLY : Matrix multiply layer

LRN : LRN layer

FULLY_CONNECTED : Fully connected layer

POOLING : Pooling layer

ACTIVATION : Activation layer

PADDING : Padding layer

SHUFFLE : Shuffle layer

SOFTMAX : Softmax layer

CONCATENATION : Concatenation layer

CONSTANT : Constant layer

GATHER : Gather layer

RNN : RNN layer

REDUCE : Reduce layer

class tensorrt.ILayer

Base class for all layer classes in an INetworkDefinition .

Variables:
  • namestr The name of the layer.
  • typeLayerType The type of the layer.
  • num_inputsint The number of inputs of the layer.
  • num_outputsint The number of outputs of the layer.
get_input(self: tensorrt.tensorrt.ILayer, index: int) → tensorrt.tensorrt.ITensor

Get the layer input corresponding to the given index.

Parameters:index – The index of the input tensor.
Returns:The input tensor, or None if the index is out of range.
get_output(self: tensorrt.tensorrt.ILayer, index: int) → tensorrt.tensorrt.ITensor

Get the layer output corresponding to the given index.

Parameters:index – The index of the output tensor.
Returns:The output tensor, or None if the index is out of range.