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