Supposing a is a=tensor([2, 1, 2]), I want to generate a mask based on tensor a .
The mask is like this:
mask = tensor([[ 0,  0,  0,  1,  1],
               [ 0,  0,  0,  0,  1],
               [ 0,  0,  0,  1,  1]])

Is there any simple and convenient  method ?