tvm: [RELAY][Bug] 'name_hint' AttributeError issue when covert tensorflow to TVM

This issue happens when converting tf.tile and tf.transpose with relay.frontend.from_tensorflow

My environment is: develop: python3.6, tensorflow1.14 convert to TVM: container of tvmai/demo-gpu

Here’s the error log for converting code which contains tf.transpose:

Traceback (most recent call last):

  File "read_pb_to_TVM_test.py", line 80, in <module>
    shape=shape_dict)

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 2372, in from_tensorflow
    mod, params = g.from_tensorflow(graph, layout, shape, outputs)

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 2017, in from_tensorflow
    op = self._convert_operator(node.op, inputs, attr, graph)

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 2335, in _convert_operator
    sym = convert_map[op_name](inputs, attrs, self._params)

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 932, in _impl
    axes = _get_list_param(params, inputs[1])

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 96, in _get_list_param
    return _get_param(params, input_node).tolist()

  File "/usr/tvm/python/tvm/relay/frontend/tensorflow.py", line 90, in _get_param
    return params.pop(input_node.name_hint).asnumpy()

  File "/usr/tvm/python/tvm/_ffi/_ctypes/node.py", line 75, in __getattr__
    "'%s' object has no attribute '%s'" % (str(type(self)), name))

AttributeError: '<class 'tvm.relay.expr.Call'>' object has no attribute 'name_hint'

thanks!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 19 (6 by maintainers)

Most upvoted comments

We saw the issue these days. @kevinthesun has a fix locally for the similar issue.

@yongwww Here’s my ONNX (PyTorch) model: matrixnew.zip Error happens when I compile the model by following this https://docs.tvm.ai/tutorials/frontend/from_onnx.html

Don’t know if I should create a new issue for this as it looks pretty similar.

Haven’t found a fix yet as I don’t know how to change the ONNX scale parameters in the model.

EDIT:

Someone already brought up the Resize operator missing issue: https://discuss.tvm.ai/t/relay-onnx-frontend-implement-resize-operation/5131/7

With this one fixing it: https://github.com/apache/incubator-tvm/pull/4536

So this should only fix the PyTorch resize error. If you have ONNX v9 you can just update it through https://github.com/onnx/onnx/blob/master/docs/PythonAPIOverview.md#converting-version-of-an-onnx-model-within-default-domain-aionnx