hls4ml.templates package

Submodules

hls4ml.templates.templates module

class hls4ml.templates.templates.Backend(name)

Bases: object

get_config_template(kind)
get_function_template(kind)
get_include_list(kind)
register_source(file_name, source, destination_dir='nnet_utils')
register_templates(name, function_template, config_template, include_list=[])
hls4ml.templates.templates.get_backend(name)
hls4ml.templates.templates.register_backend(name, backend_cls)

hls4ml.templates.vivado_template module

class hls4ml.templates.vivado_template.VivadoBackend

Bases: hls4ml.templates.templates.Backend

compute_conv1d_instructions(in_W, in_C, kernel_size=3, stride=1, pad=0)
compute_conv2d_instructions(in_H, in_W, in_C, kernel_size=3, stride=1, pad=0)
convert_precision_string(precision)

Convert a precision string (e.g. “ap_fixed<16,6>” to the internal IntegerPrecisionTypes etc)

get_closest_reuse_factor(valid_rf, chosen_rf)

Returns closest value to chosen_rf. valid_rf is sorted (obtained from get_valid_reuse_factors()) If two numbers are equally close, return the smallest number.

get_valid_reuse_factors(layer)
product_type(data_T, weight_T)

Helper function to determine which product implementation to use during inference

set_closest_reuse_factor(layer)

Module contents