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

DRQN: Error prefix tensor must be either a scalar or vector #46

Open
ariewahyu opened this issue Jul 13, 2017 · 3 comments
Open

DRQN: Error prefix tensor must be either a scalar or vector #46

ariewahyu opened this issue Jul 13, 2017 · 3 comments

Comments

@ariewahyu
Copy link

I tried the DRQN for partial observations, but I got the error:

ValueError: prefix tensor must be either a scalar or vector, but saw tensor: Tensor("Placeholder_2:0", dtype=int32)

----Error happens in this line-------

self.state_in = rnn_cell.zero_state(self.batch_size, tf.float32)

@ariewahyu
Copy link
Author

ariewahyu commented Jul 14, 2017

I found that there are 3 consecutive lines:

self.batch_size = tf.placeholder(dtype=tf.int32)
self.convFlat = tf.reshape(slim.flatten(self.conv4),[self.batch_size,self.trainLength,h_size])
self.state_in = rnn_cell.zero_state(self.batch_size, tf.float32)

I change the line:

self.batch_size = tf.placeholder(dtype=tf.int32)

into:

self.batch_size = tf.placeholder(dtype=tf.int32,shape=[])

And it works.

@tylerlekang
Copy link

Thank you!!!! I thought for sure the code was doomed, per tensorflow/tensorflow#10213

But this fix is correct and worked for me, too!

Really hope @awjuliani can fix in the code (modify literally one line), thank you sir!

@awjuliani
Copy link
Owner

Just made the change! Thanks for pointing this out.

@awjuliani awjuliani reopened this Aug 15, 2017
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

3 participants