torch.nn.functional. pad ( input ,  pad ,  mode=‘constant’ ,  value=2 )
you can also try
tensor1 = torch.Tensor([1,0,2])
max_seq_len = 7
tensor2 = torch.ones(max_seq_len)*2
tensor1 = torch.cat((tensor1,tensor2))[:max_seq_len]

change the max_seq_len to get padding till different sizes