attr'T'的数据类型float32不在允许值列表中:int32,int64

2024-04-26 22:11:34 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经考虑过这两个帖子(thisthis),但它们不是我的问题和解决方案。我有以下代码在tf中创建前馈网络:

step = 500
fromState = 0
toState = 5000000
numOfState = (toState - fromState) / step
numOfAction = 11

tf.reset_default_graph()
inputs1 = tf.placeholder(shape=[1,numOfState], dtype = tf.float32)
W = tf.Variable(tf.random_uniform([numOfState,4],0,0.01),)
Qout = tf.matmul(inputs1,W)
predict = tf.argmax(Qout,1)

但是,我在Qout = tf.matmul(inputs1,W)这一行有以下错误:

TypeError: DataType float32 for attr 'T' not in list of allowed values: int32, int64

显然一切正常,但问题是这个错误是什么?它是从哪里来的?在


Tags: 代码网络tfstep错误解决方案this帖子