Session Ready
Exercise

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.

Instructions 1/3
undefined XP
  • 1
  • 2
  • 3
  • Create an Input layer of batch size 3, 20 time steps and 5 dimensions and call it inp.
  • Create a GRU layer of hidden size 10, pass the inp to this layer and print the shape of the output.