use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.
the class CudaIndexReduceTests method testPinnedIMaxLarge.
@Test
public void testPinnedIMaxLarge() throws Exception {
// simple way to stop test if we're not on CUDA backend here
assertEquals("JcublasLevel1", Nd4j.getBlasWrapper().level1().getClass().getSimpleName());
INDArray array1 = Nd4j.linspace(1, 1024, 1024);
int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMax(array1))).getFinalResult();
System.out.println("Array1: " + array1);
assertEquals(1023, idx);
}
use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.
the class OpExecutionerTests method testIMax.
@Test
public void testIMax() {
INDArray arr = Nd4j.linspace(1, 10, 10);
IMax imax = new IMax(arr);
assertEquals(9, ((IndexAccumulation) Nd4j.getExecutioner().exec(imax)).getFinalResult());
arr.muli(-1);
imax = new IMax(arr);
int maxIdx = ((IndexAccumulation) Nd4j.getExecutioner().exec(imax)).getFinalResult();
assertEquals(0, maxIdx);
}
use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.
the class OpExecutionerTestsC method testIMin.
@Test
public void testIMin() {
INDArray arr = Nd4j.linspace(1, 10, 10);
IMin imin = new IMin(arr);
assertEquals(0, ((IndexAccumulation) Nd4j.getExecutioner().exec(imin)).getFinalResult());
arr.muli(-1);
imin = new IMin(arr);
int minIdx = ((IndexAccumulation) Nd4j.getExecutioner().exec(imin)).getFinalResult();
assertEquals(9, minIdx);
}
use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.
the class OpExecutionerTestsC method testIMax.
@Test
public void testIMax() {
INDArray arr = Nd4j.linspace(1, 10, 10);
IMax imax = new IMax(arr);
assertEquals(9, ((IndexAccumulation) Nd4j.getExecutioner().exec(imax)).getFinalResult());
arr.muli(-1);
imax = new IMax(arr);
int maxIdx = ((IndexAccumulation) Nd4j.getExecutioner().exec(imax)).getFinalResult();
assertEquals(0, maxIdx);
}
Aggregations