@@ -7,82 +7,82 @@ import sk.ainet.lang.types.DType
77/* *
88 * The core tensor abstraction in the SKaiNET framework, representing a fundamental
99 * architectural decision to compose tensors from data and operations.
10- *
10+ *
1111 * ## Fundamental Architectural Decision: Tensor Composition
12- *
12+ *
1313 * This interface embodies a key architectural principle in the SKaiNET framework:
1414 * **tensors are composed of two distinct, complementary components:**
15- *
15+ *
1616 * 1. **Data Component (`TensorData`)** - Responsible for:
1717 * - Multi-dimensional data storage and indexing
1818 * - Memory layout and access patterns
1919 * - Shape and dimensional metadata
2020 * - Type-safe element access
21- *
21+ *
2222 * 2. **Operations Component (`TensorOps`)** - Responsible for:
2323 * - Mathematical operations and transformations
2424 * - Computational algorithms
2525 * - Operation chaining and composition
2626 * - Performance-optimized implementations
27- *
27+ *
2828 * ## Benefits of This Compositional Architecture
29- *
29+ *
3030 * **Separation of Concerns**: Data management is cleanly separated from computational
3131 * logic, making the codebase more maintainable and easier to understand.
32- *
32+ *
3333 * **Flexibility**: Different data storage strategies (dense, sparse, distributed) can
3434 * be combined with different operation implementations (CPU, GPU, specialized hardware)
3535 * without tight coupling.
36- *
36+ *
3737 * **Performance Optimization**: Data layout can be optimized independently from
3838 * computational algorithms, enabling targeted performance improvements.
39- *
39+ *
4040 * **Extensibility**: New data formats or operation types can be added without
4141 * modifying existing code, following the open-closed principle.
42- *
42+ *
4343 * **Testability**: Data and operations can be tested independently, improving
4444 * test coverage and reducing complexity.
45- *
45+ *
4646 * ## Usage Pattern
47- *
47+ *
4848 * The tensor acts as a unified interface that delegates data access to the `data`
4949 * component and computational operations to the `ops` component, providing a
5050 * seamless experience while maintaining the benefits of compositional design.
51- *
51+ *
5252 * @param T the data type constraint extending DType, defining the numerical precision
5353 * @param V the actual value type that will be stored and accessed
5454 */
5555public interface Tensor <T : DType , V > {
5656 /* *
5757 * The data component responsible for storage, indexing, and memory management.
58- *
58+ *
5959 * This component handles all aspects related to data storage and access,
60- * including multi-dimensional indexing, shape management, and memory layout
60+ * including multidimensional indexing, shape management, and memory layout
6161 * optimization. It provides the foundation for the tensor's data model.
6262 */
6363 public val data: TensorData <T , V >
64-
64+
6565 /* *
6666 * The operations component responsible for computational algorithms and transformations.
67- *
67+ *
6868 * This component provides all mathematical operations that can be performed
6969 * on the tensor, from basic arithmetic to complex neural network operations.
7070 * It leverages the data component for element access while encapsulating
7171 * all computational logic.
7272 */
73- public val ops: TensorOps <T , V >
73+ public val ops: TensorOps <V >
7474
7575 /* *
7676 * The data type descriptor defining the numerical precision and value representation.
77- *
77+ *
7878 * This property provides metadata about the tensor's data type, enabling
7979 * type-safe operations and appropriate memory allocation strategies.
8080 */
8181 public val dtype: T
8282
8383 /* *
8484 * The shape descriptor inherited from the data component.
85- *
85+ *
8686 * This property delegates to the data component's shape, maintaining consistency
8787 * between the tensor interface and its underlying data representation.
8888 */
@@ -91,7 +91,7 @@ public interface Tensor<T : DType, V> {
9191
9292 /* *
9393 * The total number of elements in the tensor.
94- *
94+ *
9595 * This computed property provides quick access to the tensor's total size,
9696 * calculated from the shape's volume. Useful for memory allocation and
9797 * iteration operations.
@@ -101,7 +101,7 @@ public interface Tensor<T : DType, V> {
101101
102102 /* *
103103 * The number of dimensions in the tensor.
104- *
104+ *
105105 * This computed property provides quick access to the tensor's dimensionality,
106106 * derived from the shape's rank. Essential for dimension-aware operations
107107 * and broadcasting compatibility checks.
0 commit comments