I’m quite sure I understand your use case wrong, but in case you want “standard” padding in the spatial dimensions, this should work:
output = F.pad(input_images, [1, 1, 1, 1])

If that’s not your use case, could you print the desired output, please?