Skip to content

Add set_data_types_from_keras_model() and set_accum_from_keras_model() for automatic precision inference

Javier Duarte requested to merge github/fork/maksgraczyk/auto-type-setup into main

Created by: maksgraczyk

Profiling information gathered e.g. by hls4ml.model.profiling.numerical() and other information can be used for setting data types in an HLSModel config heuristically so that the optimal precision configuration is achieved faster.

This PR does the following:

  • Adding set_data_types_from_keras_model() doing that with a Keras model.
  • Adding set_accum_from_keras_model() which sets accum_t of relevant layers based on a Keras model and data types set in an HLSModel config (unlike set_data_types_from_keras_model(), it doesn't use profiling information).
  • Adding extra arguments to config_from_keras_model() allowing for the functions above to be called automatically.

Merge request reports

Loading