zhongyuan chen
zhongyuan chen

Reputation: 43

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

Upvotes: 0

Views: 523

Answers (1)

DJ001
DJ001

Reputation: 75

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!

Upvotes: 2

Related Questions