1

I am using Keras backend function to compute the gradient in reinforcement learning set up and following is the snippet of code. For this code, I am getting an error which is below as well. What could be the reason for it?

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

Error is

       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"]()]]
thetna
  • 6,903
  • 26
  • 79
  • 113

1 Answers1

1

It’s complaining that the vector you supplied is either not the right shape or contains values other than floats.

You passed in a value of None to the vector on Line 1 which may be causing the error.

R.F. Nelson
  • 2,254
  • 2
  • 12
  • 24
  • @r-f-nelson Could you please elaborate a bit more? On Line 3, X is an RGB image filled with float numbers. – thetna Apr 30 '18 at 23:10