Source:
<code>public CropAndResizeDataSetPreProcessor(int originalHeight, int originalWidth, int cropYStart, int cropXStart, int resizedHeight, int resizedWidth, int numChannels, ResizeMethod resizeMethod) { Preconditions.checkArgument(originalHeight > 0, "originalHeight must be greater than 0"); Preconditions.checkArgument(originalWidth > 0, "originalWidth must be greater than 0"); Preconditions.checkArgument(cropYStart >= 0, "cropYStart must be positive"); Preconditions.checkArgument(cropXStart >= 0, "cropXStart must be positive"); Preconditions.checkArgument(resizedHeight > 0, "resizedHeight must be greater than 0"); Preconditions.checkArgument(resizedWidth > 0, "resizedWidth must be greater than 0"); <START> Preconditions.checkArgument(numChannels > 0, "numChannels must be greater than 0"); <END> resizedShape = new long[] { 1, resizedHeight, resizedWidth, numChannels }; boxes = Nd4j.create(new float[] { (float)cropYStart / (float)originalHeight, (float)cropXStart / (float)originalWidth, (float)(cropYStart + resizedHeight) / (float)originalHeight, (float)(cropXStart + resizedWidth) / (float)originalWidth }, new long[] { 1, 4 }, DataType.FLOAT); indices = Nd4j.create(new int[] { 0 }, new long[] { 1, 1 }, DataType.INT); resize = Nd4j.create(new int[] { resizedHeight, resizedWidth }, new long[] { 1, 2 }, DataType.INT); method = resizeMethod == ResizeMethod.Bilinear ? 0 : 1; }</code><technical_language>Minor nitpicks/polish: (not a big deal, for next time) - include actual for easier debugging. Preconditions.checkArgument(X > 0, "X greater 0, %s", X) Preconditions.checkArgument(cropYStart >= 0, "cropYStart positive"); Technically enforcing non-negative (positive >0, >=0)</technical_language>

Target:
public CropAndResizeDataSetPreProcessor(int originalHeight, int originalWidth, int cropYStart, int cropXStart, int resizedHeight, int resizedWidth, int numChannels, ResizeMethod resizeMethod) { Preconditions.checkArgument(originalHeight > 0, "originalHeight must be greater than 0, got %s", originalHeight); Preconditions.checkArgument(originalWidth > 0, "originalWidth must be greater than 0, got %s", originalWidth); Preconditions.checkArgument(cropYStart >= 0, "cropYStart must be greater or equal to 0, got %s", cropYStart); Preconditions.checkArgument(cropXStart >= 0, "cropXStart must be greater or equal to 0, got %s", cropXStart); Preconditions.checkArgument(resizedHeight > 0, "resizedHeight must be greater than 0, got %s", resizedHeight); Preconditions.checkArgument(resizedWidth > 0, "resizedWidth must be greater than 0, got %s", resizedWidth); Preconditions.checkArgument(numChannels > 0, "numChannels must be greater than 0, got %s", numChannels); resizedShape = new long[] { 1, resizedHeight, resizedWidth, numChannels }; boxes = Nd4j.create(new float[] { (float)cropYStart / (float)originalHeight, (float)cropXStart / (float)originalWidth, (float)(cropYStart + resizedHeight) / (float)originalHeight, (float)(cropXStart + resizedWidth) / (float)originalWidth }, new long[] { 1, 4 }, DataType.FLOAT); indices = Nd4j.create(new int[] { 0 }, new long[] { 1, 1 }, DataType.INT); resize = Nd4j.create(new int[] { resizedHeight, resizedWidth }, new long[] { 1, 2 }, DataType.INT); method = resizeMethod == ResizeMethod.Bilinear ? 0 : 1; }