C. Model is not wrapped correctly with DataParallel
D. Input tensor dtype does not match model parameters dtype
Solution
Step 1: Analyze error message
Error says input tensor is Double but model expects Float tensors.
Step 2: Check input and model dtypes
Model parameters default to Float; input is Double, causing mismatch and error.
Final Answer:
Input tensor dtype does not match model parameters dtype -> Option D
Quick Check:
Dtype mismatch causes runtime error [OK]
Hint: Ensure input and model dtypes match before DataParallel [OK]
Common Mistakes:
Assuming DataParallel only works on CPU
Not checking tensor data types
Thinking batch size causes dtype errors
5. You want to speed up training on 4 GPUs using DataParallel. Your model has a batch normalization layer. What should you be careful about to avoid incorrect training behavior?
hard
A. BatchNorm layers behave differently in DataParallel; use SyncBatchNorm or move to DistributedDataParallel
B. DataParallel automatically fixes BatchNorm issues, no action needed
C. Remove BatchNorm layers before using DataParallel
D. Increase batch size to avoid BatchNorm problems
Solution
Step 1: Understand BatchNorm behavior in DataParallel
BatchNorm computes stats per device, which can cause inconsistent normalization across GPUs.
Step 2: Recommended solutions
Use SyncBatchNorm to sync stats or switch to DistributedDataParallel for correct BatchNorm behavior.
Final Answer:
BatchNorm layers behave differently in DataParallel; use SyncBatchNorm or move to DistributedDataParallel -> Option A
Quick Check:
BatchNorm needs syncing or DDP for multi-GPU [OK]
Hint: BatchNorm needs syncing or DDP on multiple GPUs [OK]
Common Mistakes:
Assuming DataParallel handles BatchNorm correctly by default
Removing BatchNorm layers unnecessarily
Only increasing batch size without syncing stats
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.