Search in sources :

Example 6 with IMax

use of org.nd4j.linalg.api.ops.impl.indexaccum.IMax 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 IMax

use of org.nd4j.linalg.api.ops.impl.indexaccum.IMax 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 IMax

use of org.nd4j.linalg.api.ops.impl.indexaccum.IMax 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 IMax

use of org.nd4j.linalg.api.ops.impl.indexaccum.IMax 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)

Example 10 with IMax

use of org.nd4j.linalg.api.ops.impl.indexaccum.IMax 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);
}
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

INDArray (org.nd4j.linalg.api.ndarray.INDArray)15 IMax (org.nd4j.linalg.api.ops.impl.indexaccum.IMax)15 Test (org.junit.Test)14 IndexAccumulation (org.nd4j.linalg.api.ops.IndexAccumulation)10 BaseNd4jTest (org.nd4j.linalg.BaseNd4jTest)2 IAMax (org.nd4j.linalg.api.ops.impl.indexaccum.IAMax)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 NdIndexIterator (org.nd4j.linalg.api.iter.NdIndexIterator)1 ManhattanDistance (org.nd4j.linalg.api.ops.impl.accum.distances.ManhattanDistance)1 LogSoftMax (org.nd4j.linalg.api.ops.impl.transforms.LogSoftMax)1 OldSoftMax (org.nd4j.linalg.api.ops.impl.transforms.OldSoftMax)1 SoftMaxDerivative (org.nd4j.linalg.api.ops.impl.transforms.SoftMaxDerivative)1 Sqrt (org.nd4j.linalg.api.ops.impl.transforms.Sqrt)1 DataSet (org.nd4j.linalg.dataset.DataSet)1