Search in sources :

Example 6 with IndexAccumulation

use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.

the class HalfOpsTests method testIndexReduce1.

@Test
public void testIndexReduce1() throws Exception {
    INDArray array1 = Nd4j.create(new float[] { 0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f });
    int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMax(array1))).getFinalResult();
    assertEquals(3, idx);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) IMax(org.nd4j.linalg.api.ops.impl.indexaccum.IMax) IndexAccumulation(org.nd4j.linalg.api.ops.IndexAccumulation) Test(org.junit.Test)

Example 7 with IndexAccumulation

use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.

the class CudaIndexReduceTests method testPinnedIMax2.

@Test
public void testPinnedIMax2() 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.create(new float[] { 6.0f, 0.1f, 2.0f, 3.0f, 7.0f, 5.0f });
    int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMax(array1))).getFinalResult();
    System.out.println("Array1: " + array1);
    assertEquals(4, idx);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) IMax(org.nd4j.linalg.api.ops.impl.indexaccum.IMax) IndexAccumulation(org.nd4j.linalg.api.ops.IndexAccumulation) Test(org.junit.Test)

Example 8 with IndexAccumulation

use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.

the class CudaIndexReduceTests method testPinnedIMax4.

@Test
public void testPinnedIMax4() throws Exception {
    // simple way to stop test if we're not on CUDA backend here
    INDArray array1 = Nd4j.create(new float[] { 0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f });
    int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMax(array1))).getFinalResult();
    System.out.println("Array1: " + array1);
    assertEquals(3, idx);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) IMax(org.nd4j.linalg.api.ops.impl.indexaccum.IMax) IndexAccumulation(org.nd4j.linalg.api.ops.IndexAccumulation) Test(org.junit.Test)

Example 9 with IndexAccumulation

use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.

the class CudaIndexReduceTests method testPinnedIMin2.

@Test
public void testPinnedIMin2() 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.create(new float[] { 0.1f, 1.1f, 2.0f, 3.0f, 4.0f, 5.0f });
    int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMin(array1))).getFinalResult();
    System.out.println("Array1: " + array1);
    assertEquals(0, idx);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) IMin(org.nd4j.linalg.api.ops.impl.indexaccum.IMin) IndexAccumulation(org.nd4j.linalg.api.ops.IndexAccumulation) Test(org.junit.Test)

Example 10 with IndexAccumulation

use of org.nd4j.linalg.api.ops.IndexAccumulation in project nd4j by deeplearning4j.

the class CudaIndexReduceTests method testIMaxLargeLarge.

@Test
public void testIMaxLargeLarge() throws Exception {
    INDArray array1 = Nd4j.linspace(1, 1000, 12800);
    int idx = ((IndexAccumulation) Nd4j.getExecutioner().exec(new IMax(array1))).getFinalResult();
    assertEquals(12799, idx);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) IMax(org.nd4j.linalg.api.ops.impl.indexaccum.IMax) IndexAccumulation(org.nd4j.linalg.api.ops.IndexAccumulation) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)14 INDArray (org.nd4j.linalg.api.ndarray.INDArray)14 IndexAccumulation (org.nd4j.linalg.api.ops.IndexAccumulation)14 IMax (org.nd4j.linalg.api.ops.impl.indexaccum.IMax)10 BaseNd4jTest (org.nd4j.linalg.BaseNd4jTest)4 IMin (org.nd4j.linalg.api.ops.impl.indexaccum.IMin)4 NDArrayIndex.point (org.nd4j.linalg.indexing.NDArrayIndex.point)2 File (java.io.File)1 ClassPathResource (org.datavec.api.util.ClassPathResource)1 VocabWord (org.deeplearning4j.models.word2vec.VocabWord)1 LabelAwareFileSentenceIterator (org.deeplearning4j.text.sentenceiterator.labelaware.LabelAwareFileSentenceIterator)1 LabelAwareSentenceIterator (org.deeplearning4j.text.sentenceiterator.labelaware.LabelAwareSentenceIterator)1 DefaultTokenizerFactory (org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory)1 TokenizerFactory (org.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory)1 DataSet (org.nd4j.linalg.dataset.DataSet)1