Session Ready
Exercise

Defining a multiple input model

In some cases, the sequential API will not be sufficiently flexible to accommodate your desired model architecture and you will need to use the functional API instead. If, for instance, you want to train two models with different architectures jointly, you will need to use the functional API to do this. In this exercise, we will see how to do this. We will also use the .summary() method to examine the joint model's architecture.

Note that keras has been imported from tensorflow for you. Additionally, the input layers of the first and second models have been defined as m1_inputs and m2_inputs, respectively. Note that the two models have the same architecture, but one of them uses a sigmoid activation in the first layer and the other uses a relu.

Instructions
100 XP
  • Pass model 1's input layer to its first layer and model 1's first layer to its second layer.
  • Pass model 2's input layer to its first layer and model 2's first layer to its second layer.
  • Use the add() operation to combine the second layers of model 1 and model 2.
  • Complete the functional model definition.