hls4ml.backends.oneapi.passes package
Submodules
hls4ml.backends.oneapi.passes.bn_quant module
- class hls4ml.backends.oneapi.passes.bn_quant.BatchNormalizationQuantizedTanhConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.bn_quant.BatchNormalizationQuantizedTanhFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.bn_quant.BatchNormalizationQuantizedTanhStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.bn_quant.BatchNormalizationQuantizedTanhTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.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.oneapi.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.oneapi.passes.bn_quant.register_bn_quant(backend)
hls4ml.backends.oneapi.passes.clone_templates module
The clone templates in the fpga backend are not enough for oneAPI, so this adds the missing parts
- class hls4ml.backends.oneapi.passes.clone_templates.CloneStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.clone_templates.CloneTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.convolution_templates module
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv1DConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv1DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv1DTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv2DConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv2DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.Conv2DTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.convolution_templates.ConvStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- hls4ml.backends.oneapi.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.oneapi.passes.convolution_winograd module
- class hls4ml.backends.oneapi.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.oneapi.passes.core_templates module
- class hls4ml.backends.oneapi.passes.core_templates.ActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ActivationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ActivationStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ActivationTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.BatchNormalizationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.BatchNormalizationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.BatchNormalizationStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.BatchNormalizationTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.DenseConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.DenseFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.DenseStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.DenseTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.HardActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.PReLUActivationStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.PReLUFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ParamActivationConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ParametrizedActivationFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ParametrizedActivationStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.ParametrizedActivationTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.core_templates.SoftmaxConfigTemplate
Bases:
ActivationConfigTemplate
hls4ml.backends.oneapi.passes.embedding_templates module
These are the stream oneAPI templates for embedding layers. The io_parallel ones are in backends/fpga/passes/embedding.py.
- class hls4ml.backends.oneapi.passes.embedding_templates.EmbeddingStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.embedding_templates.EmbeddingTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.merge_templates module
- class hls4ml.backends.oneapi.passes.merge_templates.ConcatenateConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.merge_templates.DotConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.merge_templates.MergeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.merge_templates.MergeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.merge_templates.MergeStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.merge_templates.MergeTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.pointwise module
- class hls4ml.backends.oneapi.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.oneapi.passes.pointwise.PointwiseConv1DConfigTemplate
Bases:
Conv1DConfigTemplate
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConv1DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConv1DTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConv2DConfigTemplate
Bases:
Conv2DConfigTemplate
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConv2DFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConv2DTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pointwise.PointwiseConvStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- hls4ml.backends.oneapi.passes.pointwise.register_pointwise(backend)
hls4ml.backends.oneapi.passes.pooling_templates module
- class hls4ml.backends.oneapi.passes.pooling_templates.PoolingConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pooling_templates.PoolingFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pooling_templates.PoolingStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.pooling_templates.PoolingTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.quantization_templates module
- class hls4ml.backends.oneapi.passes.quantization_templates.ApplyAlphaConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.quantization_templates.ApplyAlphaFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.quantization_templates.ApplyAlphaStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.quantization_templates.ApplyAlphaTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.recurrent_templates module
- class hls4ml.backends.oneapi.passes.recurrent_templates.GRUConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.GRUFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.GRUStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.GRUTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.LSTMConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.LSTMFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.SimpleRNNConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.recurrent_templates.SimpleRNNFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
hls4ml.backends.oneapi.passes.reshaping_templates module
- class hls4ml.backends.oneapi.passes.reshaping_templates.ReshapeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ReshapeFunctionTemplate
Bases:
FunctionCallTemplate
Only used to add the include list
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ReshapeTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ReshapingStreamFunctionTemplate
Bases:
StreamFunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ResizeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ResizeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ResizeTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.TransposeConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.TransposeFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.TransposeTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ZeroPaddingConfigTemplate
Bases:
LayerConfigTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ZeroPaddingFunctionTemplate
Bases:
FunctionCallTemplate
- format(node)
- class hls4ml.backends.oneapi.passes.reshaping_templates.ZeroPaddingTaskSequenceTemplate
Bases:
TaskSequenceTemplate
- format(node)
hls4ml.backends.oneapi.passes.resource_strategy module
- class hls4ml.backends.oneapi.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.oneapi.passes.transform_types module
- class hls4ml.backends.oneapi.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.