title: How to add to pytorch tensor at indices?
body: <p>I have to admit, I'm a bit confused by the scatter* and index* operations - I'm not sure any of them do exactly what I'm looking for, which is very simple:</p>
  
  <p>Given some 2-D tensor</p>
  
  <pre><code>z = tensor([[1., 1., 1., 1.],
              [1., 1., 1., 1.],
              [1., 1., 1., 1.]])
  </code></pre>
  
  <p>And a list (or tensor?) of 2-d indexes:</p>
  
  <pre><code>inds = tensor([[0, 0],
                 [1, 1],
                 [1, 2]])
  </code></pre>
  
  <p>I want to add a scalar to z at those indexes (and do it efficiently):</p>
  
  <pre><code>znew = z.something_add(inds, 3)
  -&gt;
  znew = tensor([[4., 1., 1., 1.],
                 [1., 4., 4., 1.],
                 [1., 1., 1., 1.]])
  </code></pre>
  
  <p>If I have to I can make that scalar a tensor of whatever shape (where all elements = 3), but I'd rather not...</p>