@Nikronic
I changed everything to below code:
class MasksTrainDataset(Dataset):
    """Masks Train dataset."""

    def __init__(self, csv_file, root_dir, transform=None):
        """
        Args:
            csv_file (string): Path to the csv file with annotations.
            root_dir (string): Directory with all the images.
            transform (callable, optional): Optional transform to be applied
                on a sample.
        """
        self.masks_frame = pd.read_csv(csv_file, skiprows=1500, nrows=10000)
        self.root_dir = root_dir
        self.transform = transform

    def __len__(self):
        return len(self.masks_frame)

    def __getitem__(self, idx):
        img_name = os.path.join(self.root_dir,
                                self.masks_frame.iloc[idx, 0])
        
        image = Image.open(img_name + '.png')
        ## use strip to get exact result
        masks = self.masks_frame.iloc[idx, 1].strip()
        if masks == '-1':
            mark = 0
        else:
            mark = 1
            
        #masks = np.array([masks])
        #masks = masks.astype('float').reshape(-1, 2)
        sample = {'image': np.array(image), 'masks': np.array(mark)}

        if self.transform:
            sample = self.transform(sample)

        return sample
      
      
train_dataset = MasksTrainDataset(csv_file='pneumo_input/train/train-rle.csv',
                                    root_dir='pneumo_input/train/images/256/dicom/')
print(len(train_dataset))
for i in range(len(train_dataset)):
    sample = train_dataset[i]

    print(i, sample['image'].shape, sample['masks'])
    print(type(sample['masks']))

    if i == 4:
        plt.show()
        break

and Transforms:
class Rescale(object):
    """Rescale the image in a sample to a given size.

    Args:
        output_size (tuple or int): Desired output size. If tuple, output is
            matched to output_size. If int, smaller of image edges is matched
            to output_size keeping aspect ratio the same.
    """

    def __init__(self, output_size):
        assert isinstance(output_size, (int, tuple))
        self.output_size = output_size

    def __call__(self, sample):
        image, landmarks = sample['image'], sample['masks']

        h, w = image.shape[:2]
        if isinstance(self.output_size, int):
            if h > w:
                new_h, new_w = self.output_size * h / w, self.output_size
            else:
                new_h, new_w = self.output_size, self.output_size * w / h
        else:
            new_h, new_w = self.output_size

        new_h, new_w = int(new_h), int(new_w)

        img = transform.resize(image, (new_h, new_w))

        # h and w are swapped for landmarks because for images,
        # x and y axes are axis 1 and 0 respectively
        #landmarks = landmarks

        return {'image': np.array(img), 'masks': np.array(landmarks)}


class ToTensor(object):
    """Convert ndarrays in sample to Tensors."""

    def __call__(self, sample):
        image, landmarks = np.array(sample['image']), np.array(sample['masks'])

        # swap color axis because
        # numpy image: H x W x C
        # torch image: C X H X W
        image = image.transpose(2,0,1)
        #print(image.shape)
        #normalize = transforms.Normalize(mean=[0.5, 0.5, 0.5],std=[0.5, 0.5, 0.5])
        #return {'image': torch.from_numpy(image).unsqueeze(0),'masks': torch.from_numpy(landmarks)}
        #print(torch.is_tensor(torch.from_numpy(image)) and torch.from_numpy(image).ndimension() == 3)
        return {'image': torch.from_numpy(image),'masks': torch.from_numpy(landmarks)}
      
transformed_train_dataset = MasksTrainDataset(csv_file='pneumo_input/train/train-rle.csv',
                                           root_dir='pneumo_input/train/images/256/dicom/',
                                           transform=transforms.Compose([
                                               Rescale(224),
                                               ToTensor(),
                                               transforms.Normalize(mean=[0.5, 0.5, 0.5],std=[0.5, 0.5, 0.5])
                                           ]))

for i in range(len(transformed_train_dataset)):
    sample = transformed_train_dataset[i]

    print(i,sample['image'].size(),sample['masks'])

    if i == 3:
        break
        
train_dataloader = DataLoader(transformed_train_dataset, batch_size=4,
                        shuffle=True, num_workers=4)

Still the same error:
----------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-98-710d244d9279> in <module>()
     61 
     62 for i in range(len(transformed_train_dataset)):
---> 63     sample = transformed_train_dataset[i]
     64 
     65     print(i,sample['image'].size(),sample['masks'])

3 frames
<ipython-input-96-283923ce157c> in __getitem__(self, idx)
     37 
     38         if self.transform:
---> 39             sample = self.transform(sample)
     40 
     41         return sample

/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py in __call__(self, img)
     59     def __call__(self, img):
     60         for t in self.transforms:
---> 61             img = t(img)
     62         return img
     63 

/usr/local/lib/python3.6/dist-packages/torchvision/transforms/transforms.py in __call__(self, tensor)
    162             Tensor: Normalized Tensor image.
    163         """
--> 164         return F.normalize(tensor, self.mean, self.std, self.inplace)
    165 
    166     def __repr__(self):

/usr/local/lib/python3.6/dist-packages/torchvision/transforms/functional.py in normalize(tensor, mean, std, inplace)
    199     """
    200     if not _is_tensor_image(tensor):
--> 201         raise TypeError('tensor is not a torch image.')
    202 
    203     if not inplace:

TypeError: tensor is not a torch image.

What do you think?