hls4ml.model.optimizer.passes package

Submodules

hls4ml.model.optimizer.passes.bn_fuse module

class hls4ml.model.optimizer.passes.bn_fuse.FuseBatchNormalization

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.bn_quant module

class hls4ml.model.optimizer.passes.bn_quant.BatchNormalizationQuantizedTanh(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Layer

Merged Batch Normalization and quantized (binary or ternary) Tanh layer. The mean, variance, beta, gamma parameters are folded into the threshold(s) at which the sign of the input flips after the quantized (binary or ternary) Tanh activation.

config_cpp()
function_cpp()
initialize()
set_thresholds(scale, bias, ternary_threshold=0.5)
class hls4ml.model.optimizer.passes.bn_quant.MergeBatchNormAndQuantizedTanh

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)
class hls4ml.model.optimizer.passes.bn_quant.QuantizeDenseOutput

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.clone module

class hls4ml.model.optimizer.passes.clone.Clone(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Layer

Inserted after the layer whose output is used more than once.

config_cpp()
function_cpp()
initialize()
class hls4ml.model.optimizer.passes.clone.CloneOutput

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

Clones streams that are used multiple times

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.conv_same_pad module

class hls4ml.model.optimizer.passes.conv_same_pad.InsertZeroPaddingBeforeConv1D

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)
class hls4ml.model.optimizer.passes.conv_same_pad.InsertZeroPaddingBeforeConv2D

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.fuse_biasadd module

class hls4ml.model.optimizer.passes.fuse_biasadd.FuseBiasAdd

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

Fuses BiasAdd into Dense/Conv2D layer (common in TF models).

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.multi_dense module

class hls4ml.model.optimizer.passes.multi_dense.ReplaceMultidimensionalDenseWithConv

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.nop module

class hls4ml.model.optimizer.passes.nop.EliminateLinearActivation

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.pointwise module

class hls4ml.model.optimizer.passes.pointwise.OptimizePointwiseConv

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)
class hls4ml.model.optimizer.passes.pointwise.PointwiseConv1D(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Conv1D

Optimized Conv1D implementation for 1x1 kernels.

class hls4ml.model.optimizer.passes.pointwise.PointwiseConv2D(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Conv2D

Optimized Conv2D implementation for 1x1 kernels.

hls4ml.model.optimizer.passes.qkeras module

hls4ml.model.optimizer.passes.repack_stream module

class hls4ml.model.optimizer.passes.repack_stream.Broadcast(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Layer

Inserted between layers for broadcasting.

config_cpp()
function_cpp()
initialize()
class hls4ml.model.optimizer.passes.repack_stream.BroadcastStream

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)
class hls4ml.model.optimizer.passes.repack_stream.Repack(model, name, attributes, inputs, outputs=None)

Bases: hls4ml.model.hls_layers.Layer

Inserted between layers with different packing factors.

config_cpp()
function_cpp()
initialize()
class hls4ml.model.optimizer.passes.repack_stream.ReshapeStream

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

Repacks stream for Reshape layer

match(node)
transform(model, node)

hls4ml.model.optimizer.passes.transpose_opt module

class hls4ml.model.optimizer.passes.transpose_opt.RemoveUselessTranspose

Bases: hls4ml.model.optimizer.optimizer.OptimizerPass

match(node)
transform(model, node)

Remove a transpose layer if it doesn’t do anything. i.e 1D input and perm = [0]

Module contents