Specify the number of hidden recurrent layers in GRU model with Tensorflow Keras

88 views Asked by At

I want to create a GRU model with Keras. I can't understand the method to specify the number of hidden recurrent layers. I used the following code. According to what I understood, with this code we created an input layer with 64 neurons, a hidden layer with 64 neurons and an output layer with 4 neurons. I want to know is this correct? I also want to know how I can add other hidden layers.

    model = Sequential()
    model.add(m (units = units, return_sequences = True,
                input_shape = [X_train.shape[1], X_train.shape[2]]))
    model.add(Dropout(0.2))
    model.add(m (units = units))    
    model.add(Dropout(0.2))    
    model.add(Dense(4))
    #Compile model
    model.compile(loss='mse', optimizer=MyOptimizer(learning_rate=0.001))
    return model

model_gru = create_model(64, GRU)```
0

There are 0 answers