hls4ml.backends package
Subpackages
- hls4ml.backends.catapult package
- Subpackages
- hls4ml.backends.catapult.passes package
- Submodules
- hls4ml.backends.catapult.passes.broadcast_stream module
- hls4ml.backends.catapult.passes.conv_same_pad module
- hls4ml.backends.catapult.passes.conv_stream module
- hls4ml.backends.catapult.passes.convolution_templates module
- hls4ml.backends.catapult.passes.convolution_winograd module
- hls4ml.backends.catapult.passes.core_templates module
- hls4ml.backends.catapult.passes.fifo_depth_optimization module
- hls4ml.backends.catapult.passes.garnet_templates module
- hls4ml.backends.catapult.passes.merge_templates module
- hls4ml.backends.catapult.passes.pointwise module
- hls4ml.backends.catapult.passes.pooling_templates module
- hls4ml.backends.catapult.passes.quantization_templates module
- hls4ml.backends.catapult.passes.recurrent_templates module
- hls4ml.backends.catapult.passes.reshaping_templates module
- hls4ml.backends.catapult.passes.resource_strategy module
- hls4ml.backends.catapult.passes.transform_types module
- Module contents
- hls4ml.backends.catapult.passes package
- Submodules
- hls4ml.backends.catapult.catapult_backend module
- hls4ml.backends.catapult.catapult_types module
- Module contents
- Subpackages
- hls4ml.backends.fpga package
- Subpackages
- hls4ml.backends.fpga.passes package
- Submodules
- hls4ml.backends.fpga.passes.bn_quant module
- hls4ml.backends.fpga.passes.bram_weights module
- hls4ml.backends.fpga.passes.clone module
- hls4ml.backends.fpga.passes.codegen module
- hls4ml.backends.fpga.passes.embedding module
- hls4ml.backends.fpga.passes.final_reshape module
- hls4ml.backends.fpga.passes.fix_softmax_table_size module
- hls4ml.backends.fpga.passes.hgq_proxy_model module
- hls4ml.backends.fpga.passes.inplace_parallel_reshape module
- hls4ml.backends.fpga.passes.inplace_stream_flatten module
- hls4ml.backends.fpga.passes.remove_softmax module
- hls4ml.backends.fpga.passes.repack_stream module
- hls4ml.backends.fpga.passes.xnor_pooling module
- Module contents
- hls4ml.backends.fpga.passes package
- Submodules
- hls4ml.backends.fpga.fpga_backend module
- hls4ml.backends.fpga.fpga_layers module
- hls4ml.backends.fpga.fpga_types module
- Module contents
- Subpackages
- hls4ml.backends.quartus package
- Subpackages
- hls4ml.backends.quartus.passes package
- Submodules
- hls4ml.backends.quartus.passes.convolution_templates module
- hls4ml.backends.quartus.passes.convolution_winograd module
- hls4ml.backends.quartus.passes.core_templates module
- hls4ml.backends.quartus.passes.merge_templates module
- hls4ml.backends.quartus.passes.pointwise module
- hls4ml.backends.quartus.passes.pooling_templates module
- hls4ml.backends.quartus.passes.quantization_templates module
- hls4ml.backends.quartus.passes.recurrent_templates module
- hls4ml.backends.quartus.passes.reshaping_templates module
- hls4ml.backends.quartus.passes.resource_strategy module
- hls4ml.backends.quartus.passes.transform_types module
- Module contents
- hls4ml.backends.quartus.passes package
- Submodules
- hls4ml.backends.quartus.quartus_backend module
- hls4ml.backends.quartus.quartus_types module
- Module contents
- Subpackages
- hls4ml.backends.symbolic package
- hls4ml.backends.vitis package
- hls4ml.backends.vivado package
- Subpackages
- hls4ml.backends.vivado.passes package
- Submodules
- hls4ml.backends.vivado.passes.broadcast_stream module
- hls4ml.backends.vivado.passes.conv_same_pad module
- hls4ml.backends.vivado.passes.conv_stream module
- hls4ml.backends.vivado.passes.convolution_templates module
- hls4ml.backends.vivado.passes.core_templates module
- hls4ml.backends.vivado.passes.fifo_depth_optimization module
- hls4ml.backends.vivado.passes.garnet_templates module
- hls4ml.backends.vivado.passes.merge_templates module
- hls4ml.backends.vivado.passes.pointwise module
- hls4ml.backends.vivado.passes.pooling_templates module
- hls4ml.backends.vivado.passes.quantization_templates module
- hls4ml.backends.vivado.passes.recurrent_templates module
- hls4ml.backends.vivado.passes.reshaping_templates module
- hls4ml.backends.vivado.passes.resource_strategy module
- hls4ml.backends.vivado.passes.transform_types module
- Module contents
- hls4ml.backends.vivado.passes package
- Submodules
- hls4ml.backends.vivado.vivado_backend module
- hls4ml.backends.vivado.vivado_types module
- Module contents
- Subpackages
- hls4ml.backends.vivado_accelerator package
Submodules
hls4ml.backends.backend module
- class hls4ml.backends.backend.Backend(name)
Bases:
object
- create_initial_config(**kwargs)
Create the minimal conversion config for the backend.
Subclasses should implement this method to provide the initial configuration for the conversion.
- create_layer_class(layer_class)
Wrap the original layer class into the backend-specific layer class.
Backends should extend base layer classes with new attributes and variables as needed. These new classes are then used within the model.
- Parameters:
layer_class (class) – Base class to extend
- get_available_flows()
Returns the list of flows registered for this backend.
- Returns:
The list of registered flows.
- Return type:
list
- get_custom_source()
Returns the registered custom source files.
- Returns:
- Custom source files. Keys represent destination paths, values are absolute paths to registered source
files.
- Return type:
dict
- get_default_flow()
The name of the default flow of the backend.
Default flow is used as the conversion target if the target flow has not been specified.
- register_pass(name, opt_cls, flow=None)
Register an optimizer path for the backend.
Note that user-provided optimizers registered without specifying any flow will not be invoked.
- Parameters:
name (str) – Name of the optimizer
opt_cls (class) – Optimizer class
flow (str, list or tuple, optional) – Existing flow(s) to add the optimizer to. Defaults to None.
- register_source(source_file, destination_dir='nnet_utils')
Register custom source that is not part of the backend’s templates.
- Parameters:
source_file (str or Path) – Absolute path to the source file.
destination_dir (str, optional) – The sub-directory of the output project to write the source file to. Defaults to ‘nnet_utils’.
- Raises:
Exception – If the source file is not a str or Path, or if the path is not absolute
- register_template(template_cls)
Register a template “optimizer”.
E.g., function call template or op configuration template.
- Parameters:
template_cls (class) – Template to register.
- hls4ml.backends.backend.get_available_backends()
- hls4ml.backends.backend.get_backend(name)
- hls4ml.backends.backend.register_backend(name, backend_cls)
Create the backend instance and add it to the registry.
- Parameters:
name (str) – Name of the backend.
backend_cls (class) – Backend class to instantiate. Class must implement a constructor without parameters.
- Raises:
Exception – If the backend has already been registered.
hls4ml.backends.template module
- class hls4ml.backends.template.FunctionCallTemplate(layer_class, include_header=None)
Bases:
Template
- 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.template.Template(name, layer_class, attribute_name)
Bases:
OptimizerPass
- format(node)
- get_name()
- 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.