0
0
TensorFlowml~5 mins

Functional API basics in TensorFlow - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
Atf.keras.Input()
Btf.keras.Layer()
Ctf.keras.Sequential()
Dtf.keras.Dense()
How do you connect layers in the Functional API?
ABy stacking layers sequentially only
BBy adding layers to a list
CBy calling one layer as a function on the output of another layer
DBy using a for loop
What is the correct way to create a model in the Functional API?
Atf.keras.Sequential()
Btf.keras.Model(inputs=input_layer, outputs=output_layer)
Ctf.keras.Model() without inputs or outputs
Dtf.keras.Layer()
Which of the following is a key advantage of the Functional API over the Sequential API?
ASupports multiple inputs and outputs
BEasier to use for simple models
CAutomatically compiles the model
DRequires less code for sequential models
What does the following code do? x = Dense(10)(input_layer)
ACreates a new input layer
BDefines the output layer only
CCompiles the model
DConnects a Dense layer with 10 units to the input_layer
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.