Solved by ptrblck in post #2 
              
              
                I’m not sure if this is currently possible with this method. 
However, you could calculate the bin borders and use these values as a threshold to index your tensor. 
x = torch.arange(10).float()
low = 5.
high = 7.
(low <= x) * (x < high)

Would that help in any kind?