0

次のようなモデルがありAutoEncoderます。

height, width = 28, 28

input_img = Input(shape=(height * width,))
encoding_dim = height * width//256

x = Dense(height * width, activation='relu')(input_img)

encoded1 = Dense(height * width//2, activation='relu')(x)
encoded2 = Dense(height * width//8, activation='relu')(encoded1)

y = Dense(encoding_dim, activation='relu')(encoded2)

decoded2 = Dense(height * width//8, activation='relu')(y)
decoded1 = Dense(height * width//2, activation='relu')(decoded2)

z = Dense(height * width, activation='sigmoid')(decoded1)
autoencoder = Model(input_img, z)

#encoder is the model of the autoencoder slice in the middle 
encoder = Model(input_img, y)
decoder = Model(y, z)
print(encoder)
print(decoder)

エンコーダー部分は上記のコードを使用して取得されますが、上記で追加したコードを使用してデコーダー部分を取得できません。

次のエラーが表示されます。

ValueError: Graph disconnected: cannot obtain value for tensor Tensor("input_39:0", shape=(?, 784), dtype=float32) at layer "input_39". The following previous layers were accessed without issue: []

その部品の入手方法を教えてください。

4

1 に答える 1