Hi all, I have tensor 2D data.size=[4,8]. For each row in data, i want create a mask from begin_index to end_index, eg:
pair_index = torch.LongTensor([[0,2],[2,7],[1,3],[0,5]])
tensor([[0, 2],
[2, 7],
[1, 3],
[0, 5]])
So my expected mask output will be:
tensor([[1, 1, 0, 0, 0, 0, 0, 0],
[0, 0, 1, 1, 1, 1, 1, 0],
[0, 1, 1, 0, 0, 0, 0, 0],
[1, 1, 1, 1, 1, 0, 0, 0]])