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

RuntimeError: GRU with linear_before_reset is not supported in Tensorflow. #853

Open
tulasiram58827 opened this issue Jan 14, 2021 · 10 comments

Comments

@tulasiram58827
Copy link

Please find the error log:

RuntimeError: in user code:

    /usr/local/lib/python3.6/dist-packages/onnx_tf/backend_tf_module.py:98 __call__  *
        output_ops = self.backend._onnx_node_to_tensorflow_op(onnx_node,
    /usr/local/lib/python3.6/dist-packages/onnx_tf/backend.py:289 _onnx_node_to_tensorflow_op  *
        return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
    /usr/local/lib/python3.6/dist-packages/onnx_tf/handlers/handler.py:58 handle  *
        cls.args_check(node, **kwargs)
    /usr/local/lib/python3.6/dist-packages/onnx_tf/handlers/backend/gru.py:68 args_check  *
        exception.OP_UNSUPPORTED_EXCEPT("GRU with linear_before_reset",
    /usr/local/lib/python3.6/dist-packages/onnx_tf/common/exception.py:50 __call__  *
        raise self._func(self.get_message(op, framework))

    RuntimeError: GRU with linear_before_reset is not supported in Tensorflow.

ONNX Version used - 1.8
ONNX-TF Version Used - 1.7

@chinhuang007
Copy link
Collaborator

This is a known limitation in conversion using Tensorflow APIs. The support status for onnx-tf 1.7 can be found here, https://github.com/onnx/onnx-tensorflow/blob/master/doc/support_status_v1_7_0.md

@tulasiram58827
Copy link
Author

Ok Are there any alternatives to bypass this error

@chinhuang007
Copy link
Collaborator

Change the GRU linear_before_reset to 0 or remove the attribute in onnx model. Contribution to support of this attribute is highly welcome!

@TingfengTang
Copy link

@chinhuang007, force the attribure linear_before_reset to 0 seems to cause some dimension error, is there any plan to support this feature, I saw tf.keras.layers.GRU has the argument reset_after=false, but I failed after trying.

@fancoltran
Copy link

any fix now? i still get the same error

@LXP-Never
Copy link

I had the same problem

1 similar comment
@yinzeq
Copy link

yinzeq commented Sep 27, 2022

I had the same problem

@nukelash
Copy link

I didn't experience any change in dimensions when forcing linear_before_reset to 0, but the values are definitely incorrect. It looks like there's a PR from years ago that solved this issue but was left to the wayside while waiting to update to tf2.0: #452 would love to see it updated as needed and implemented as it appears to be the only thing blocking pytorch -> tf conversion with GRUs at this point

@balaji-haridass
Copy link

balaji-haridass commented Dec 12, 2022

@ALL, did anyone find a way to resolve this issue? Any suggestions would help greatly. Thanks

@PINTO0309
Copy link

I think I have implemented it, but I don't know if it works correctly because I don't have enough ONNX files for testing.

It's a topic that's over a year old, so no one will be interested in it.

https://github.com/PINTO0309/onnx2tf/blob/main/onnx2tf/ops/GRU.py

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

9 participants