Program: 3457
Project: 3457
Buggy source:
protected INDArray newShape(int[] newShape,char ordering){
  ensureNotCleanedUp();
  if (Arrays.equals(newShape,this.shape()))   return this;
 else   if (Shape.isVector(newShape) && isVector()) {
    if (isRowVector() && Shape.isColumnVectorShape(newShape)) {
      return Nd4j.create(data,newShape,new int[]{stride[0],1},offset);
    }
 else     if (isRowVector() && newShape.length == 1 || isRowVector() && newShape.length == 2) {
      this.shape=newShape;
    }
 else     if (isColumnVector() && Shape.isRowVectorShape(newShape)) {
      return Nd4j.create(data,newShape,new int[]{stride[1]},offset);
    }
  }
  INDArray newCopy=this;
  int[] newStrides=null;
  if (shape().length > 1 && ((ordering == NDArrayFactory.C && this.ordering != NDArrayFactory.C) || (ordering == NDArrayFactory.FORTRAN && this.ordering != NDArrayFactory.FORTRAN))) {
    newStrides=noCopyReshape(newShape,ordering);
    if (newStrides == null) {
      newCopy=Nd4j.create(shape(),ordering);
      for (int i=0; i < vectorsAlongDimension(0); i++) {
        INDArray copyFrom=vectorAlongDimension(i,0);
        INDArray copyTo=newCopy.vectorAlongDimension(i,0);
        for (int j=0; j < copyFrom.length(); j++) {
          copyTo.putScalar(j,copyFrom.getDouble(i));
        }
      }
    }
  }
  if (newStrides == null)   newStrides=this instanceof IComplexNDArray ? Nd4j.getComplexStrides(newShape) : Nd4j.getStrides(newShape);
  if (this instanceof IComplexNDArray)   return Nd4j.createComplex(newCopy.data(),newShape,newStrides,offset);
  return Nd4j.create(newCopy.data(),newShape,newStrides,offset);
}

Fixed version (ground truth):
protected INDArray newShape(int[] newShape,char ordering){
  ensureNotCleanedUp();
  if (Arrays.equals(newShape,this.shape()))   return this;
 else   if (Shape.isVector(newShape) && isVector()) {
    if (isRowVector() && Shape.isColumnVectorShape(newShape)) {
      return Nd4j.create(data,newShape,new int[]{stride[0],1},offset);
    }
 else     if (isRowVector() && newShape.length == 1 || isRowVector() && newShape.length == 2) {
      this.shape=newShape;
    }
 else     if (isColumnVector() && Shape.isRowVectorShape(newShape)) {
      return Nd4j.create(data,newShape,new int[]{stride[0]},offset);
    }
  }
  INDArray newCopy=this;
  int[] newStrides=null;
  if (shape().length > 1 && ((ordering == NDArrayFactory.C && this.ordering != NDArrayFactory.C) || (ordering == NDArrayFactory.FORTRAN && this.ordering != NDArrayFactory.FORTRAN))) {
    newStrides=noCopyReshape(newShape,ordering);
    if (newStrides == null) {
      newCopy=Nd4j.create(shape(),ordering);
      for (int i=0; i < vectorsAlongDimension(0); i++) {
        INDArray copyFrom=vectorAlongDimension(i,0);
        INDArray copyTo=newCopy.vectorAlongDimension(i,0);
        for (int j=0; j < copyFrom.length(); j++) {
          copyTo.putScalar(j,copyFrom.getDouble(i));
        }
      }
    }
  }
  if (newStrides == null)   newStrides=this instanceof IComplexNDArray ? Nd4j.getComplexStrides(newShape) : Nd4j.getStrides(newShape);
  if (this instanceof IComplexNDArray)   return Nd4j.createComplex(newCopy.data(),newShape,newStrides,offset);
  return Nd4j.create(newCopy.data(),newShape,newStrides,offset);
}