title: How to sum of torch tensors without looping?
body: <p>I've got an array of bins' borders and I need to get a sum of values inside these bins.
  Now it looks as follows:</p>
  <pre><code>output = torch.zeros((16, 10)) #10 corresponds to the number of bins
  
  for l in range(10):
     output[:,l] = data[:, bin_edges[l]:bin_edges[l+1]].sum(axis=-1)
  </code></pre>
  <p>Is it possible to avoid loops and improve the performance?</p>