Skip to content

Commit 6791412

Browse files
committed
less mandatory dependency
1 parent 86843fc commit 6791412

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

hls4ml/model/profiling.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@
3333
except ImportError:
3434
__qkeras_profiling_enabled__ = False
3535

36-
_activations = list()
36+
__keras_activations = list()
3737
if __keras_profiling_enabled__:
38-
_activations.append(keras.layers.Activation)
38+
__keras_activations.append(keras.layers.Activation)
3939
if __qkeras_profiling_enabled__:
40-
_activations.append(qkeras.qactivations)
40+
__keras_activations.append(qkeras.QActivation)
4141

4242

4343
def get_unoptimized_hlsmodel(model):
@@ -602,7 +602,7 @@ def get_ymodel_keras(keras_model, X):
602602
if (
603603
hasattr(layer, 'activation')
604604
and layer.activation is not None
605-
and not isinstance(layer, _activations)
605+
and not isinstance(layer, tuple(__keras_activations))
606606
and layer.activation.__name__ != 'linear'
607607
):
608608
tmp_activation = layer.activation

hls4ml/report/quartus_report.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
import webbrowser
33
from ast import literal_eval
44

5-
from calmjs.parse import asttypes, es5
6-
from tabulate import tabulate
7-
85

96
def parse_quartus_report(hls_dir, write_to_file=True):
107
'''
@@ -53,6 +50,8 @@ def read_quartus_report(hls_dir, open_browser=False):
5350
Returns:
5451
None
5552
'''
53+
from tabulate import tabulate
54+
5655
report = parse_quartus_report(hls_dir)
5756

5857
print('HLS Resource Summary\n')
@@ -100,6 +99,7 @@ def read_js_object(js_script):
10099
Returns:
101100
Dictionary of variables defines in script
102101
'''
102+
from calmjs.parse import asttypes, es5
103103

104104
def visit(node):
105105
if isinstance(node, asttypes.Program):

setup.cfg

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,9 @@ description_file = README.md
2222
[options]
2323
packages = find:
2424
install_requires =
25-
calmjs.parse
2625
h5py
2726
numpy
28-
onnx>=1.4.0
29-
pydigitalwavetools==1.1
3027
pyyaml
31-
qkeras
32-
tabulate
33-
tensorflow
34-
tensorflow-model-optimization<=0.7.5
3528
python_requires = >=3.10
3629
include_package_data = True
3730
scripts = scripts/hls4ml
@@ -51,14 +44,24 @@ profiling =
5144
matplotlib
5245
pandas
5346
seaborn
47+
qkeras =
48+
qkeras
49+
tensorflow
50+
tensorflow-model-optimization<=0.7.5
51+
quantus_report =
52+
calmjs.parse
53+
tabulate
5454
sr =
5555
sympy
5656
testing =
5757
HGQ~=0.2.0
58+
calmjs.parse
59+
onnx>=1.4.0
5860
pytest
5961
pytest-cov
6062
pytest-randomly
6163
qonnx
64+
tabulate
6265
torch
6366

6467
[check-manifest]

0 commit comments

Comments
 (0)