What is the equivalent of Theano’s images2neibs
In order to partition an image into smaller patches, during training, in Theano we can take advantage of theano.tensor.nnet.neighbours package that contains images2neibs, neibs2images. How can it be performed in PyTorch?
Adriano_Pinto
No, I’m afraid we don’t have any operation like that. You can open a feature request in the main repository if you want.
apaszke
You can hack up a conv operation to do this. If you want a patch of say 8x8 just do a 8x8x64 convolution with zero padding and let the kernel be 1’s in different positions with all zeros. After you do this your 1x1x64 will be your 8x8 patches. This will probably be very inefficient with maximally sparse convolutions, but unless you intend to do this in an iterative manner it shouldn’t be noticeable. And should be faster than any loop you can cook up probably. With some extra effort you can make a better array programming solution, something involving reshapes and permutes probably.
Veril
fmassa
pvskand