You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* make auto the default for layers
* add max_precision, not currently used
* add maximum precision in standard precision inference
* minimal handling of other types in infer_precision (e.g. for binary)
* add more checks for max precision
* fix the incorrect setting of reuse factors
* update tests to pass backend to config_from_*
* fix parameters syntax error introduced in pytest commit
* add basic type inference for embedding
* add placeholder precision inference for rnn
* fix syntax error in test_qkeras
* fix up test_trace
* don't pass auto in test_attributes
* update documentation
* update documentation (2)
* move some optimizers before infering precision type
* move up the channnels_last_converter
* put missing precision_merge logic in infer_preicion and delete, reorder optimizers
* add type inference to catapult
---------
Co-authored-by: Vladimir <[email protected]>
Copy file name to clipboardExpand all lines: docs/api/configuration.rst
+35-3Lines changed: 35 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,15 +9,18 @@ We currently support two ways of setting hls4ml's model configuration. This page
9
9
10
10
.. contents:: \
11
11
12
+
The Python API approach is recommended for most users as there are more utilities to help create the configuration dictionaries.
12
13
13
14
**NOTE:**
14
15
15
16
16
17
*
17
18
One important part of ``hls4ml`` to remember is that the user is responsible for the format of the inputs. There is no automatic formatting or normalization so this must be done in the training.
18
19
19
-
*
20
+
..
21
+
*
20
22
For developers, you might also want to checkout this section: `Detailed configuration in converted hls codes <#detailed-configuration-in-converted-hls-codes>`_.
23
+
*Broken link*
21
24
22
25
----
23
26
@@ -31,11 +34,26 @@ Using hls4ml, you can quickly generate a simple configuration dictionary from a
For more advanced and detailed configuration, you can also set them through the created dictionary. For example, to change the reuse factor:
37
+
This python dictionary can be edited as needed. A more advanced configuration can be generated by, for example:
38
+
39
+
.. code-block:: python
40
+
41
+
import hls4ml
42
+
config = hls4ml.utils.config_from_keras_model(
43
+
model,
44
+
granularity='name',
45
+
default_precision='fixed<16,6>',
46
+
backend='Vitis')
47
+
48
+
This will include per-layer configuration based on the model. Including the backend is recommended because some configation options depend on the backend. Note, the precisions at the
49
+
higher granularites usually default to 'auto', which means that ``hls4ml`` will try to set it automatically. Note that higher granularity settings take precendence
50
+
over model-level settings. See :py:class:`~hls4ml.utils.config.config_from_keras_model` for more information on the various options.
51
+
52
+
One can override specific values before using the configuration:
35
53
36
54
.. code-block:: python
37
55
38
-
config['Model']['ReuseFactor'] =2
56
+
config['LayerName']['fc1']['ReuseFactor'] =2
39
57
40
58
Or to set the precision of a specific layer's weight:
41
59
@@ -45,6 +63,20 @@ Or to set the precision of a specific layer's weight:
45
63
46
64
To better understand how the configuration hierachy works, refer to the next section for more details.
47
65
66
+
Finally, one then uses the configuration to create an hls model:
0 commit comments