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

ReverseV2 is not supported #905

Closed
Zrufy opened this issue Apr 30, 2020 · 4 comments · Fixed by #909
Closed

ReverseV2 is not supported #905

Zrufy opened this issue Apr 30, 2020 · 4 comments · Fixed by #909

Comments

@Zrufy
Copy link

Zrufy commented Apr 30, 2020

when i'm trying to convert my pb with opset = 9 i obtain this error

ERROR - Tensorflow op [bidirectional_1/ReverseV2: ReverseV2] is not supported
ERROR - Tensorflow op [bidirectional_1/ReverseV2_1: ReverseV2] is not supported
ERROR - Tensorflow op [bidirectional_2/ReverseV2: ReverseV2] is not supported
ERROR - Tensorflow op [bidirectional_2/ReverseV2_1: ReverseV2] is not supported

Layer gru caused this problem?

with opset 10 or 11

ValueError: make_sure failure: shape of axis 1 is unknown

AttributeError: 'NoneType' object has no attribute 'get_node_by_output'
@guschmue
Copy link
Contributor

what tf version was the model generated with ? I think with tf-1.15 we see this ReverseV2 being used so you'd need opset-10 or better.
Can you send us the stack trace for the failure on opset-10 ?

@Zrufy
Copy link
Author

Zrufy commented Apr 30, 2020

sorry for poor information.Tensorflow version is 1.14 the failure i obtain is

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/tfonnx.py", line 352, in tensorflow_onnx_mapping
    func(g, node, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/onnx_opset/tensor.py", line 1396, in version_10
    , "ReverseSequence batch size for axis {} is unknown".format(axis))
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/utils.py", line 290, in make_sure
    raise ValueError("make_sure failure: " + error_msg % args)
ValueError: make_sure failure: ReverseSequence batch size for axis 0 is unknown

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/stiv/lpr/convert_keras_to_uff.py", line 14, in <module>
    keras2onnx.convert_keras(model, model.name)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/main.py", line 102, in convert_keras
    parse_graph(topology, sess.graph, target_opset, output_names)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/parser.py", line 667, in parse_graph
    return _parse_graph_scope(graph, keras_layer_ts_map, topo, top_level, output_names)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/parser.py", line 626, in _parse_graph_scope
    _infer_graph_shape(topology, top_scope, varset)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/parser.py", line 389, in _infer_graph_shape
    _finalize_tf2onnx_op(topology, oop, varset)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/parser.py", line 359, in _finalize_tf2onnx_op
    g = tf2onnx_wrap(topo, subgraph, outputs, varset.target_opset)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/wrapper.py", line 32, in tf2onnx_wrap
    raise e
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/wrapper.py", line 26, in tf2onnx_wrap
    output_names=outputs)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/tfonnx.py", line 571, in process_tf_graph
    mapped_op, unmapped_op, exceptions = tensorflow_onnx_mapping(g, ops_mapping)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/tfonnx.py", line 355, in tensorflow_onnx_mapping
    logger.error("Failed to convert node %s\n%s", node.name, node.summary, exc_info=1)
  File "/usr/local/lib/python3.6/dist-packages/keras2onnx-1.5.2-py3.6.egg/keras2onnx/ktf2onnx/tf2onnx/graph.py", line 172, in summary
    node = g.get_node_by_output(name)
AttributeError: 'NoneType' object has no attribute 'get_node_by_output'

@jignparm
Copy link
Contributor

jignparm commented May 5, 2020

It looks like the shape information for the node (at conversion time) is dynamic (i.e. -1).
https://github.com/onnx/tensorflow-onnx/blob/master/tf2onnx/onnx_opset/tensor.py#L1715

Will need to rewrite the algorithm/mapping to see if dynamic shape can be accepted, without making the operator too inefficient. Will update shortly on this.

@jignparm
Copy link
Contributor

jignparm commented May 6, 2020

This should be fixed by #909.

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

Successfully merging a pull request may close this issue.

3 participants