Hi @rasbt, thanks for your answer, but I do not understand what you’re suggesting. What is the difference between torch.nn.fanctional's max_pool2d and torch.nn's MaxPool2d? I mean, to my understanding, what you wrote will do the maximum pooling on x, but how I would use the appropriate indices in order to pull from another tensor y?