Skip to content

Commit bb40bbc

Browse files
committed
fix some overlooked issues with cnn tutorial
1 parent 96dd631 commit bb40bbc

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

part6_cnns.ipynb

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
"metadata": {},
3939
"outputs": [],
4040
"source": [
41+
"import os\n",
4142
"import matplotlib.pyplot as plt\n",
4243
"import numpy as np\n",
4344
"import time\n",
@@ -645,10 +646,10 @@
645646
"cell_type": "markdown",
646647
"metadata": {},
647648
"source": [
648-
"Now, we need to define the hls4ml and Vivado configurations. Two things will change with respect to what was done in the previous exercises. First, we will use ``IOType= 'io_stream'`` in the Vivado configuration.\n",
649+
"Now, we need to define the hls4ml and Vivado configurations. Two things will change with respect to what was done in the previous exercises. First, we will use ``io_type='io_stream'`` in the Vitis_HLS configuration.\n",
649650
"\n",
650651
"---\n",
651-
"****You must use ``IOType= 'io_stream'`` if attempting to synthesize a large convolutional neural network.****\n",
652+
"****You must use ``io_type='io_stream'`` if attempting to synthesize a large convolutional neural network.****\n",
652653
"\n",
653654
"---\n",
654655
"The CNN implementation in hls4ml is based on streams, which are synthesized in hardware as first in, first out (FIFO) buffers. Shift registers are used to keep track of the last ``<kernel height - 1>`` rows of input pixels, and maintains a shifting snapshot of the convolution kernel.\n",
@@ -678,10 +679,7 @@
678679
"\n",
679680
"\n",
680681
"hls_model = hls4ml.converters.convert_from_keras_model(\n",
681-
" model, hls_config=hls_config, backend='Vitis', output_dir='model_1/hls4ml_prj', part='xcu250-figd2104-2L-e'\n",
682-
")\n",
683-
"hls_model = hls4ml.converters.keras_to_hls(\n",
684-
" model, config=hls_config, output_dir='pruned_cnn', backend='Vitis', part='xcu250-figd2104-2L-e', io_type='io_stream'\n",
682+
" model, hls_config=hls_config, backend='Vitis', output_dir='model_1/hls4ml_prj', part='xcu250-figd2104-2L-e', io_type='io_stream'\n",
685683
")\n",
686684
"hls_model.compile()"
687685
]
@@ -878,10 +876,6 @@
878876
"metadata": {},
879877
"outputs": [],
880878
"source": [
881-
"import os\n",
882-
"\n",
883-
"os.environ['PATH'] = '/opt/Xilinx//Vitis_HLS/2024.1/bin:' + os.environ['PATH']\n",
884-
"\n",
885879
"synth = False # Only if you want to synthesize the models yourself (>1h per model) rather than look at the provided reports.\n",
886880
"if synth:\n",
887881
" hls_model.build(csim=False, synth=True, vsynth=True)\n",
@@ -1320,7 +1314,7 @@
13201314
"name": "python",
13211315
"nbconvert_exporter": "python",
13221316
"pygments_lexer": "ipython3",
1323-
"version": "3.10.16"
1317+
"version": "3.11.11"
13241318
}
13251319
},
13261320
"nbformat": 4,

0 commit comments

Comments
 (0)