From c4a8c6217cf23f77d81c081613d3f4977155092b Mon Sep 17 00:00:00 2001 From: Vladimir Loncar Date: Tue, 4 Feb 2025 21:11:44 +0100 Subject: [PATCH 1/2] Fix imports of profiling module --- part2_advanced_config.ipynb | 8 +++++--- part6_cnns.ipynb | 5 +++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/part2_advanced_config.ipynb b/part2_advanced_config.ipynb index bd2832c1..0cab49e5 100644 --- a/part2_advanced_config.ipynb +++ b/part2_advanced_config.ipynb @@ -118,12 +118,14 @@ "outputs": [], "source": [ "%matplotlib inline\n", + "from hls4ml.model.profiling import numerical, get_ymodel_keras\n", + "\n", "for layer in config['LayerName'].keys():\n", " config['LayerName'][layer]['Trace'] = True\n", "hls_model = hls4ml.converters.convert_from_keras_model(\n", " model, hls_config=config, output_dir='model_1/hls4ml_prj_2', part='xcu250-figd2104-2L-e'\n", ")\n", - "hls4ml.model.profiling.numerical(model=model, hls_model=hls_model, X=X_test[:1000])" + "numerical(model=model, hls_model=hls_model, X=X_test[:1000])" ] }, { @@ -146,7 +148,7 @@ "hls_model = hls4ml.converters.convert_from_keras_model(\n", " model, hls_config=config, output_dir='model_1/hls4ml_prj_2', part='xcu250-figd2104-2L-e'\n", ")\n", - "hls4ml.model.profiling.numerical(model=model, hls_model=hls_model)\n", + "numerical(model=model, hls_model=hls_model)\n", "hls4ml.utils.plot_model(hls_model, show_shapes=True, show_precision=True, to_file=None)" ] }, @@ -190,7 +192,7 @@ "source": [ "hls_model.compile()\n", "hls4ml_pred, hls4ml_trace = hls_model.trace(X_test[:1000])\n", - "keras_trace = hls4ml.model.profiling.get_ymodel_keras(model, X_test[:1000])\n", + "keras_trace = get_ymodel_keras(model, X_test[:1000])\n", "y_hls = hls_model.predict(X_test)" ] }, diff --git a/part6_cnns.ipynb b/part6_cnns.ipynb index 4a8bda60..94808635 100644 --- a/part6_cnns.ipynb +++ b/part6_cnns.ipynb @@ -714,7 +714,8 @@ "metadata": {}, "outputs": [], "source": [ - "hls4ml.model.profiling.numerical(model=model, hls_model=hls_model)" + "from hls4ml.model.profiling import numerical\n", + "numerical(model=model, hls_model=hls_model)" ] }, { @@ -767,7 +768,7 @@ "metadata": {}, "outputs": [], "source": [ - "hls4ml.model.profiling.numerical(model=qmodel, hls_model=hls_model_q)\n", + "numerical(model=qmodel, hls_model=hls_model_q)\n", "hls4ml.utils.plot_model(hls_model_q, show_shapes=True, show_precision=True, to_file=None)" ] }, From 9f28bb28610415ac004fa5ef22266da616ea2a8a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 4 Feb 2025 20:15:18 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit hooks --- part6_cnns.ipynb | 1 + 1 file changed, 1 insertion(+) diff --git a/part6_cnns.ipynb b/part6_cnns.ipynb index 94808635..6a78f0a8 100644 --- a/part6_cnns.ipynb +++ b/part6_cnns.ipynb @@ -715,6 +715,7 @@ "outputs": [], "source": [ "from hls4ml.model.profiling import numerical\n", + "\n", "numerical(model=model, hls_model=hls_model)" ] },