|
Listing 6. Pseudo-code of the our Python API for the Model creation. |
from DNN_framework_lib import Sequential
from pynq import Overlay
import~ctypes
class Sequential:
...
def __init__(self, board_name=None):
self.board_name = board_name
def load_model(self, interface):
...
def predict(self, X):
return self.interface.predict(X)
...
def Create_Model(bitstream, shared_library):
overlay = Overlay(bitstream) # load bitstream into FPGA
shared_lib = ctypes.CDLL(shared_library) # load lib into memory
interface = create_interface(shared_lib) # adpat C functions to the python
model = Sequential().load_model()
return model
|