With Conv2d, If the padding is bigger than one kernel dimension, will the kernel still go there?

Will a convolutional kernel go to regions of a image that are nothing but padding? Say, all zeroes?

To be clear, I don’t mean the general case when an edge is padding. In that case, the kernel will process that edge. I mean, if the kernel’s stride takes it completely out of the real image and into solely padding.

Yes, this seems to be the case based on this example which uses a padding value equal to the kernel size:

conv = nn.Conv2d(1, 1, kernel_size=3, padding=3, bias=False)
x = torch.randn(1, 1, 1, 1)
out = conv(x)
print(out)

Output:

tensor([[[[ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000],
          [ 0.0000,  0.1960, -0.1705,  0.3167,  0.0000],
          [ 0.0000, -0.0529, -0.2177,  0.2176,  0.0000],
          [ 0.0000, -0.2484, -0.2235, -0.2436,  0.0000],
          [ 0.0000,  0.0000,  0.0000,  0.0000,  0.0000]]]],
       grad_fn=<ConvolutionBackward0>)

As the can see the padding region was used as indicated by the zeros.