### Question:
NativeImageLoader extends BaseImageLoader { public INDArray asRowVector(String filename) throws IOException { return asRowVector(new File(filename)); } NativeImageLoader();  NativeImageLoader(long height, long width);  NativeImageLoader(long height, long width, long channels);  NativeImageLoader(long height, long width, long channels, boolean centerCropIfNeeded);  NativeImageLoader(long height, long width, long channels, ImageTransform imageTransform);  NativeImageLoader(long height, long width, long channels, MultiPageMode mode); protected  NativeImageLoader(NativeImageLoader other); @Override String[] getAllowedFormats(); INDArray asRowVector(String filename); @Override INDArray asRowVector(File f); @Override INDArray asRowVector(InputStream is); INDArray asRowVector(Object image); INDArray asRowVector(Frame image); INDArray asRowVector(Mat image); INDArray asRowVector(org.opencv.core.Mat image); INDArray asMatrix(String filename); @Override INDArray asMatrix(File f); @Override INDArray asMatrix(File f, boolean nchw); @Override INDArray asMatrix(InputStream is); @Override INDArray asMatrix(InputStream inputStream, boolean nchw); Image asImageMatrix(String filename); @Override Image asImageMatrix(File f); @Override Image asImageMatrix(File f, boolean nchw); @Override Image asImageMatrix(InputStream is); @Override Image asImageMatrix(InputStream inputStream, boolean nchw); INDArray asMatrix(Object image); void asMatrixView(InputStream is, INDArray view); void asMatrixView(String filename, INDArray view); void asMatrixView(File f, INDArray view); void asMatrixView(Mat image, INDArray view); void asMatrixView(org.opencv.core.Mat image, INDArray view); INDArray asMatrix(Frame image); INDArray asMatrix(org.opencv.core.Mat image); INDArray asMatrix(Mat image); ImageWritable asWritable(String filename); ImageWritable asWritable(File f); INDArray asMatrix(ImageWritable writable); Frame asFrame(INDArray array); Frame asFrame(INDArray array, int dataType); Mat asMat(INDArray array); Mat asMat(INDArray array, int dataType); static final String[] ALLOWED_FORMATS; }### Answer:
@Test public void testAsRowVector() throws Exception { org.opencv.core.Mat img1 = makeRandomOrgOpenCvCoreMatImage(0, 0, 1); Mat img2 = makeRandomImage(0, 0, 3); int w1 = 35, h1 = 79, ch1 = 3; NativeImageLoader loader1 = new NativeImageLoader(h1, w1, ch1); INDArray array1 = loader1.asRowVector(img1); assertEquals(2, array1.rank()); assertEquals(1, array1.rows()); assertEquals(h1 * w1 * ch1, array1.columns()); assertNotEquals(0.0, array1.sum().getDouble(0), 0.0); INDArray array2 = loader1.asRowVector(img2); assertEquals(2, array2.rank()); assertEquals(1, array2.rows()); assertEquals(h1 * w1 * ch1, array2.columns()); assertNotEquals(0.0, array2.sum().getDouble(0), 0.0); int w2 = 103, h2 = 68, ch2 = 4; NativeImageLoader loader2 = new NativeImageLoader(h2, w2, ch2); loader2.direct = false; INDArray array3 = loader2.asRowVector(img1); assertEquals(2, array3.rank()); assertEquals(1, array3.rows()); assertEquals(h2 * w2 * ch2, array3.columns()); assertNotEquals(0.0, array3.sum().getDouble(0), 0.0); INDArray array4 = loader2.asRowVector(img2); assertEquals(2, array4.rank()); assertEquals(1, array4.rows()); assertEquals(h2 * w2 * ch2, array4.columns()); assertNotEquals(0.0, array4.sum().getDouble(0), 0.0); }