Inverse of torch.tensor.unfold

Hello,

I want to use .unfold on some tensor, for example:

x = torch.rand(1,3,6,32,32)

and because I want to use unfold on the 3,4 dimensions I would use .unfold as following

x = x.unfold(3,5,1).unfold(4,5,1)
and gets a shape of [1,3,6,28,28,5,5]

and I want to get back to [1,3,6,32,32] is there any inverse of the .unfold kind of method?

I don’t want to use nn.Unfold if possible