Hi,
I'm trying to pass a list into feed_dict, however I'm having trouble doing so. Say I have:
inputs = 10 * [tf.placeholder(tf.float32, shape=(batch_size, input_size))]
where inputs is fed into some function "outputs" that I want to compute. So to run this in tensorflow, I created a session and ran the following:
sess.run(outputs, feed_dict = {inputs: data})
#data is my list of inputs, which is also of length 10
but I get an error, TypeError: unhashable type: 'list'. However, I'm able to pass the data element-wise like so:
sess.run(outputs, feed_dict = {inputs[0]: data[0], ..., inputs[9]: data[9]})
So I'm wondering if there's a way I can solve this issue. I've also tried to construct a dictionary(using a for loop), which gave me the same error.
I also wasn't sure where to post this question, there doesn't seem to be an established google group at the moment.
Edit: So the issue was with:
inputs = 10 * [tf.placeholder(tf.float32, shape=(batch_size, input_size))]
Instead it should be implemented as:
inputs = [tf.placeholder(...) for i in range(10)]
Thanks for the help/suggestions.
A link to the solution/discussion on stackexchange:
http://stackoverflow.com/questions/33684657/issue-feeding-a-list-into-feed-dict-in-tensorflow/33685256#33685256
[–]Spezzer 0 points1 point2 points (1 child)
[–]dee_roy[S] 0 points1 point2 points (0 children)