def untile(self, tiles: torch.Tensor) -> torch.Tensor:
        """Reconstruct image from tiles.

        For overlapping tiles, averages overlapping regions.

        Args:
            tiles: Tiles generated by ``tile()``

        Returns:
            torch.Tensor: Reconstructed image

        Examples:
            >>> tiler = Tiler(tile_size=512, stride=256)
            >>> image = torch.rand(2, 3, 1024, 1024)
            >>> tiles = tiler.tile(image)
            >>> reconstructed = tiler.untile(tiles)
            >>> reconstructed.shape
            torch.Size([2, 3, 1024, 1024])
            >>> torch.equal(image, reconstructed)
            True
        """
        image = self.__fold(tiles)
        return downscale_image(image=image, size=(self.input_h, self.input_w), mode=self.mode)
Reconstruct image from tiles.

        For overlapping tiles, averages overlapping regions.

        Args:
            tiles: Tiles generated by ``tile()``

        Returns:
            torch.Tensor: Reconstructed image

        Examples:
            >>> tiler = Tiler(tile_size=512, stride=256)
            >>> image = torch.rand(2, 3, 1024, 1024)
            >>> tiles = tiler.tile(image)
            >>> reconstructed = tiler.untile(tiles)
            >>> reconstructed.shape
            torch.Size([2, 3, 1024, 1024])
            >>> torch.equal(image, reconstructed)
            True
        
src/anomalib/data/utils/tiler.py