Burn Tensor
Burn's tensor API
Tensor<D, K> is a tensor of rank D and kind K (Float by default, Int or Bool). Its
Device decides which backend runs it, at runtime: the same Tensor<2> can live on CUDA, wgpu or
the CPU, and code that uses tensors has no backend type parameter. Applications use this crate
through burn::tensor.
use ;
let device = default;
let x = from_floats;
let y = x.clone.matmul.exp;
let first_row = y.slice;
Device: backend selection, configuration and enumeration. A backend's constructor (Device::cuda,Device::wgpu,Device::flex, ...) exists when its feature is enabled.TensorData,DTypeandShape: tensor contents and metadata, independent of any backend.activation,lossandmodule: functional forms of activations, losses and neural network operations such as convolution and pooling.quantization,gridanddistributed: quantized tensors, grid sampling and collective operations across devices.einsum!,assert_shape!ands!: macros for Einstein summation, shape checks and slicing.
With the autodiff feature, create tensors on device.autodiff() and call require_grad() on
source leaves whose gradients you need.
See the tensor chapter of the Burn Book.
Feature Flags
std(default): standard library support. Without it the crate isno_stdwithalloc.- Backends:
cuda,rocm,wgpu,metal,vulkan,webgpu,cpu,flex, and the deprecatedndarrayandtch. autodiff,fusion: backend decorators.remote,remote-server,remote-websocket: devices hosted by another machine.capture: record operation graphs instead of executing them.extension: access to backend primitives for backend extensions.tracing: instrument operations with thetracingcrate.
Part of the Burn deep learning framework. See the Burn Book and the API documentation.