UFF Parser

tensorrt.UffInputOrder

The different possible supported input orders.

Members:

NCHW

NC

NHWC

class tensorrt.UffParser(self: tensorrt.tensorrt.UffParser) → None

This class is used for parsing models described using the UFF format.

Variables:
  • uff_required_version_majorint Version Major of the UFF.
  • uff_required_version_minorint Version Minor of the UFF.
  • uff_required_version_patchint Version Patch of the UFF.
  • plugin_factoryPluginFactory used to create the user defined plugins.
  • plugin_factory_extPluginFactoryExt used to create the user defined pluginExts.
parse(self: tensorrt.tensorrt.UffParser, file: str, network: tensorrt.tensorrt.INetworkDefinition, weights_type: tensorrt.tensorrt.DataType = DataType.FLOAT) → bool

Parse a UFF file.

Parameters:
  • file – File name of the UFF file.
  • network – Network in which the UffParser will fill the layers.
  • weights_type – The type on which the weights will be transformed in.
Returns:

True if the UFF file is parsed without error.

parse_buffer(self: tensorrt.tensorrt.UffParser, buffer: buffer, network: tensorrt.tensorrt.INetworkDefinition, weights_type: tensorrt.tensorrt.DataType = DataType.FLOAT) → bool

Parse a UFF buffer - useful if the file is already live in memory.

Parameters:
  • buffer – The UFF buffer.
  • network – Network in which the UFFParser will fill the layers.
  • weights_type – The type on which the weights will be transformed in.
Returns:

True if the UFF buffer is parsed without error.

register_input(self: tensorrt.tensorrt.UffParser, name: str, shape: tensorrt.tensorrt.Dims, order: tensorrt.tensorrt.UffInputOrder = UffInputOrder.NCHW) → bool

Register an input name of a UFF network with the associated Dimensions.

Parameters:
  • input_name – Input name.
  • input_dims – Input Dimensions, always provide your dimensions in CHW even if your network input was in HWC in your original framework.
  • input_order – Input order on which the framework input was originally.
Returns:

True if the name registers without error.

register_output(self: tensorrt.tensorrt.UffParser, name: str) → bool

Register an output name of a UFF network.

Parameters:output_name – Output name.
Returns:True if the name registers without error.