Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Advanced Deep Learning with Keras

Cursus bekijken

Oefeninstructies

  • Import the Input and Dense functions from keras.layers.
  • Create an input layer of shape 1.
  • Again, create a dense layer with 1 unit and pass input_tensor directly to it.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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 = ____(____)(____)
Code bewerken en uitvoeren