Burn Capture
A Burn backend that records operation graphs instead of executing them
Tensors on a capture device are recorded rather than computed. Each capture scope runs ordinary
tensor code, declares the graph's inputs and outputs, and returns a CapturedGraph: the recorded
burn-ir GraphIr plus the recorded
tensor data, such as model weights. This is for tools that need a model's computation as a graph,
such as exporters, rather than its results.
Usage
Enable Burn's capture feature, plus extension to read the IDs of the tensors that bound the
graph:
= { = "0.22", = ["capture", "extension", "flex"] }
= "0.22"
use LinearConfig;
use *;
use ;
let model = new.init;
let device = capture;
let captured = device.capture_scope?;
// `captured.graph` holds the operations and their inputs and outputs; `captured.values` holds
// the recorded tensor data, such as the model's weights.
Module parameters are not graph inputs: their values are recorded. A capture device can be reused for any number of sequential scopes, one at a time.
Part of the Burn deep learning framework. See the Burn Book and the API documentation.