[Solved] RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dim

Error Messages:
tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

Error Reason:
Dimensional information mismatch

Original Code:

image = Image.open(image_path)

After modification:

image = Image.open(image_path).convert('RGB')

Read More: