I have the same problem, and could you solve it?
I want to patch image using the unfold function, the commands as follows,
img = io.imread('02.png')
img = img[np.newaxis, :]
img = (np.pad(img, ((0, 0), (26, 26), (26, 26)), mode='constant')/255.).astype(np.float32)
img = torch.unsqueeze(torch.from_numpy(img), dim=0)

kc, kh, kw = 1, 64, 64  # kernel size
dc, dh, dw = 1, 64, 64  # stride

patches = img.unfold(1, kc, dc).unfold(2, kh, dh).unfold(3, kw, dw)
unfold_shape = patches.size()
patches = patches.contiguous().view(patches.size(0), -1, kh, kw)

and get the patched image as follow using the below commands,
fig, ax = plt.subplots(figsize=(8, 8), nrows=8, ncols=8)
plt.subplots_adjust(hspace=0.02, wspace=0.005)
for i, axes in enumerate(ax.ravel()):
    axes.imshow(patches[0, i]*70, vmin=0, vmax=70, cmap='pyart_NWSRef')
    axes.set_axis_off()

截屏2020-11-28 下午7.21.16916×898 131 KB