def forward(
        self, batch: List[Tuple[Image.Image, int, str]]
    ) -> Tuple[
        Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor],
        torch.Tensor,
        torch.Tensor,
    ]:
        """
        Applies transforms to images in the input batch.

        Args:
            batch:
                A list of tuples containing an image (as a PIL Image),
                a label (int), and a filename (str).

        Returns:
            A tuple of transformed images (as a 4-tuple of torch.Tensors containing view_global, view_local, grid_global, grid_local),
            labels (as torch.Tensor), and filenames (as torch.Tensor).

        """

        views_global = []
        views_local = []
        grids_global = []
        grids_local = []
        labels = []
        fnames = []

        for image, label, filename in batch:
            view_global, grid_global = self.global_crop_and_flip.forward(image)
            view_local, grid_local = self.local_crop_and_flip.forward(image)
            views_global.append(self.global_transform(view_global))
            views_local.append(self.local_transform(view_local))
            grids_global.append(grid_global)
            grids_local.append(grid_local)
            labels.append(torch.LongTensor(label))
            fnames.append(filename)

        views_global = torch.stack(views_global)
        views_local = torch.stack(views_local)
        grids_global = torch.stack(grids_global)
        grids_local = torch.stack(grids_local)

        return (views_global, views_local, grids_global, grids_local), labels, fnames

        Applies transforms to images in the input batch.

        Args:
            batch:
                A list of tuples containing an image (as a PIL Image),
                a label (int), and a filename (str).

        Returns:
            A tuple of transformed images (as a 4-tuple of torch.Tensors containing view_global, view_local, grid_global, grid_local),
            labels (as torch.Tensor), and filenames (as torch.Tensor).

        
lightly/data/collate.py