### Question:
ArrayToINDArrayTransform implements Operation<double[], INDArray> { @Override public INDArray transform(double[] data) { INDArray result = Nd4j.create(data); if(shape != null) { result = result.reshape(shape); } return result; } ArrayToINDArrayTransform(long... shape);  ArrayToINDArrayTransform(); @Override INDArray transform(double[] data);  }### Answer:
@Test public void when_notUsingShape_expect_transformTo1DINDArray() { ArrayToINDArrayTransform sut = new ArrayToINDArrayTransform(); double[] data = new double[] { 1.0, 2.0, 3.0 }; INDArray result = sut.transform(data); assertArrayEquals(new long[] { 3 }, result.shape()); assertEquals(1.0, result.getDouble(0), 0.00001); assertEquals(2.0, result.getDouble(1), 0.00001); assertEquals(3.0, result.getDouble(2), 0.00001); }
@Test public void when_usingShape_expect_transformTo1DINDArray() { ArrayToINDArrayTransform sut = new ArrayToINDArrayTransform(1, 3); double[] data = new double[] { 1.0, 2.0, 3.0 }; INDArray result = sut.transform(data); assertArrayEquals(new long[] { 1, 3 }, result.shape()); assertEquals(1.0, result.getDouble(0, 0), 0.00001); assertEquals(2.0, result.getDouble(0, 1), 0.00001); assertEquals(3.0, result.getDouble(0, 2), 0.00001); }