tenflowers-core 0.1.1

Core tensor operations and execution engine for TenfloweRS
Documentation
// Logarithm operation compute shader
@group(0) @binding(0) var<storage, read> input: array<f32>;
@group(0) @binding(1) var<storage, read_write> output: array<f32>;

@compute @workgroup_size(64)
fn log_op(@builtin(global_invocation_id) global_id: vec3<u32>) {
    let index = global_id.x;
    if (index >= arrayLength(&input)) {
        return;
    }
    
    output[index] = log(input[index]);
}

// Negation operation compute shader
@compute @workgroup_size(64)
fn neg_op(@builtin(global_invocation_id) global_id: vec3<u32>) {
    let index = global_id.x;
    if (index >= arrayLength(&input)) {
        return;
    }
    
    output[index] = -input[index];
}

// Square root operation compute shader
@compute @workgroup_size(64)
fn sqrt_op(@builtin(global_invocation_id) global_id: vec3<u32>) {
    let index = global_id.x;
    if (index >= arrayLength(&input)) {
        return;
    }
    
    output[index] = sqrt(input[index]);
}