|
737 | 737 | "source": [ |
738 | 738 | "# Then the QKeras model\n", |
739 | 739 | "hls_config_q = hls4ml.utils.config_from_keras_model(qmodel, granularity='name', backend='Vitis')\n", |
740 | | - "hls_config_q['Model']['ReuseFactor'] = 1\n", |
741 | | - "hls_config['Model']['Precision'] = 'ap_fixed<16,6>'\n", |
742 | | - "hls_config_q['LayerName']['output_softmax']['Strategy'] = 'Stable'\n", |
| 740 | + "\n", |
743 | 741 | "plotting.print_dict(hls_config_q)\n", |
744 | 742 | "\n", |
745 | | - "cfg_q = hls4ml.converters.create_config(backend='Vitis')\n", |
746 | | - "cfg_q['IOType'] = 'io_stream' # Must set this if using CNNs!\n", |
747 | | - "cfg_q['HLSConfig'] = hls_config_q\n", |
748 | | - "cfg_q['KerasModel'] = qmodel\n", |
749 | | - "cfg_q['OutputDir'] = 'quantized_pruned_cnn/'\n", |
750 | | - "cfg_q['XilinxPart'] = 'xcu250-figd2104-2L-e'\n", |
| 743 | + "hls_model_q = hls4ml.converters.convert_from_keras_model(\n", |
| 744 | + " qmodel, hls_config=hls_config_q, output_dir='quantized_pruned_cnn', backend='Vitis', io_type='io_stream'\n", |
| 745 | + ")\n", |
751 | 746 | "\n", |
752 | | - "hls_model_q = hls4ml.converters.keras_to_hls(cfg_q)\n", |
753 | 747 | "hls_model_q.compile()" |
754 | 748 | ] |
755 | 749 | }, |
|
1321 | 1315 | "name": "python", |
1322 | 1316 | "nbconvert_exporter": "python", |
1323 | 1317 | "pygments_lexer": "ipython3", |
1324 | | - "version": "3.11.11" |
| 1318 | + "version": "3.11.9" |
1325 | 1319 | } |
1326 | 1320 | }, |
1327 | 1321 | "nbformat": 4, |
|
0 commit comments