Solved by ptrblck in post #2 
              
              
                You can use scatter_add_ to accumulate these values to a new tensor. 
Assuming you have already calculated the stride tensor, you would need to create the index tensor from it as seen here: 
a = torch.tensor([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
stride = torch.tensor([3, 3, 4])
idx = torch.tensor(sum([[i…