Project 9: Functional API Model Builder
ML Engineer
Builds on these lessons
Current Task
Objective
The Functional API builds a model by explicitly wiring layers together as function calls — needed for architectures Sequential can't express, like multiple inputs or branches.
Task: build the same small network using the Functional API and print its summary.
index.py
import tensorflow as tf
from tensorflow.keras import layers, Model
inputs = tf.keras.Input(shape=(4,))
x = layers.Dense(8, activation='relu')(inputs)
outputs = layers.Dense(1)(x)
model = Model(inputs=inputs, outputs=outputs)
print(model.summary())
* Hint: Correct characters turn green, incorrect ones turn red.
Live Preview
🖼️
Verify your code to see the preview