[vta] [pynq] [tensorflow] Running TensorFlow models on PYNQ FPGA


#1

Hello, my goal is to simply run a CNN image recognition model built using TensorFlow on PYNQ FPGA using the tvm/vta stack.

More specifically, I’m working with the Inception V1 model found in this tutorial.

So far I have this:

with tf.gfile.FastGFile(model_path, 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())
    graph = tf.import_graph_def(graph_def, name='')
    # call the utility to import the graph definition into default graph.
    graph_def = tf_testing.ProcessGraphDefParam(graph_def)
    # add shapes to the graph
    with tf.Session() as sess:
        graph_def = tf_testing.AddShapesToGraphDef(sess, 'softmax')

sym, params = nnvm.frontend.from_tensorflow(graph_def)
graph = nnvm.graph.create(sym)
graph = vta.graph.clean_cast(graph)
graph = vta.graph.clean_conv_fuse(graph)

which produces this error:

Traceback (most recent call last):
  File "tvm_classifier.py", line 134, in <module>
generate_graph(graph_def)
  File "tvm_classifier.py", line 63, in generate_graph
graph = vta.graph.clean_cast(graph)
  File "/home/youn/tvm/vta/python/vta/graph.py", line 208, in clean_cast
elif op_name == "conv2d" and attrs["out_dtype"] == "int32":
KeyError: 'out_dtype'

I’m a beginner so any help would be appreciated. I’m using TensorFlow version 1.6.0 If this is relevant (newest version also produces same error).