patch_denoise.gpu.dataloader.sliding_sum_nd#

patch_denoise.gpu.dataloader.sliding_sum_nd(data, patch_shape, patch_overlap)[source]#

Compute a sliding sum across all dimensions using sequential 1D convolutions.

Parameters:
  • data (torch.Tensor) – The input tensor.

  • patch_shape (tuple of int) – The shape of each patch.

  • patch_overlap (tuple of int) – The number of overlapping elements between adjacent patches along each dimension

Returns:

results of the sliding sum, with the same grid shape as the output of patchify_tensor, but with the values being the sum of the corresponding patches in the input data.

Return type:

torch.Tensor

Notes

Here a convolution-based approach is used to efficiently compute the sliding sum over each dimension (problem is separable). This is (significantly) more memory efficient than working on the patchified tensor.