tensorflow.kerasを使用して完全接続モデルを作成しようとしています。これが私のコードです
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
しかしモデルを呼び出すと
model = load_model((120,))
このエラーが発生しています
'Dense' object has no attribute 'op'
これをどうすれば修正できますか?
ベストアンサー1
(x)
出力レイヤーの後に欠落があります。
output = Dense(10 , activation = 'softmax')(x)