Solved by JuanFMontesinos in post #2 
              
              
                Hi, 
You need to use torch.nn.functional.conv2d in order to convolve the image with an specific kernel. 
docs indicates the shape of the kernel, very straight forward. 
Note that pytorch use cross-correlation instead of convolutions. 
Regards