RuntimeError: size mismatch, m1: [1 x 1000000], m2: [784 x 125] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:961

import requests
from PIL import Image

url = ‘https://images.homedepot-static.com/productImages/007164ea-d47e-4f66-8d8c-fd9f621984a2/svn/architectural-mailboxes-house-letters-numbers-3585b-5-64_1000.jpg
response = requests.get(url, stream = True)
img = Image.open(response.raw)
plt.imshow(img)

img = PIL.ImageOps.invert(img)
img = img.convert(‘1’)
img = transform(img)
plt.imshow(im_convert(img))

img = img.view(img.shape[0], -1)
output = model(img)
_, pred = torch.max(output, 1)
print(pred.item())

I’m getting this error for the above code

RuntimeError: size mismatch, m1: [1 x 1000000], m2: [784 x 125] at /pytorch/aten/src/TH/generic/THTensorMath.cpp:961

Please someone can help me resolve this issue!!!

@ptrblck can you suggest something in here hoe to solve the issue!