Ah I see, I’ve not been using opencv because all of my images are just NxN arrays.
I’ve found that this works if using:
from PIL import Image
img = Image.fromarray(image.reshape(10,10), 'L')

In conjunction with your transforms.Grayscale method