code: public Tensor select(int dim, int idx) {
          int[] yDims = IntArrays.removeEntry(this.getDims(), dim);
          Tensor y = new Tensor(s, yDims);
          DimIter yIter = new DimIter(y.getDims());
          while (yIter.hasNext()) {
              int[] yIdx = yIter.next();
              int[] xIdx = IntArrays.insertEntry(yIdx, dim, idx);
              y.set(yIdx, this.get(xIdx));
          }
          return y;
      }
docs: Selects a sub-tensor from this one. This can be though of as fixing a particular dimension to
  a given index.
  
  @param dim The dimension to treat as fixed.
  @param idx The index of that dimension to fix.
  @return The sub-tensor selected.