UFF Parser

tensorrt.UffInputOrder

The different possible supported input orders.

Members:

NCHW

NHWC

NC

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_factoryIUffPluginFactory used to create the user defined plugins.
  • plugin_factory_extIUffPluginFactoryExt used to create the user defined pluginExts.
  • plugin_namespacestr The namespace used to lookup and create plugins in the network.
__del__(self: tensorrt.tensorrt.UffParser) → None
__exit__(exc_type, exc_value, traceback)

Destroy this object, freeing all memory associated with it. This should be called to ensure that the object is cleaned up properly. Equivalent to invoking __del__()

__init__(self: tensorrt.tensorrt.UffParser) → None
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:
  • name – Input name.
  • shape – Input shape.
  • 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.