Weights

tensorrt.WeightsRole

How a layer uses particular Weights. The power weights of an IScaleLayer are omitted. Refitting those is not supported.

Members:

BIAS : Bias for IConvolutionLayer , IDeconvolutionLayer , or IFullyConnectedLayer .

SHIFT : Shift part of IScaleLayer .

KERNEL : Kernel for IConvolutionLayer , IDeconvolutionLayer , or IFullyConnectedLayer .

CONSTANT : Weights for IConstantLayer .

SCALE : Scale part of IScaleLayer .

class tensorrt.Weights(*args, **kwargs)

An array of weights used as a layer parameter. The weights are held by reference until the engine has been built - deep copies are not made automatically.

Variables:
  • dtypeDataType The type of the weights.
  • sizeint The number of weights in the array.
  • nbytesint Total bytes consumed by the elements of the weights buffer.

Overloaded function.

  1. __init__(self: tensorrt.tensorrt.Weights, type: tensorrt.tensorrt.DataType = DataType.FLOAT) -> None

    Initializes an empty (0-length) Weights object with the specified type.

    type:A type to initialize the weights with. Default: tensorrt.float32
  2. __init__(self: tensorrt.tensorrt.Weights, a: array) -> None

    a:A numpy array whose values to use. No deep copies are made.
numpy(self: tensorrt.tensorrt.Weights) → array

Create a numpy array using the underlying buffer of this weights object.

Returns:A new numpy array that holds a reference to this weight object’s buffer - no deep copy is made.