hls4ml.backends.fpga.passes package
Submodules
hls4ml.backends.fpga.passes.bn_quant module
- class hls4ml.backends.fpga.passes.bn_quant.BatchNormalizationQuantizedTanhConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.fpga.passes.bn_quant.BatchNormalizationQuantizedTanhFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.fpga.passes.bn_quant.MergeBatchNormAndQuantizedTanh
Bases:
OptimizerPass
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
- class hls4ml.backends.fpga.passes.bn_quant.QuantizeDenseOutput
Bases:
OptimizerPass
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
- hls4ml.backends.fpga.passes.bn_quant.register_bn_quant(backend)
hls4ml.backends.fpga.passes.bram_weights module
- class hls4ml.backends.fpga.passes.bram_weights.RegisterBramWeights
Bases:
OptimizerPass
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.clone module
- class hls4ml.backends.fpga.passes.clone.Clone(model, name, attributes, inputs, outputs=None)
Bases:
Layer
Inserted after the layer whose output is used more than once.
- initialize()
- class hls4ml.backends.fpga.passes.clone.CloneFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.fpga.passes.clone.CloneOutput
Bases:
OptimizerPass
Clones streams that are used multiple times
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
- hls4ml.backends.fpga.passes.clone.register_clone(backend)
hls4ml.backends.fpga.passes.codegen module
- class hls4ml.backends.fpga.passes.codegen.GenerateConvIm2col
Bases:
OptimizerPass
Generates tcode for im2col step of 1D/2d convolution
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.embedding module
- class hls4ml.backends.fpga.passes.embedding.EmbeddingConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.fpga.passes.embedding.EmbeddingFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.fpga.passes.final_reshape module
- class hls4ml.backends.fpga.passes.final_reshape.RemoveFinalReshape
Bases:
OptimizerPass
Remove reshape if final layer
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.inplace_parallel_reshape module
- class hls4ml.backends.fpga.passes.inplace_parallel_reshape.InplaceParallelReshape
Bases:
OptimizerPass
Replaces the output variable of Reshape layer with an inplace variable when using io_parallel.
This is done because in io_parallel tensors are stored as flat arrays, requiring no reshaping.
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.inplace_stream_flatten module
- class hls4ml.backends.fpga.passes.inplace_stream_flatten.InplaceStreamFlatten
Bases:
OptimizerPass
Replaces the output variable of Reshape (flatten) layer with an inplace variable when using io_stream.
This optimizer avoids the expensive repacking of the stream when Reshape layer flattens the tensor to 1d.
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.remove_softmax module
- class hls4ml.backends.fpga.passes.remove_softmax.SkipSoftmax
Bases:
OptimizerPass
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
hls4ml.backends.fpga.passes.repack_stream module
- class hls4ml.backends.fpga.passes.repack_stream.Repack(model, name, attributes, inputs, outputs=None)
Bases:
Layer
Inserted between layers with different packing factors.
- initialize()
- class hls4ml.backends.fpga.passes.repack_stream.RepackFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.fpga.passes.repack_stream.ReshapeStream
Bases:
OptimizerPass
Repacks stream for Reshape layer
- match(node)
Predicate to match on a given node.
- Parameters:
node (Layer) – Node in the model graph to try matching the optimizer on.
- transform(model, node)
Transformation to apply if matching was successful.
Transform should return a boolean value indicating if the model graph was altered (by adding/removing nodes).
- Parameters:
model (ModelGraph) – Model to optimize
node (Layer) – The matched node in the model graph.
- hls4ml.backends.fpga.passes.repack_stream.register_repack_stream(backend)