Hello,
I would need a fast way to merge the output of a torch.Tensor.unfold 39. However, I cannot find anything such that. for loops are too much slow for this case…
Example of what I would like to have:
import torch

A = torch.rand(4, 2, 7, 21)

# the following creates a view so that the 3rd dimension is 
# split in windows 
# * window size (kernel): 4
# * stride: 3
A = A.unfold(3, 4, 3)
# shape: torch.Size([4, 1, 7, 6, 4])

# [...] some operation on the windows

# now summing up windows by averaging overlapped 
# points within windows, something like:
B = A.fold(4, 4, 3, 'mean')