How to extract patches from an image

I get this error:

RuntimeError: maximum size for tensor at dimension 3 is 3 but size is 32

when I have this code :

S = 128 # channel dim
W = 227 # width
H = 227 # height
batch_size = 10

x = image_new.unsqueeze(0)

size = 32 # patch size
stride = 32 # patch stride
patches = x.unfold(1, size, stride).unfold(2, size, stride).unfold(3, size, stride)
print(patches.shape)