Skip to main content

Module trace

Module trace 

Source
Expand description

Tracing API — build IR graphs by recording operations on traced tensors.

use rlx_runtime::trace::*;
use rlx_ir::{DType, shape::Dim};

let graph = trace("model", |t| {
    let x = t.input("x", &[4, 384], DType::F32);
    let w = t.param("w", &[384, 1536], DType::F32);
    let b = t.param("b", &[1536], DType::F32);
    let mm = t.matmul(x, w);
    let out = (mm + b).gelu();
    vec![out]
});

Structs§

TracedTensor
A traced tensor — records ops instead of executing them.
Tracer
Records operations into an IR graph.

Functions§

trace
Trace a function into an IR graph.