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
2 changed files with 3 additions and 2 deletions
Showing only changes of commit 9a4dd31507 - Show all commits

View File

@ -0,0 +1,3 @@
package scientifik.kmath.nd4j
internal fun narrowToIntArray(la: LongArray): IntArray = IntArray(la.size) { la[it].toInt() }

View File

@ -3,8 +3,6 @@ package scientifik.kmath.nd4j
import org.nd4j.linalg.api.ndarray.INDArray
import scientifik.kmath.structures.NDStructure
internal fun narrowToIntArray(la: LongArray): IntArray = IntArray(la.size) { la[it].toInt() }
data class ND4JStructure<T>(val ndArray: INDArray) : NDStructure<INDArray> {
override val shape: IntArray
get() = narrowToIntArray(ndArray.shape())