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

[Frontend][Tensorflow] Fix TF 1.15 conv2d_transpose parsing #6589

Merged
merged 2 commits into from
Oct 11, 2020

Conversation

jtuyls
Copy link
Contributor

@jtuyls jtuyls commented Sep 29, 2020

Fix for Tensorflow 1.15.0 conv2d_transpose parsing. Specifically, attr["_output_shapes"][0] can be None.

Following snippet can be used to create a model for reproducing the bug (run with TF 1.15.0):

import tensorflow as tf

output_shape = [1, 8, 8, 128]
strides = [1, 2, 2, 1]

x = tf.compat.v1.placeholder(tf.float32, shape=[1, 32, 32, 4])
w = tf.constant(0.1, shape=[7, 7, 128, 4])
ct = tf.nn.conv2d_transpose(x, w, output_shape=output_shape, strides=strides, padding='SAME')

graph_def = tf.compat.v1.get_default_graph().as_graph_def()
with tf.io.gfile.GFile('conv2d_transpose_tf1_15.pb', "wb") as f:
    f.write(graph_def.SerializeToString())

In general, I think it might be useful to adjust the CI to run the frontend tests with multiple versions of the the external frameworks to verify compatibility with the versions we want to support?

@siju-samuel @masahi, could you have a look?

Copy link
Member

@siju-samuel siju-samuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtuyls Good catch. Thanks for the contribution.
Can you add a testcase convering this scenario as well?

python/tvm/relay/frontend/tensorflow.py Show resolved Hide resolved
@jtuyls
Copy link
Contributor Author

jtuyls commented Sep 30, 2020

@siju-samuel I guess this issue is really caused by not using AddShapesToGraphDef but I think it's still useful to include the small changes to cover this case. So I added checks for that to the Tensorflow convolution tests. Could you have a look?

Additionally, we could maybe add tests for this case to the other operations?

Copy link
Member

@siju-samuel siju-samuel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tqchen tqchen merged commit bf21371 into apache:master Oct 11, 2020
@tqchen
Copy link
Member

tqchen commented Oct 11, 2020

Thanks @jtuyls @siju-samuel

TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Oct 13, 2020
)

* Fix conv2d_transpose parsing in Tensorflow frontend for TF 1.15

* Add comments and convolution tests without AddShapesToGraphDef
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Oct 14, 2020
)

* Fix conv2d_transpose parsing in Tensorflow frontend for TF 1.15

* Add comments and convolution tests without AddShapesToGraphDef
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Oct 15, 2020
)

* Fix conv2d_transpose parsing in Tensorflow frontend for TF 1.15

* Add comments and convolution tests without AddShapesToGraphDef
TusharKanekiDey pushed a commit to TusharKanekiDey/tvm that referenced this pull request Oct 16, 2020
)

* Fix conv2d_transpose parsing in Tensorflow frontend for TF 1.15

* Add comments and convolution tests without AddShapesToGraphDef
trevor-m pushed a commit to neo-ai/tvm that referenced this pull request Oct 19, 2020
)

* Fix conv2d_transpose parsing in Tensorflow frontend for TF 1.15

* Add comments and convolution tests without AddShapesToGraphDef
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 this pull request may close these issues.

3 participants