// tensor_test.sy — Test the Tensor type in Scyla.
// Phase 1 of the AI compiler.
// Aislinn McCubbins, April 2026

fn main() {
    // Create tensors
    let a = zeros(2, 3)
    println("Zeros:")
    println(a)

    let b = ones(2, 3)
    println("Ones:")
    println(b)

    let c = rand_tensor(2, 3)
    println("Random:")
    println(c)

    // Element-wise operations
    let d = a + b
    println("zeros + ones:")
    println(d)

    let e = b + b
    println("ones + ones:")
    println(e)

    // Matrix multiplication: [2,3] @ [3,2] -> [2,2]
    let w = ones(3, 2)
    let result = matmul(e, w)
    println("matmul [2,3] @ [3,2]:")
    println(result)

    // ReLU
    let neg = zeros(2, 2)
    let activated = relu(result)
    println("relu:")
    println(activated)

    // Softmax
    let probs = softmax(activated)
    println("softmax:")
    println(probs)

    // Sum
    let total = tensor_sum(probs)
    println("sum of softmax (should be ~2.0):")
    println(total)

    // Transpose
    let t = transpose(result)
    println("transpose [2,2] -> [2,2]:")
    println(t)

    // Shape
    let s = tensor_shape(result)
    println("shape: " + s)

    println("Tensor system operational!")
}
