For example, I have torch.tensor([1,3,5,7]) and I want to get a tensor that tells me whether it is falling into a 0-2 range or 2-4 range or 4-6 range or 6-8 range. If 0-2, return 0, 2-4, return 1, etc.
Hence, this will give me torch.tensor([0,1,2,3]). Is there an efficient vectorize method to do this kind of stuff?
I know there is apply_ function but it only works with cpu tensor. Is there an equivalent method for cuda tensor?