How to output dense layer?

Hello, I am training a neural network using the following code (Keras):

n_classes = 106
input_layer = Input(shape=(n_classes,))

#I want to output this layer
dense_layer = Dense(80, activation='softmax')(input_layer)

output_layer = Dense(n_classes, activation='softmax')(dense_layer)
model = Model(inputs=input_layer, outputs=[output_layer])

The input has 106 classes, but I want to output the dense layer which is smaller than that (80).
How can I do that?

Hi @ardito.bryan

Welcome to the TensorFlow Forum!

You need to provide the dataset shape inside the input layers as input_shape. Could you please provide us the details on dataset shape, dataset type you are using and what is the objective of the model? Thank you.

1 Like