1. Learn
  2. /
  3. Courses
  4. /
  5. Machine Translation with Keras

Connected

Exercise

Understanding the RepeatVector layer

You will now explore how the RepeatVector layer works. The RepeatVector layer adds an extra dimension to your dataset. For example if you have an input of shape (batch size, input size) and you want to feed that to a GRU layer, you can use a RepeatVector layer to convert the input to a tensor with shape (batch size, sequence length, input size).

In this exercise, you will define a model that repeats a given input a fixed number of times. You will then feed a numpy array to the model and investigate how the model changes the output.

Instructions

100 XP
  • Define a RepeatVector layer that repeats the input 6 times.
  • Define a Model that takes the input layer in and produces the repeat vector output.
  • Define a numpy array object that has data [[0,1], [2,3]].
  • Predict the output of the model by feeding x as an input.