Recall & Review
beginner
What is the Functional API in TensorFlow?
The Functional API is a way to build neural networks by defining layers as functions and connecting them. It allows creating complex models with multiple inputs and outputs, unlike the simple sequential model.
Click to reveal answer
beginner
How do you define an input layer using the Functional API?
You use tf.keras.Input(shape=(input_shape,)) to create an input layer that specifies the shape of the input data.
Click to reveal answer
beginner
How do you connect layers in the Functional API?
You call a layer like a function on the output of the previous layer. For example, x = tf.keras.layers.Dense(10)(input_layer) connects a Dense layer to the input.
Click to reveal answer
beginner
How do you create a model using the Functional API?
You create a model by specifying inputs and outputs: model = tf.keras.Model(inputs=input_layer, outputs=output_layer).
Click to reveal answer
intermediate
Why use the Functional API instead of Sequential API?
The Functional API supports models with multiple inputs or outputs, shared layers, and non-linear topology, which the Sequential API cannot handle.
Click to reveal answer
Which TensorFlow function is used to define the input layer in the Functional API?
✗ Incorrect
tf.keras.Input() defines the input layer specifying the shape of the input data.
How do you connect layers in the Functional API?
✗ Incorrect
In the Functional API, layers are connected by calling them as functions on previous layers' outputs.
What is the correct way to create a model in the Functional API?
✗ Incorrect
You create a model by specifying the input and output layers explicitly.
Which of the following is a key advantage of the Functional API over the Sequential API?
✗ Incorrect
The Functional API supports complex architectures with multiple inputs and outputs.
What does the following code do? x = Dense(10)(input_layer)
✗ Incorrect
This code applies a Dense layer with 10 units to the input_layer, connecting them.
Explain how to build a simple neural network model using the Functional API in TensorFlow.
Think about how layers connect and how the model is finalized.
You got /3 concepts.
Describe the benefits of using the Functional API compared to the Sequential API.
Consider model complexity and flexibility.
You got /4 concepts.