@ptrblck Thanks. But now error is
TypeError: pic should be PIL Image or ndarray. Got <class ‘torchvision.transforms.transforms.Resize’>
image_BW = Image.open(img_name_BW+'.bmp')
        image_BW  =transforms.Resize(224, 224)
        image_BW=torchvision.transforms.functional.to_tensor(image_BW)

I converted before applying Resize. Still same error
image_BW=torchvision.transforms.transforms.ToPILImage(image_BW)