Given a 1D tensor x, and a 2D tensor (N * 2) of start and end indices, is there a way to set the values in the start and end range to a specific value (say 0)?
I’m looking for a vectorized way to do the following:
@ptrblck Sorry I have a follow up question: the solution seems to assume that the start and end ranges won’t overlap with each other. Is there a way to modify it to work for overlapping cases? For example, when indices = torch.tensor([[1,3], [2,3]]) or indices = torch.tensor([[1,3], [1,2]]).