hls4ml.backends.quartus.passes package
Submodules
hls4ml.backends.quartus.passes.bn_quant module
- class hls4ml.backends.quartus.passes.bn_quant.BatchNormalizationQuantizedTanhConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.bn_quant.BatchNormalizationQuantizedTanhFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.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.quartus.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.quartus.passes.bn_quant.register_bn_quant(backend)
hls4ml.backends.quartus.passes.convolution_templates module
- class hls4ml.backends.quartus.passes.convolution_templates.Conv1DConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.convolution_templates.Conv1DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.convolution_templates.Conv2DConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.convolution_templates.Conv2DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- hls4ml.backends.quartus.passes.convolution_templates.conv_mult_config_template = 'struct config{index}_mult : nnet::dense_config {{\n static const unsigned n_in = {n_in};\n static const unsigned n_out = {n_out};\n\n static const unsigned rf_pad = {rfpad};\n static const unsigned bf_pad = {bfpad};\n\n static const unsigned reuse_factor = {reuse};\n static const unsigned reuse_factor_rounded = reuse_factor + rf_pad;\n static const unsigned block_factor = DIV_ROUNDUP(n_in*n_out, reuse_factor);\n static const unsigned block_factor_rounded = block_factor + bf_pad;\n static const unsigned multiplier_factor = MIN(n_in, reuse_factor);\n static const unsigned multiplier_limit = DIV_ROUNDUP(n_in*n_out, multiplier_factor);\n static const unsigned multiplier_scale = multiplier_limit/n_out;\n\n typedef {accum_t.name} accum_t;\n typedef {bias_t.name} bias_t;\n typedef {weight_t.name} weight_t;\n\n template<class x_T, class y_T>\n using product = nnet::product::{product_type}<x_T, y_T>;\n}};\n'
1D Conv
hls4ml.backends.quartus.passes.convolution_winograd module
- class hls4ml.backends.quartus.passes.convolution_winograd.ApplyWinogradKernelTransformation
Bases:
OptimizerPass
Transforms the weights of a Conv2D kernel to a format suitable for Wingorad convolution For further information, refer to Lavin & Gray, 2015 - Fast Algorithms for Convolutional Neural Networks
- 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.quartus.passes.core_templates module
- class hls4ml.backends.quartus.passes.core_templates.ActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.ActivationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.BatchNormalizationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.BatchNormalizationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.DenseConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.DenseFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.HardActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.PReLUFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.ParamActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.ParametrizedActivationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.core_templates.SoftmaxConfigTemplate
Bases:
ActivationConfigTemplate
hls4ml.backends.quartus.passes.merge_templates module
- class hls4ml.backends.quartus.passes.merge_templates.ConcatenateConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.merge_templates.DotConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.merge_templates.MergeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.merge_templates.MergeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.quartus.passes.pointwise module
- class hls4ml.backends.quartus.passes.pointwise.OptimizePointwiseConv
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.quartus.passes.pointwise.PointwiseConv1DConfigTemplate
Bases:
Conv1DConfigTemplate
- class hls4ml.backends.quartus.passes.pointwise.PointwiseConv1DFunctionTemplate
Bases:
Conv1DFunctionTemplate
- class hls4ml.backends.quartus.passes.pointwise.PointwiseConv2DConfigTemplate
Bases:
Conv2DConfigTemplate
- class hls4ml.backends.quartus.passes.pointwise.PointwiseConv2DFunctionTemplate
Bases:
Conv2DFunctionTemplate
- hls4ml.backends.quartus.passes.pointwise.register_pointwise(backend)
hls4ml.backends.quartus.passes.pooling_templates module
- class hls4ml.backends.quartus.passes.pooling_templates.PoolingConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.pooling_templates.PoolingFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.quartus.passes.quantization_templates module
- class hls4ml.backends.quartus.passes.quantization_templates.ApplyAlphaConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.quantization_templates.ApplyAlphaFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.quartus.passes.recurrent_templates module
- class hls4ml.backends.quartus.passes.recurrent_templates.GRUConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.recurrent_templates.GRUFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.recurrent_templates.LSTMConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.recurrent_templates.LSTMFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.recurrent_templates.SimpleRNNConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.recurrent_templates.SimpleRNNFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.quartus.passes.reshaping_templates module
- class hls4ml.backends.quartus.passes.reshaping_templates.ResizeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.reshaping_templates.ResizeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.reshaping_templates.TransposeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.reshaping_templates.TransposeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.quartus.passes.reshaping_templates.ZeroPaddingConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.quartus.passes.reshaping_templates.ZeroPaddingFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.quartus.passes.resource_strategy module
- class hls4ml.backends.quartus.passes.resource_strategy.ApplyResourceStrategy
Bases:
OptimizerPass
Transposes the weights to use the dense_resource matrix multiply routine
- 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.quartus.passes.transform_types module
- class hls4ml.backends.quartus.passes.transform_types.TransformTypes
Bases:
GlobalOptimizerPass
- 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.