Why I got this error? my image and label are the same size(166*190 24bit rgb)
RuntimeError: stack expects each tensor to be equal size, but got [3, 185, 204] at entry 0 and [3, 190, 166] at entry 1
The following is the resize:where is wrong?
class Resize(object):
"""Resize image and/or masks."""

def __init__(self, imageresize, maskresize):

    self.imageresize = imageresize

    self.maskresize = maskresize

def __call__(self, sample):

    image, mask = sample['image'], sample['mask']

    if len(image.shape) == 3:

        image = image.transpose(1, 2, 0)

    if len(mask.shape) == 3:

        mask = mask.transpose(1, 2, 0)

    mask = cv2.resize(mask, self.maskresize, cv2.INTER_AREA)

    image = cv2.resize(image, self.imageresize, cv2.INTER_AREA)

    if len(image.shape) == 3:

        image = image.transpose(2, 0, 1)

    if len(mask.shape) == 3:

        mask = mask.transpose(2, 0, 1)

    return {'image': image,

            'mask': mask}

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

def __call__(self, sample, maskresize=None, imageresize=None):

    image, mask = sample['image'], sample['mask']

    if len(mask.shape) == 2:

        mask = mask.reshape((1,)+mask.shape)

    if len(image.shape) == 2:

        image = image.reshape((1,)+image.shape)

    return {'image': torch.from_numpy(image),

            'mask': torch.from_numpy(mask)}

class Normalize(object):
'''Normalize image'''

def __call__(self, sample):

    image, mask = sample['image'], sample['mask']

    return {'image': image.type(torch.FloatTensor)/255,

            'mask': mask.type(torch.FloatTensor)/255}