Skip to content
This repository has been archived by the owner on Jun 28, 2022. It is now read-only.

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

Open
SefaZeng opened this issue Mar 12, 2018 · 1 comment

Comments

@SefaZeng
Copy link

when i run the get_ini_cell, there is something wrong with the function about InitialState = cell.zero_state(batch_size,tf.float32)
The tensorflow version is 1.4
I wanna ask what can i do for the code cause my code is the same as others,but they dont meet such probelms.
And when i run the build_nn,it also says ValueError: Dimensions must be equal, but are 512 and 556 for 'rnn/while/rnn/multi_rnn_cell/cell_0/cell_0/basic_lstm_cell/MatMul_1' (op: 'MatMul') with input shapes: [128,512], [556,1024].

@guoqingzhi
Copy link

you can change this:

cell.zero_state(batch_size,tf.float32)

to

batch_size = tf.placeholder(tf.int32, [], name='batch_size')
cell.zero_state(batch_size, tf.float32)

it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants