Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert keras model to tvm error #4655

Closed
yueyihua opened this issue Jan 8, 2020 · 1 comment
Closed

convert keras model to tvm error #4655

yueyihua opened this issue Jan 8, 2020 · 1 comment

Comments

@yueyihua
Copy link

yueyihua commented Jan 8, 2020

When I convert a keras model to tvm, an error occur:
Traceback (most recent call last):

File "traffic_cnn_keras_tvm_dbg.py", line 225, in
mod, params = relay.frontend.from_keras(keras_model, shape_dict)

File "/home/yyh/3rdparty/tvm/python/tvm/relay/frontend/keras.py", line 821, in from_keras
zip_node = zip(node.node_indices, node.tensor_indices, node.inbound_layers)

TypeError: zip argument #1 must support iteration

My code:
`x = np.ones([1, 1, IMAGE_SIZE, IMAGE_SIZE])
shape_dict = {'conv2d_input': x.shape}
mod, params = relay.frontend.from_keras(keras_model, shape_dict)

compile the model

target = 'cuda'
ctx = tvm.gpu(0)
with relay.build_config(opt_level=3):
executor = relay.build_module.create_executor('graph', mod, ctx, target)
graph, lib, params = relay.build_module.build(mod, target, params=params)
lib.export_library("./deploy_lib.so")
print('lib export succeefully')
with open("./deploy_graph.json", "w") as fo:
fo.write(graph.json())
with open("./deploy_param.params", "wb") as fo:
fo.write(nnvm.compiler.save_param_dict(params))
`

@tqchen
Copy link
Member

tqchen commented Jan 8, 2020

Thanks for reporting the problem, the community uses https://discuss.tvm.ai/ as a way to collective resolve these questions. Please open a new troubleshooting thread there

@tqchen tqchen closed this as completed Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants