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

Problems with TF_GraphImportGraphDef while loading certain types of graphs #5059

Closed
juraj-bicikl opened this issue Oct 18, 2016 · 1 comment
Assignees

Comments

@juraj-bicikl
Copy link

I have experienced problems when using TF_GraphImportGraphDef to import
certain graphs with gradients from Python, and I suspect the function might have a bug.

The simplest example of a problematic graph is:

x = tf.placeholder(tf.float64, [1, 2], name="x")
y = tf.placeholder(tf.float64, [1, 2], name="y")
z = tf.add(x, y, name="z")

tf.gradients(z, [x, y])

When running TF_GraphImportGraphDef, I get the following error message:
Cannot infer multiple unknown dimensions in shape [?,?].

Surprisingly, if I change the shape of one of the inputs ([1, 2] => [None, 2]):

x = tf.placeholder(tf.float64, [None, 2], name="x")
y = tf.placeholder(tf.float64, [1, 2], name="y")
z = tf.add(x, y, name="z")

tf.gradients(z, [x, y])

everything works fine and I can successfully load the graph.
I don't see a reason why I am not allowed to load the graph in the first example.

I've made all the necessary checks and I am sure the graphs I create in Python
are correct (I can run them, and I get correct values for outputs and gradients).
Also, when I run the second graph (that was created in Python, and that I am able to load)
using C API, everything works fine.

@asimshankar
Copy link
Contributor

Thanks for the detailed report. This does seem to be a bug.

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