Search code examples
kerastensorflow2.0keras-layer

Can't pass an Input layer into tf.keras.Model()


from tensorflow.keras.layers import Input
input_tensor = Input(shape = (10,))
tf.keras.Model(inputs = input_tensor)
    TypeError: ('Keyword argument not understood:', 'Inputs')

I am using tensorflow 2.0.0 from anaconda's package. This error occurs when assign value to outputs also. I tried input instead of outputs. But nothing work. Mainly, I want to be able to pass a list of input layers with one input layer accepting a sample weight.

Thanks


Solution

  • Primarily, you have an extra bracket.
    Regarding the problem, tf.keras only allows both inputs and outputs for instantiating a model.

    So, if you'd (and I really don't know why) want to create a model with only this tensor, then you should do

    tf.keras.Model(inputs = input_tensor, outputs = input_tensor)
    

    Hope this helped!