Faref
Faref

Reputation: 63

Result of Dense layer in keras

print(model.layers[312].output)

outputs (None,2048)

layer 312 code

Dense(2048, activation='relu',name='first_dense')

number of samples is 8732. I need the output of first_dense layer in shape of (8732,2048). In other words, I need the result of this layer in all samples. How can do it??

Thanks in advance!!

Upvotes: 1

Views: 165

Answers (1)

Marco Cerliani
Marco Cerliani

Reputation: 22031

you can create a sub-model and make predictions

new_model = Model(model.input, model.layers[312].output)
new_model.predict(...)

Upvotes: 1

Related Questions