padding and sub_sequence are of what shape? they have to be of the same shape except in dim=0 (the dimension in which they are concatenated can be different shape, but other dimensions should have same shape).