code: public void addTensor(Tensor addend, int dim, int idx) {
          checkSameAlgebra(this, addend);
          DimIter yIter = new DimIter(addend.getDims());
          while (yIter.hasNext()) {
              int[] yIdx = yIter.next();
              int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx);
              this.add(xIdx, addend.get(yIdx));
          }
      }
docs: Adds a smaller tensor to this one, inserting it at a specified dimension
  and index. This can be thought of as selecting the sub-tensor of this tensor adding the
  smaller tensor to it.
  
  This is the larger tensor (i.e. the augend).
  
  @param addend The smaller tensor (i.e. the addend)
  @param dim The dimension which will be treated as fixed on the larger tensor.
  @param idx The index at which that dimension will be fixed.