Explore Library
Code QuizIntermediate

Padding a Color Image

Spot why padding this image corrupts its channel dimension.

Codepython
import numpy as np

# img has shape (H, W, 3)
padded = np.pad(img, 1, mode='constant')
print(padded.shape)  # expected (H+2, W+2, 3)

What is the bug in this padding call?