TensorFlow Cheat Sheet 2026
The 30 highest-yield TensorFlow facts, distilled from real exam questions. Print it, save it as a PDF, or study it here β free, no sign-up.
- Which metric should you use when testing a TensorFlow model on a highly imbalanced binary classification dataset? β F1-Score or AUC-ROC
- Which technique trains a model in multiple steps with increasing dataset sizes? β Curriculum learning
- What is the purpose of tf.keras.callbacks.CSVLogger during model evaluation training runs? β Appends epoch-level metrics to a CSV file for later analysis
- What must be true about a model before calling model.load_weights() successfully? β Its layer shapes must match those of the saved weights
- In TensorFlow, tf.keras.metrics.SparseCategoricalAccuracy is preferred over CategoricalAccuracy when: β Labels are integer class indices rather than one-hot vectors
- What does dataset.repeat(3) do in tf.data? β Iterates through the dataset 3 times
- Batch normalization is useful due to? β It normalizes (adjustments) all the input earlier than sending it to the subsequent layer
- In model.evaluate(), the steps parameter controls what? β Number of batches to draw from the dataset
- What is mixed precision training in TensorFlow? β Using float16 for computations and float32 for weights to speed up training
- What does the num_parallel_calls parameter in dataset.map() do? β Parallelizes the map transformation across multiple CPU threads
- What is the purpose of tf.data.Dataset.batch() when preparing test data? β Groups samples into mini-batches for efficient evaluation
- What is the primary role of tf.train.CheckpointManager? β Limiting the number of checkpoints kept with max_to_keep
- Which TensorFlow constant creates a 3Γ3 identity matrix? β tf.eye(3)
- What is the purpose of tf.debugging.assert_shapes()? β Verifies tensor shapes match expectations and raises an error if not
- Which of the following functions should not be used to classify an image at the output layer? β ReLU
- What is the purpose of the ModelCheckpoint callback? β Saves the model at specified intervals or when performance improves
- Which function creates a tf.data.Dataset from a list of NumPy arrays? β tf.data.Dataset.from_tensor_slices()
- Which attribute gives you the number of elements in a TensorFlow tensor? β tf.size()
- What does model.evaluate() return when a model is compiled with multiple metrics? β A list where the first element is loss followed by each metric value
- Which TensorFlow Model Analysis (TFMA) concept allows you to evaluate metrics on slices of data? β SlicingSpec
- What is the purpose of a representative dataset in TFLite quantization? β Calibrates quantization scales for activations to minimize accuracy loss
- Which TensorFlow function creates a tensor filled with zeros? β tf.zeros()
- Which low-level TensorFlow function explicitly saves a model in SavedModel format? β tf.saved_model.save()
- What does the drop_remainder=True argument do in dataset.batch()? β Drops the last batch if it has fewer elements than the batch size
- Which Keras API allows building models with multiple inputs and outputs? β Functional API
- Which Keras layer performs 2D convolution for image processing? β Conv2D
- Which optimizer is recommended for training transformer-based models? β Adam with warmup learning rate schedule
- What type of object does tf.saved_model.load() return? β A trackable object containing the model's saved functions and variables
- A ______ is a network that includes feedback linkages from o/p to i/p as well as hidden layers. β Recurrent neural network
- Which operation performs element-wise multiplication in TensorFlow? β tf.multiply()
Turn these facts into recall:
Was this helpful?