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

bug:TypeError: Fetch argument #1

Closed
amoliu opened this issue Oct 31, 2016 · 3 comments
Closed

bug:TypeError: Fetch argument #1

amoliu opened this issue Oct 31, 2016 · 3 comments

Comments

@amoliu
Copy link

amoliu commented Oct 31, 2016

hi , I got the following issues, when I running the program. Please help fix it :) thanks.
Traceback (most recent call last):
File "/home/amo2/git/prog_nn/prog_nn.py", line 195, in
test_ProgNN()
File "/home/amo2/git/prog_nn/prog_nn.py", line 154, in test_ProgNN
feed_dict={col_0.o_n:fake1})
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 340, in run
run_metadata_ptr)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 523, in _run
processed_fetches = self._process_fetches(fetches)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/client/session.py", line 493, in _process_fetches
% (subfetch, fetch, type(subfetch), str(e)))
TypeError: Fetch argument [<tf.Tensor 'Placeholder:0' shape=(?, 128) dtype=float64>, <tf.Tensor 'Relu:0' shape=(?, 100) dtype=float64>, <tf.Tensor 'Relu_1:0' shape=(?, 64) dtype=float64>, <tf.Tensor 'Relu_2:0' shape=(?, 25) dtype=float64>, <tf.Tensor 'Softmax:0' shape=(?, 9) dtype=float64>] of [<tf.Tensor 'Placeholder:0' shape=(?, 128) dtype=float64>, <tf.Tensor 'Relu:0' shape=(?, 100) dtype=float64>, <tf.Tensor 'Relu_1:0' shape=(?, 64) dtype=float64>, <tf.Tensor 'Relu_2:0' shape=(?, 25) dtype=float64>, <tf.Tensor 'Softmax:0' shape=(?, 9) dtype=float64>] has invalid type <type 'list'>, must be a string or Tensor. (Can not convert a list into a Tensor or Operation.)

@odellus
Copy link
Contributor

odellus commented Oct 31, 2016

It looks like your copy of tensorflow doesn't want a list as input for the fetch argument to session.run.
What version of tensorflow are you using? To find out run
python -c "import tensorflow as tf;print(tf.__version__)"

Right now I'm not planning to support versions of tensorflow older than 0.11 since the code is mostly a learning exercise.

Try swapping
h_0 = col_0.session.run(col_0.h, feed_dict={col_0.o_n:fake1})
for
h_0 = col_0.session.run([col_0.h], feed_dict={col_0.o_n:fake1})

on line 154 since your version of TF is asking for a Tensor. If that works you'll need to do the same for all the fetch arguments.

@amoliu
Copy link
Author

amoliu commented Oct 31, 2016

thanks very much for quickly replying.
after upgrading the tf from 0.8 to 11.0, the issue have gone .

@yinghuochong:~/git/prog_nn$ python -c "import tensorflow as tf;print(tf.version)"
0.8.0

@amoliu amoliu closed this as completed Oct 31, 2016
@odellus
Copy link
Contributor

odellus commented Oct 31, 2016

You're most welcome!

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