def grids_inverse(self, outs):
        """Reconstruct the original tensor from processed grid patches with overlap blending.

        Args:
            outs (torch.Tensor): Processed grid patches.

        Returns:
            torch.Tensor: Reconstructed tensor of original size.
        """
        preds = torch.zeros(self.original_size).to(outs.device)
        b, c, h, w = self.original_size
        count_mt = torch.zeros((b, 4, h, w)).to(outs.device)
        k1, k2 = self.kernel_size

        for cnt, each_idx in enumerate(self.idxes):
            i = each_idx["i"]
            j = each_idx["j"]
            preds[0, :, i : i + k1, j : j + k2] += outs[cnt, :, :, :] * self.tile_weights
            count_mt[0, :, i : i + k1, j : j + k2] += self.tile_weights

        del outs
        torch.cuda.empty_cache()
        return preds / count_mt
Reconstruct the original tensor from processed grid patches with overlap blending.

        Args:
            outs (torch.Tensor): Processed grid patches.

        Returns:
            torch.Tensor: Reconstructed tensor of original size.
        
examples/community/pipeline_faithdiff_stable_diffusion_xl.py