Program: 3340
Project: 3340
Buggy source:
/** 
 * Returns a subset of this array based on the specified indexes
 * @param indexes the indexes in to the array
 * @return a view of the array with the specified indices
 */
@Override public INDArray get(NDArrayIndex... indexes){
  ensureNotCleanedUp();
  if (isVector()) {
    if (isRowVector()) {
      if (indexes.length == 1) {
        int offset=NDArrayIndex.offset(this,indexes[0]);
        int length=indexes[0].length();
        return create(data,new int[]{1,length},stride(),offset);
      }
 else {
        if (indexes[0].offset() > 0)         throw new IllegalArgumentException("String_Node_Str");
        int offset=NDArrayIndex.offset(this,indexes[1]);
        int length=indexes[1].length();
        return create(data,new int[]{1,length},stride(),offset);
      }
    }
 else {
      if (indexes.length == 1) {
        int offset=NDArrayIndex.offset(this,indexes[0]);
        int length=indexes[0].length();
        return create(data,new int[]{length,1},stride(),offset);
      }
 else {
        if (indexes[1].offset() > 0)         throw new IllegalArgumentException("String_Node_Str");
        int offset=NDArrayIndex.offset(this,indexes[0]);
        int length=indexes[0].length();
        return create(data,new int[]{length,1},stride(),offset);
      }
    }
  }
  int[] offsets=Indices.offsets(indexes);
  int[] shape=Indices.shape(shape(),indexes);
  int[] stride=Indices.stride(this);
  int offsetAugment=0;
  if (shape[0] == 1 && shape.length > 2) {
    int[] newShape=new int[shape.length - 1];
    for (int i=0; i < newShape.length; i++) {
      newShape[i]=shape[i + 1];
    }
    shape=newShape;
    if (offsets.length > newShape.length) {
      int[] newOffsets=new int[offsets.length - 1];
      for (int i=0; i < newOffsets.length; i++) {
        newOffsets[i]=offsets[i + 1];
      }
      if (ordering() == 'c')       offsetAugment=offsets[0] * stride[0];
 else {
        offsetAugment=offsets[0] * stride[0];
      }
      offsets=newOffsets;
    }
    if (stride.length > offsets.length) {
      int[] newStrides=new int[stride.length - 1];
      for (int i=0; i < newStrides.length; i++) {
        newStrides[i]=stride[i + 1];
      }
      stride=newStrides;
    }
  }
  if (stride.length > offsets.length) {
    stride=Arrays.copyOfRange(stride,1,stride.length);
  }
  if (offsets.length > shape.length) {
    offsets=ArrayUtil.removeIndex(offsets,ArrayUtil.range(0,shape.length));
  }
  if (ArrayUtil.prod(shape) == 1 && rank() > 2) {
    if (this instanceof IComplexNDArray) {
      IComplexNDArray arr=(IComplexNDArray)this;
      return Nd4j.scalar(arr.getComplex(indexes[indexes.length - 1].indices()[0]));
    }
    return Nd4j.scalar(getDouble(indexes[indexes.length - 1].indices()[0]));
  }
  if (!Indices.isContiguous(indexes)) {
    INDArray ret=create(shape);
    if (ret.isVector() && isVector()) {
      int[] indices=indexes[0].indices();
      for (int i=0; i < ret.length(); i++) {
        ret.putScalar(i,getDouble(indices[i]));
      }
      return ret;
    }
    if (!ret.isVector()) {
      if (slices() == 1) {
        INDArray newSlice=slice(0);
        NDArrayIndex[] putIndices=Arrays.copyOfRange(indexes,1,indexes.length);
        return newSlice.get(putIndices);
      }
 else       if (indexes.length == 2 && isMatrix()) {
        for (int i=0; i < ret.slices(); i++) {
          int sliceToGetFrom=indexes[0].indices()[i];
          if (sliceToGetFrom >= slices())           break;
          INDArray slice=slice(sliceToGetFrom);
          INDArray retSlice=ret.slice(i);
          int[] finalIndices=indexes[1].indices();
          for (int j=0; j < retSlice.length(); j++) {
            if (j >= retSlice.length() || finalIndices[j] >= slice.length())             break;
            retSlice.putScalar(j,slice.getDouble(finalIndices[j]));
          }
        }
      }
 else {
        for (int i=0; i < ret.slices(); i++) {
          INDArray slice=slice(i);
          INDArray putSlice=slice.get(Arrays.copyOfRange(indexes,1,indexes.length));
          ret.putSlice(i,putSlice);
        }
      }
    }
 else {
      INDArray putSlice=slice(0).get(Arrays.copyOfRange(indexes,1,indexes.length));
      ret.putSlice(0,putSlice);
    }
    return ret;
  }
  if (ArrayUtil.prod(shape) > length()) {
    INDArray ret=create(shape);
    NDArrayIndex slices=indexes[0];
    int[] indices=slices.indices();
    if (indexes.length == 1) {
      NDArrayIndex subRange=indexes[0];
      int count=0;
      for (int i=0; i < indices.length; i++) {
        if (count >= ret.length())         count=0;
        int get=subRange.indices()[count];
        ret.putScalar(count,getDouble(get));
        count++;
      }
    }
 else {
      NDArrayIndex[] subRange=Arrays.copyOfRange(indexes,1,indexes.length);
      NDArrayIndex[] putRange=NDArrayIndex.rangeOfLength(subRange);
      for (int i=0; i < indices.length; i++) {
        INDArray sliceI=ret.slice(i);
        INDArray thisSlice=slice(indices[i]);
        sliceI.put(putRange,thisSlice.get(subRange));
      }
    }
    return ret;
  }
  INDArray ret=subArray(offsets,shape,stride);
  if (offsetAugment > 0)   ret=create(ret.data(),ret.shape(),ret.stride(),ret.offset() + offsetAugment);
  return ret;
}

Fixed version (ground truth):
/** 
 * Returns a subset of this array based on the specified indexes
 * @param indexes the indexes in to the array
 * @return a view of the array with the specified indices
 */
@Override public INDArray get(NDArrayIndex... indexes){
  int[] offsets=Indices.offsets(indexes);
  int[] shape=Indices.shape(shape(),indexes);
  int[] stride=Indices.stride(this);
  int offsetAugment=0;
  if (shape[0] == 1 && shape.length > 2) {
    int[] newShape=new int[shape.length - 1];
    for (int i=0; i < newShape.length; i++) {
      newShape[i]=shape[i + 1];
    }
    shape=newShape;
    if (offsets.length > newShape.length) {
      int[] newOffsets=new int[offsets.length - 1];
      for (int i=0; i < newOffsets.length; i++) {
        newOffsets[i]=offsets[i + 1];
      }
      if (ordering() == 'c')       offsetAugment=offsets[0] * stride[0];
 else {
        offsetAugment=offsets[0] * stride[0];
      }
      offsets=newOffsets;
    }
    if (stride.length > offsets.length) {
      int[] newStrides=new int[stride.length - 1];
      for (int i=0; i < newStrides.length; i++) {
        newStrides[i]=stride[i + 1];
      }
      stride=newStrides;
    }
  }
  if (stride.length > offsets.length) {
    stride=Arrays.copyOfRange(stride,1,stride.length);
  }
  if (offsets.length > shape.length) {
    offsets=ArrayUtil.removeIndex(offsets,ArrayUtil.range(0,shape.length));
  }
  if (ArrayUtil.prod(shape) == 1 && rank() > 2) {
    if (this instanceof IComplexNDArray) {
      IComplexNDArray arr=(IComplexNDArray)this;
      return Nd4j.scalar(arr.getComplex(indexes[indexes.length - 1].indices()[0]));
    }
    return Nd4j.scalar(getDouble(indexes[indexes.length - 1].indices()[0]));
  }
  if (!Indices.isContiguous(indexes)) {
    INDArray ret=create(shape);
    if (ret.isVector() && isVector()) {
      int[] indices=indexes[0].indices();
      for (int i=0; i < ret.length(); i++) {
        ret.putScalar(i,getDouble(indices[i]));
      }
      return ret;
    }
    if (!ret.isVector()) {
      if (slices() == 1) {
        INDArray newSlice=slice(0);
        NDArrayIndex[] putIndices=Arrays.copyOfRange(indexes,1,indexes.length);
        return newSlice.get(putIndices);
      }
 else       if (indexes.length == 2 && isMatrix()) {
        for (int i=0; i < ret.slices(); i++) {
          int sliceToGetFrom=indexes[0].indices()[i];
          if (sliceToGetFrom >= slices())           break;
          INDArray slice=slice(sliceToGetFrom);
          INDArray retSlice=ret.slice(i);
          int[] finalIndices=indexes[1].indices();
          for (int j=0; j < retSlice.length(); j++) {
            if (j >= retSlice.length() || finalIndices[j] >= slice.length())             break;
            retSlice.putScalar(j,slice.getDouble(finalIndices[j]));
          }
        }
      }
 else {
        for (int i=0; i < ret.slices(); i++) {
          INDArray slice=slice(i);
          INDArray putSlice=slice.get(Arrays.copyOfRange(indexes,1,indexes.length));
          ret.putSlice(i,putSlice);
        }
      }
    }
 else {
      INDArray putSlice=slice(0).get(Arrays.copyOfRange(indexes,1,indexes.length));
      ret.putSlice(0,putSlice);
    }
    return ret;
  }
  if (ArrayUtil.prod(shape) > length()) {
    INDArray ret=create(shape);
    NDArrayIndex slices=indexes[0];
    int[] indices=slices.indices();
    if (indexes.length == 1) {
      NDArrayIndex subRange=indexes[0];
      int count=0;
      for (int i=0; i < indices.length; i++) {
        if (count >= ret.length())         count=0;
        int get=subRange.indices()[count];
        ret.putScalar(count,getDouble(get));
        count++;
      }
    }
 else {
      NDArrayIndex[] subRange=Arrays.copyOfRange(indexes,1,indexes.length);
      NDArrayIndex[] putRange=NDArrayIndex.rangeOfLength(subRange);
      for (int i=0; i < indices.length; i++) {
        INDArray sliceI=ret.slice(i);
        INDArray thisSlice=slice(indices[i]);
        sliceI.put(putRange,thisSlice.get(subRange));
      }
    }
    return ret;
  }
  INDArray ret=subArray(offsets,shape,stride);
  if (offsetAugment > 0)   ret=create(ret.data(),ret.shape(),ret.stride(),ret.offset() + offsetAugment);
  return ret;
}