I am trying to make a fully connected model using tensorflow.keras, here is my code
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Input, Dense, Flatten
def load_model(input_shape):
input = Input(shape = input_shape)
dense_shape = input_shape[0]
x = Flatten()(input)
x = Dense(dense_shape, activation='relu')(x)
x = Dense(dense_shape, activation='relu')(x)
x = Dense(dense_shape, activation='relu')(x)
x = Dense(dense_shape, activation='relu')(x)
x = Dense(dense_shape, activation='relu')(x)
output = Dense(10, activation='softmax')
model = Model(input , output)
model.summary()
return model
but when I call the model
model = load_model((120,))
I have this error
'Dense' object has no attribute 'op'
How can I fix this?
You are missing (x)
after your output layer. Try
output = Dense(10 , activation = 'softmax')(x)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With