0
input_feats = Input(shape=([fc_feats.shape[0]]))
def lam_reshape(inputs):
    return inputs
fc_feats_new = Lambda(lam_reshape)(input_feats)
fc_feats_new = K.reshape(fc_feats_new, [10, int(fc_feats_new.shape[1])])
fc_feats_new = sess.run(fc_feats_new)

got error: InvalidArgumentError (see above for traceback): You must feed a value for placeholder tensor 'input_54' with dtype float and shape [?,2048]

user10282036
  • 321
  • 2
  • 5
  • 13
  • You have a very similar question from yesterday: https://stackoverflow.com/questions/52816938/how-to-convert-numpy-array-to-keras-tensor Its better to update your question with new information than just asking a new one. – Dr. Snoopy Oct 16 '18 at 15:24
  • 1
    And secondly, what exactly are you trying to achieve with this code? You cannot evaluate a layer without an input. – Dr. Snoopy Oct 16 '18 at 15:24
  • Thanks Matias, so firstly the shape is (2048, ), I want to reshape it to (10, 2048), then convert it to numpy array. – user10282036 Oct 16 '18 at 23:00
  • 1
    You can't reshape (2048) into (10, 2048), because 2048 is not equal to 10 * 2048, and anyways you could do that in numpy, no need for kera to do this. As I said before, you can't compute outputs of layers without inputs. – Dr. Snoopy Oct 17 '18 at 08:55

0 Answers0