KMP library for tensors #300
@ -189,11 +189,6 @@ public interface Strides {
|
||||
*/
|
||||
public fun index(offset: Int): IntArray
|
||||
|
||||
/**
|
||||
* Get next multidimensional index from the current multidimensional index
|
||||
*/
|
||||
public fun nextIndex(index: IntArray): IntArray
|
||||
|
||||
/**
|
||||
* The size of linear buffer to accommodate all elements of ND-structure corresponding to strides
|
||||
*/
|
||||
@ -232,7 +227,7 @@ public class DefaultStrides private constructor(override val shape: IntArray) :
|
||||
}
|
||||
|
||||
override fun offset(index: IntArray): Int = index.mapIndexed { i, value ->
|
||||
if (value < 0 || value >= shape[i]) throw IndexOutOfBoundsException("Index $value out of shape bounds: (0,${shape[i]})")
|
||||
if (value < 0 || value >= shape[i]) throw IndexOutOfBoundsException("Index $value out of shape bounds: (0,${this.shape[i]})")
|
||||
value * strides[i]
|
||||
}.sum()
|
||||
|
||||
@ -250,10 +245,6 @@ public class DefaultStrides private constructor(override val shape: IntArray) :
|
||||
return res
|
||||
}
|
||||
|
||||
override fun nextIndex(index: IntArray): IntArray {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (other !is DefaultStrides) return false
|
||||
@ -275,7 +266,6 @@ public class DefaultStrides private constructor(override val shape: IntArray) :
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public inline fun <reified T : Any> StructureND<T>.combine(
|
||||
struct: StructureND<T>,
|
||||
crossinline block: (T, T) -> T,
|
||||
|
Loading…
Reference in New Issue
Block a user