Skip to main content
. 2021 Sep 9;21(18):6050. doi: 10.3390/s21186050
Listing 2. Python framework to automate the configuration and generation of the DNN model for a specific FPGA.

from DNN_framework_lib.layers import Inputlayer, Hiddenlayer, Outputlayer
from DNN_framework_lib.models import~Sequential

# Configuration
input_layer = Inputlayer(
 size=input_size,
 loop1="unrolling",
 loop3="pipeline_and_unrolling",
 input_layer="AXI-MM"
 output_layer="AXI-Stream"
)
hidden_layers = [
 Hidden_layer(
  size=layer2_size,
  loop3="pipeline_and_unrolling",
  input_layer="AXI-Stream",
  output_layer="AXI-MM"
 ),

...

 Hiddenlayer(
 size=layerN_size,
 loop1="unrolling"
]
output_layer = Outputlayer(
 size=output_size,
)
model = Sequential(board_name,...)
mode.add(input_layer)
for layer in hidden_layers:
 model.add(layer)
model.compile()