As the note say, padding serves to correspond to the padding argument in convs.
Now, when you have a nontrivial stride, you typically have that there are several input sizes to the convolution giving the same output size (with the larger one having the last row(s)/column(s) ignored). This is adjusted for by the output_padding argument.
As simple 2d example:
w = torch.randn(1, 1, 3, 3)
w2 = torch.randn_like(w)
x = torch.randn(1, 1, 4, 4)
y1 = torch.nn.functional.conv2d(x, w, stride=2)
y2 = torch.nn.functional.conv2d(x[:, :, :-1, :-1], w, stride=2)
print(y1, "\n", y2)
z1 = torch.nn.functional.conv_transpose2d(y1, w2, stride=2, output_padding=1)
z2 = torch.nn.functional.conv_transpose2d(y2, w2, stride=2, output_padding=0)
print(z1, "\n", z2)

As we see,

without output padding, we get the “just fits” input size,
with output padding we get a row and column of zeros for the values that the conv would have ignored.

Note that transposed convolutions are more an adjoint (in the linear map sense) than an inverse operation.
Best regards
Thomas