Understanding sequential model output
In this exercise you will learn to use the keras.layers.GRU
layer. keras.layers.GRU
nicely wraps the functionality of a GRU to a Layer
object.
You will explore what the shape of the output of a GRU layer looks like and how it changes when different arguments are provided. It is rare to view the numerical vectors produced by a GRU in real life, but in order to use these layers in more complex models, you need to have a good understanding of the shapes of the outputs and how to get the desired output using various arguments.
Here you will have keras
, and numpy
(as np
) loaded already. You can access layers by calling keras.layers.<Layer>
or a model by calling keras.models.Model
.
This exercise is part of the course
Machine Translation with Keras
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Define the Input layer
inp = keras.layers.____(batch_shape=(____,____,5))
# Define a GRU layer that takes in inp as the input
gru_out1 = keras.layers.____(____)(____)
print("gru_out1.shape = ", gru_out1.____)