Randomly augment a single image tensor.

        # Arguments
            sample: 3D or 4D tensor, single sample.
            seed: random seed.

        # Returns
            A randomly transformed version of the input (same shape).

def random_transform(self, sample, seed=None):
        """Randomly augment a single image tensor.

        # Arguments
            sample: 3D or 4D tensor, single sample.
            seed: random seed.

        # Returns
            A randomly transformed version of the input (same shape).
        """
        img_row_axis = self.row_axis - 1
        img_col_axis = self.col_axis - 1
        img_channel_axis = self.channel_axis - 1

        transform_matrix = self.get_random_transform_matrix(sample, seed)

        if transform_matrix is not None:
            h, w = sample.shape[img_row_axis], sample.shape[img_col_axis]
            transform_matrix = transform_matrix_offset_center(transform_matrix, h, w)
            sample = apply_transform(sample, transform_matrix, img_channel_axis,
                                     fill_mode=self.fill_mode, cval=self.cval)

        if self.channel_shift_range != 0:
            sample = random_channel_shift(sample,
                                          self.channel_shift_range,
                                          img_channel_axis)
        if self.horizontal_flip:
            if np.random.random() < 0.5:
                sample = flip_axis(sample, img_col_axis)

        if self.vertical_flip:
            if np.random.random() < 0.5:
                sample = flip_axis(sample, img_row_axis)

        return sample