Variance caluculation for an image patch after converting to patch tensor and normal patch

i have calculated variance of an image patch after converting it to tensor and normal patch ,variance for both the same patch is differing Can anyone help me out .

Hi, could you please try posting some code to demonstrate what exactly you mean by normal?

A minimum executable snippet should be good, please.

def NonOverlappingCropPatches(img, patch_size=128, stride=128):
w, h = img.size
patches = ()
for i in range(0, h - stride, stride):
for j in range(0, w - stride, stride):
patch = img.crop((j, i, j + patch_size, i + patch_size))
patches = patches + (patch,)
return patches

patches = []
img = Image.open(r"D:\GITHUB\CNNIQA-NEW\bikes.bmp").convert(ā€˜Lā€™)
patches = NonOverlappingCropPatches(img,8,8)
print(patches[0])
im=[99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 98, 99, 99, 100, 100, 100, 93, 96, 95, 99, 100, 104, 112, 118, 96, 99, 102, 100, 100, 106, 112, 119, 102, 102, 103, 103, 99, 104, 110, 114, 103, 106, 106, 103, 102, 106, 104, 107, 109, 109, 106, 103, 104, 103, 100, 103]
var1=statistics.variance(im)
print(var1)