Skip to main content

Crate burn_capture

Crate burn_capture 

Source
Expand description

A backend that records Burn operation graphs instead of executing them.

Tensors moved to a CaptureDevice are recorded rather than computed. Each CaptureDevice::capture_scope call delimits one capture: the closure runs ordinary tensor code, declares the graph’s inputs and outputs through CaptureScope::complete, and the scope 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.

Applications enable the capture feature of burn and use Device::capture() and Device::capture_scope. Inputs and outputs are declared by TensorId; with the extension feature, tensor.clone().try_into_primitive::<CaptureBackend>()?.id() gives a tensor’s ID. A runtime input must come from outside the scope, for example a tensor moved onto the capture device; tensors created inside the scope are recorded as constants.

Structs§

CaptureBridge
Bridge for materialized values between independent capture devices.
CaptureChannel
Router channel selecting the non-executing capture client.
CaptureClient
Client that records router operations and locally retains initialized values.
CaptureDevice
Reusable logical device for isolated graph-capture scopes.
CaptureScope
Token passed to a CaptureDevice::capture_scope closure.
CapturedGraph
Final result of a capture scope.
CompletedCaptureScope
Completion token required from a CaptureDevice::capture_scope closure.
TensorId
The tensor unique identifier.

Enums§

CaptureError
Error returned while finalizing a capture.

Type Aliases§

CaptureBackend
Backend type that records operations instead of executing them.