Skip to content

Commit df90721

Browse files
committed
Implement simple utility for tensors printing
Relate-To: #104, #108
1 parent 267bb21 commit df90721

16 files changed

Lines changed: 992 additions & 93 deletions

File tree

settings.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@ include("skainet-core:skainet-performance")
2121
include("skainet-core:skainet-reflection")
2222
include("skainet-nn:skainet-nn-api")
2323
include("skainet-nn:skainet-nn-relection")
24+
//include("skainet-data:skainet-data-api")
25+
//include("skainet-data:skainet-data-simple")

skainet-core/skainet-tensors-api/src/commonMain/kotlin/sk/ainet/core/tensor/DType.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ public object Int8 : DType {
2222
override val name: String = "Int8"
2323
}
2424

25+
public object Int32 : DType {
26+
override val sizeInBits: Int = 32
27+
override val name: String = "Int32"
28+
}
29+
2530
public object FP16 : DType {
2631
override val sizeInBits: Int = 16
2732
override val name: String = "Float16"

skainet-core/skainet-tensors-api/src/commonMain/kotlin/sk/ainet/core/tensor/Tensor.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ package sk.ainet.core.tensor
77
* The [shape] property defines the dimensions of the tensor, and the [get] operator
88
* allows accessing individual elements by their indices.
99
*/
10-
public interface Tensor<T : DType, V> : TensorData<T, V>, TensorOps<Tensor<T, V>>
10+
public interface Tensor<T : DType, V> : TensorData<T, V>, TensorOps<T, V, Tensor<T, V>>
1111

skainet-core/skainet-tensors-api/src/commonMain/kotlin/sk/ainet/core/tensor/TensorOps.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ package sk.ainet.core.tensor
66
* Keeps math separate from storage, so the same math API can work
77
* with multiple backends (dense, sparse, GPU, etc.).
88
*/
9-
public interface TensorOps<T : Tensor<*, *>> {
9+
public interface TensorOps<D : DType, V, T : Tensor<D, V>> {
1010
/**
1111
* Performs matrix multiplication of two tensors.
1212
*

skainet-core/skainet-tensors-api/src/commonMain/kotlin/sk/ainet/core/tensor/backend/ComputeBackend.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import sk.ainet.core.tensor.TensorOps
1212
* hardware platform (CPU, GPU, etc.). Different backends can provide different
1313
* implementations of the same operations, optimized for their target platform.
1414
*/
15-
public interface ComputeBackend<D : DType, V> : TensorOps<Tensor<D, V>> {
15+
public interface ComputeBackend<D : DType, V> : TensorOps<D, V, Tensor<D, V>> {
1616
/**
1717
* The name of the backend.
1818
*/

0 commit comments

Comments
 (0)