I have negative and postive sequences which are divided in two group. How can I combine them to train?
Hi,
You can concatenate the two tensors and then do a random shuffle on the combined tensor.
Assuming that the torch tensor containing the positive examples is t1
and that of negative examples is t2
, you can do something like this,
t1 = torch.cat((t1, t2), dim=0) # dim=0 assumes that your first axis is the batch axis. data = t1[torch.randperm(t1.size()[0])] # Shuffle the data
Hope this helps,
Cheers!