0
0
TensorFlowml~10 mins

Model summary and visualization in TensorFlow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print the summary of a TensorFlow Keras model.

TensorFlow
model = tf.keras.Sequential([tf.keras.layers.Dense(10, input_shape=(5,))])
model.[1]()
Drag options to blanks, or click blank then click option'
Asummary
Bfit
Ccompile
Dpredict
Attempts:
3 left
💡 Hint
Common Mistakes
Using fit() instead of summary() to print model details.
Trying to compile() or predict() to see the model structure.
2fill in blank
medium

Complete the code to visualize a TensorFlow Keras model architecture as a plot.

TensorFlow
from tensorflow.keras.utils import plot_model
plot_model(model, to_file='model.png', [1]=True)
Drag options to blanks, or click blank then click option'
Ashow_layers
Bshow_shapes
Cdisplay_shapes
Dplot_shapes
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect argument names like show_layers or display_shapes.
Forgetting to set show_shapes=True to see layer dimensions.
3fill in blank
hard

Fix the error in the code to correctly display the model summary.

TensorFlow
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(5, input_shape=(3,)))
model.[1]
Drag options to blanks, or click blank then click option'
Ashow_summary()
Bsummary
Csummary()
Dprint_summary()
Attempts:
3 left
💡 Hint
Common Mistakes
Omitting parentheses after summary.
Using non-existent methods like print_summary or show_summary.
4fill in blank
hard

Fill both blanks to create a plot of the model with shapes shown and saved to 'my_model.png'.

TensorFlow
plot_model(model, to_file='my_model.png', [1]=[2])
Drag options to blanks, or click blank then click option'
Ashow_shapes
BTrue
CFalse
Dshow_layer_names
Attempts:
3 left
💡 Hint
Common Mistakes
Using False instead of True to show shapes.
Using incorrect argument names like show_layer_names.
5fill in blank
hard

Fill all three blanks to print the model summary and save a plot with shapes shown and layer names shown.

TensorFlow
model.[1]()
plot_model(model, to_file='model_plot.png', [2]=[3])
Drag options to blanks, or click blank then click option'
Asummary
Bshow_shapes
CTrue
Dshow_layer_names
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting parentheses on summary.
Using show_layer_names instead of show_shapes to display shapes.