🚀 LEVEL UP TO SENIOR:Unlock 500+ Advanced Practical Challenges & Exercises.
🎓 COURSERA PARTNER:Earn professional Google, Meta, and IBM certificates to supercharge your resume.

Project 24: Model Load & Verify

ML Engineer

Builds on these lessons

Current Task

Objective

tf.keras.models.load_model() restores a previously saved model, layers and all, ready to use again without redefining it.

Task: save a model, then load it back and print how many layers it has.

index.py
import tensorflow as tf from tensorflow.keras import layers, Sequential model = Sequential([layers.Dense(1, input_shape=(1,))]) model.save('calendar_model.keras') loaded_model = tf.keras.models.load_model('calendar_model.keras') print(len(loaded_model.layers))

* Hint: Correct characters turn green, incorrect ones turn red.

Live Preview
🖼️

Verify your code to see the preview