qonnx.transformation.general (module)

class qonnx.transformation.general.ApplyConfig(config)

Bases: qonnx.transformation.base.Transformation

Applies node properties (attributes) from either a config dict or its JSON representation given as a filename. The JSON file can specify default values for particular op_types, as well as values for nodes with particular names. Example dict:

{
# set kernel_size = 3 for all nodes with op_type=Im2Col
"Defaults" : {"kernel_size" : [3, ["Im2Col"]]},
# set kernel_size = 7 for the particular node with name Im2Col_0
"Im2Col_0" : {"kernel_size" : 7}
}
apply(model)
class qonnx.transformation.general.ConvertDivToMul

Bases: qonnx.transformation.base.Transformation

Convert divide by constant nodes to multiply by constant nodes.

apply(model)
class qonnx.transformation.general.ConvertSubToAdd

Bases: qonnx.transformation.base.Transformation

Convert subtract-a-constant nodes to add-a-constant nodes.

apply(model)
class qonnx.transformation.general.GiveRandomTensorNames

Bases: qonnx.transformation.base.Transformation

Give random tensor names to all tensors.

apply(model)
class qonnx.transformation.general.GiveReadableTensorNames

Bases: qonnx.transformation.base.Transformation

Give more human-readable names to all internal tensors. You should apply GiveUniqueNodeNames prior to this transform to avoid empty node names, as the readable names are based on the node names.

apply(model)
class qonnx.transformation.general.GiveUniqueNodeNames(prefix='')

Bases: qonnx.transformation.base.Transformation

Give unique names to each node in the graph using enumeration, starting with given prefix (if specified in the constructor).

apply(model)
class qonnx.transformation.general.GiveUniqueParameterTensors

Bases: qonnx.transformation.base.Transformation

Make every parameter tensor unique. The aim is to avoid affecting other nodes apart from the one the system is currently operating on.

apply(model)
class qonnx.transformation.general.RemoveStaticGraphInputs

Bases: qonnx.transformation.base.Transformation

Remove any top-level graph inputs that have initializers.

apply(model)
class qonnx.transformation.general.RemoveUnusedTensors

Bases: qonnx.transformation.base.Transformation

Remove any unused tensors in the graph by removing any initializers, ValueInfo and tensor annotations associated with it. Unused tensors do not appear as any input/output for any graph nodes.

apply(model)
class qonnx.transformation.general.SortGraph

Bases: qonnx.transformation.base.Transformation

Returns the model with its node list sorted topologically. Any ONNX graph to be executed must have a topologically sorted node list, as dictated by the ONNX standard.

apply(model)