Python 使用Keras后端函数时InvalidArgumentError
我正在使用Keras后端函数计算强化学习设置中的梯度,下面是代码片段。对于这段代码,我得到了一个错误,如下所示。原因可能是什么Python 使用Keras后端函数时InvalidArgumentError,python,keras,reinforcement-learning,keras-layer,keras-rl,Python,Keras,Reinforcement Learning,Keras Layer,Keras Rl,我正在使用Keras后端函数计算强化学习设置中的梯度,下面是代码片段。对于这段代码,我得到了一个错误,如下所示。原因可能是什么 1 X = K.placeholder(shape=(None, 32, 32, 3)) 2 train_fxn = K.function([X], [], updates=updates) 3 X = self.states[0].reshape(1, 32, 32, 3) 4 train_fxn([X
1 X = K.placeholder(shape=(None, 32, 32, 3))
2 train_fxn = K.function([X], [], updates=updates)
3 X = self.states[0].reshape(1, 32, 32, 3)
4 train_fxn([X])
错误是
InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'sequential_2_input_1' with dtype float and shape [?,32,32,3]
[[Node: sequential_2_input_1 = Placeholder[dtype=DT_FLOAT, shape=[?,32,32,3], _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
它抱怨您提供的向量不是正确的形状,就是包含除浮动以外的值
您将值
None
传递给第1行上的向量,这可能导致错误 @r-f-nelson你能再详细解释一下吗?在第3行,X是一个充满浮点数的RGB图像。