Which of the following is the main reason to use multi-GPU training in deep learning?
Think about what happens when you have more GPUs working together.
Multi-GPU training mainly speeds up training by dividing the workload across GPUs, allowing parallel processing of data batches.
What will be the output shape of the model predictions when using tf.distribute.MirroredStrategy with 2 GPUs on input batch size 8?
import tensorflow as tf strategy = tf.distribute.MirroredStrategy() with strategy.scope(): model = tf.keras.Sequential([ tf.keras.layers.Dense(10, activation='relu', input_shape=(5,)), tf.keras.layers.Dense(3, activation='softmax') ]) import numpy as np x = np.random.random((8, 5)).astype('float32') predictions = model(x) print(predictions.shape)
The batch size stays the same; the model outputs one prediction per input.
MirroredStrategy splits batches internally but the model output shape matches the input batch size. So output shape is (8, 3).
You have a model training on 1 GPU with batch size 32. You switch to 4 GPUs using MirroredStrategy. What is the best practice for setting the batch size?
Think about how batch size is split across GPUs.
When using 4 GPUs, increasing batch size to 128 keeps per-GPU batch size at 32, maintaining training stability.
After training a model with MirroredStrategy, you try to save the model using model.save('path') but get an error. What is the likely cause?
Think about where the model should be created for distributed training.
Model must be created inside the strategy scope to be properly wrapped for multi-GPU training and saving.
You want to train a large model on a single machine with 8 GPUs. Which TensorFlow distribution strategy is best suited for this scenario?
Consider the number of machines and GPUs involved.
MirroredStrategy is designed for synchronous training on multiple GPUs within a single machine.
