ValueError: prefix tensor must be either a scalar or vector, but saw tensor: Tensor("Placeholder:0", dtype=int32)
这是rnn cell的zero_state函数引起的,查了一下,得到的答案是
batch_size = tf.placeholder(dtype=tf.int32, [])
但是运行之后还是有问题 ....
SyntaxError: non-keyword arg after keyword arg
相信很多同学比较熟悉这个报错,类似于没有带默认参数的形参在带默认参数的形参后面引起的。因此查一下函数api
tf.placeholder(
dtype,
shape=None,
name=None
)
因此将上面的答案改为下面两种之一就可以了
batch_size = tf.placeholder(tf.int32, [])
batch_size = tf.placeholder(dtype=tf.int32, shape=[])