view_as_random_overlapping_patches_torch

view_as_random_overlapping_patches_torch#

jolideco.utils.torch.view_as_random_overlapping_patches_torch(image, shape, stride, generator)[source]#

View tensor as randomly (“jittered”) overlapping rectangular patches

Parameters:
  • image (~torch.Tensor) – Image tensor

  • shape (tuple) – Shape of the patches.

  • stride (int) – Stride of the patches. By default it is half of the patch size.

  • generator (~torch.Generator) – Random number generator

Returns:

patches – Tensor of overlapping patches of shape (n_patches, patch_shape_flat)

Return type:

~torch.Tensor