Skip to content

Commit

Permalink
Fix imports of profiling module
Browse files Browse the repository at this point in the history
  • Loading branch information
vloncar committed Feb 4, 2025
1 parent c62193d commit c4a8c62
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 5 additions & 3 deletions part2_advanced_config.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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])"
]
},
{
Expand All @@ -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)"
]
},
Expand Down Expand Up @@ -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)"
]
},
Expand Down
5 changes: 3 additions & 2 deletions part6_cnns.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
]
},
{
Expand Down Expand Up @@ -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)"
]
},
Expand Down

0 comments on commit c4a8c62

Please sign in to comment.