Google Cloud Professional Machine Learning Engineer — Question 38
You need to train a computer vision model that predicts the type of government ID present in a given image using a GPU-powered virtual machine on Compute
Engine. You use the following parameters:
✑ Optimizer: SGD
✑ Image shape = 224ֳ—224
✑ Batch size = 64
✑ Epochs = 10
✑ Verbose =2
During training you encounter the following error: ResourceExhaustedError: Out Of Memory (OOM) when allocating tensor. What should you do?
Answer options
- A. Change the optimizer.
- B. Reduce the batch size.
- C. Change the learning rate.
- D. Reduce the image shape.
Correct answer: B
Explanation
The correct action is to reduce the batch size, as this will decrease the amount of memory required during training. Changing the optimizer (A), altering the learning rate (C), or decreasing the image shape (D) may not directly address the memory issue, whereas lowering the batch size effectively mitigates the out-of-memory error.