Hi, all
How can I merge two variable sequences together? Like the example below, with word and image token sequence (batch_first=False) and their length
w_input = Variable( torch.randn( 20, 4, 50 ) )
w_len = Variable( torch.LongTensor( [ 20, 15, 10, 5 ] ) )
i_input = Variable( torch.randn( 3, 4, 50 ) )
i_len = Variable( torch.LongTensor( [ 3, 2, 1, 1 ] ) )
What I want is a new variable:
token_input = Variable( torch.FloatTensor( 23, 4, 50 ).fill_(0) )
whose data come from the above two sequences, with their lengths
token_len = w_len + i_len
Any hints here?
Thanks so much for your help.