Implement kmath-nd4j: module that implements NDStructure for INDArray of ND4J #116

Merged
CommanderTvis merged 50 commits from nd4j into dev 2020-10-29 19:58:53 +03:00
Showing only changes of commit e466f4bdf2 - Show all commits

View File

@ -3,6 +3,7 @@ package scientifik.kmath.nd4j
import org.nd4j.linalg.factory.Nd4j import org.nd4j.linalg.factory.Nd4j
import kotlin.test.Test import kotlin.test.Test
import kotlin.test.assertEquals import kotlin.test.assertEquals
import scientifik.kmath.structures.get
internal class INDArrayStructureTest { internal class INDArrayStructureTest {
@Test @Test
@ -35,4 +36,11 @@ internal class INDArrayStructureTest {
val struct = INDArrayIntStructure(nd) val struct = INDArrayIntStructure(nd)
assertEquals(5, struct.dimension) assertEquals(5, struct.dimension)
} }
@Test
fun testGet() {
val nd = Nd4j.rand(10, 2, 3, 6)!!
val struct = INDArrayIntStructure(nd)
assertEquals(nd.getInt(0, 0, 0, 0), struct[0, 0, 0, 0])
}
} }