Output layers
Output layers are simply Dense layers! Output layers are used to reduce the dimension of the inputs to the dimension of the outputs. You'll learn more about output dimensions in chapter 4, but for now, you'll always use a single output in your neural networks, which is equivalent to Dense(1)
or a dense layer with a single unit.
This exercise is part of the course
Advanced Deep Learning with Keras
Exercise instructions
- Import the
Input
andDense
functions fromkeras.layers
. - Create an input layer of shape 1.
- Again, create a dense layer with 1 unit and pass
input_tensor
directly to it.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Load layers
____
# Input layer
input_tensor = ____(shape=(____,))
# Create a dense layer and connect the dense layer to the input_tensor in one step
# Note that we did this in 2 steps in the previous exercise, but are doing it in one step now
output_tensor = ____(____)(____)