I tried this one, taken from the gist,
    def _transform(self, image, mask):
        """
        Apply transforms to both the image and the mask.

        :param transform: A transform object.
        :return: transformed image and mask
        """

        # image ordering
        img_row_axis = 0
        img_col_axis = 1
        channel_axis = 2

        # random crop
        c_h = self.preprocessing_params['image']['crop']['height']
        c_w = self.preprocessing_params['image']['crop']['width']
        image, mask = random_crop(image, mask, size=(c_h, c_w))

        if self.mode == 'train' or self.mode == 'dev':
            # random horizontal flip
            if np.random.random() > 0.5:
                image = np.asarray(image).swapaxes(img_col_axis, 0)
                image = image[::-1, ...]
                image = image.swapaxes(0, img_col_axis)

                mask = np.asarray(mask).swapaxes(img_col_axis, 0)
                mask = mask[::-1, ...]
                mask = mask.swapaxes(0, img_col_axis)

        # transform to tensor
        image = image_to_tensor(image)
        mask = binary_mask_to_tensor(mask, threshold=0.5)

        return image, mask

but it throws an error:
ValueError: Traceback (most recent call last):
  File "/tool/python/conda/env/gis36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in _worker_loop
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/tool/python/conda/env/gis36/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 57, in <listcomp>
    samples = collate_fn([dataset[i] for i in batch_indices])
  File "/project/geospatial/application/cs230-sifd/source/step/loader/sifd/dataset.py", line 441, in __getitem__
    image, mask = self._transform(image, mask)
  File "/project/geospatial/application/cs230-sifd/source/step/loader/sifd/dataset.py", line 236, in _transform
    image = image_to_tensor(image)
  File "/project/geospatial/application/cs230-sifd/source/step/preprocessing/image/tensor.py", line 48, in image_to_tensor
    tensor = torch.from_numpy(image).float()
ValueError: some of the strides of a given numpy array are negative. This is currently not supported, but will be added in future releases.

The random crop operation works fine. The random horizontal flip operation fails just before the tensor conversion operation.
The tensor conversion functions are as follows:

def image_to_tensor(image):
    """
    Transform an numpy image to a torch tensor.

    We will have to swap the channel axis because numpy uses channel last ordering and
    torch uses channel first ordering.
    - numpy image: H x W x C
    - torch image: C X H X W

    :param image (np.ndarray): Input image.
    :return: tensor: A PyTorch tensor.
    """

    image = image.transpose(2, 0, 1)
    tensor = torch.from_numpy(image).float()
    return tensor


def binary_mask_to_tensor(mask, threshold):
    """
    Transform a binary mask to a tensor.

    We will have to swap the channel axis because numpy uses channel last ordering and
    torch uses channel first ordering.
    - numpy image: H x W x C
    - torch image: C X H X W

    :param mask (np.ndarray): A binary mask array, usually of type uint8.
    :param threshold: The threshold used to consider if the mask is present.
    :return: tensor: A PyTorch tensor.
    """

    mask = mask.transpose(2, 0, 1)
    mask = binarize(mask, threshold).astype(np.float32)
    tensor = torch.from_numpy(mask).float()
    return tensor