For a kernel size of 5, you’ll get the expected output:
print(output[0, :, 0])
> tensor([ 0.,  0.,  0.,  0.,  0.,  0.,  0.,  1.,  2.,  3.,  0.,  5.,  6.,  7.,
         8.,  0., 10., 11., 12., 13.,  0., 15., 16., 17., 18.])

You are looking at the wrong dimension, since your input is also 5x5 in the spatial size.