AttributeError: 'Tensor' object has no attribute '_keras_history'

前端 未结 4 1981
自闭症患者
自闭症患者 2020-12-17 10:36

I looked for all the \"\'Tensor\' object has no attribute ***\" but none seems related to Keras (except for TensorFlow: AttributeError: 'Tensor' object has no attrib

4条回答
  •  既然无缘
    2020-12-17 10:58

    Try this:

    def make_gan(GAN_in, model1, model2, model3):
        model1_out = model1(GAN_in)
        model1_out = Lambda(lambda x: K.round(x), output_shape=...)(model1_out)
        model2_out = model2([GAN_in, model1_out])
        GAN_out = model3(model2_out)
        GAN = Model(GAN_in, GAN_out)
        GAN.compile(loss=loss, optimizer=model1.optimizer, metrics=['binary_accuracy'])
        return GAN
    

提交回复
热议问题