Also you can use transforms.ToTensor() docs 27, this  transforms a PIL or numpy image in range [0,255] to tensor in range [0,1]
from torchvision.transforms import ToTensor
import torch
numpy_array = ... # your numpy array image with shape (224,224)
tensor = ToTensor()(numpy_array) #torch.Size([1, 224, 224])