【问题标题】:InvalidArgumentError while using Keras backend function使用 Keras 后端函数时出现 InvalidArgumentError
【发布时间】:2018-10-10 20:34:11
【问题描述】:

我正在使用 Keras 后端函数来计算强化学习设置中的梯度,以下是代码的 sn-p。对于此代码,我也收到以下错误。可能是什么原因?

       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"]()]]

【问题讨论】:

    标签: python keras reinforcement-learning keras-layer keras-rl


    【解决方案1】:

    它抱怨你提供的向量要么不是正确的形状,要么包含浮点数以外的值。

    您将 None 的值传递给第 1 行的向量,这可能会导致错误。

    【讨论】:

    • @r-f-nelson 你能详细说明一下吗?在第 3 行,X 是一个用浮点数填充的 RGB 图像。
    猜你喜欢
    • 1970-01-01
    • 2018-09-27
    • 2017-11-21
    • 1970-01-01
    • 2018-12-15
    • 2021-06-30
    • 2017-10-11
    • 2020-07-26
    • 1970-01-01
    相关资源
    最近更新 更多