Expand description
§Burn Standard Library
Core types and utilities shared across the Burn crates.
Shape, slicing (s!) and indexing helpers.DType, the element traits and conversions, andTensorData, the backend-independent representation of tensor contents.Distributionfor random tensor initialization.DeviceSettings, per-device defaults such as dtypes.- Quantization schemes,
Bytes, identifiers and errors. config: runtime configuration read fromburn.toml.network: file downloads with a progress bar (networkfeature).
Applications use these through burn::tensor. The crate supports no_std with alloc.
§Feature flags
std(default): standard library support.network: file downloads.tracing: instrument operations with thetracingcrate.
Re-exports§
pub use tensor::*;pub use data::*;pub use distribution::*;pub use element::*;pub use runtime_kind::*;pub use ops::*;
Modules§
- arena
std - A circular, allocation-free arena for reusable memory blocks.
- backtrace
- Backtrace module to build error reports.
- benchmark
- Module for benchmark timings
- bytes
- Utilities module to manipulate bytes.
- config
- Burn runtime configurations.
- data
- Tensor data representation and helpers.
- device
- Device module.
- device_
handle - Device handle module.
- distributed
- Distributed configurations.
- distribution
- Random value distributions. Random value distributions used to initialize and populate tensor data.
- element
- Traits for tensor element types and conversions. Traits and helpers for working with element types and conversions.
- errors
- Common Errors.
- format
- Format utilities.
- future
- Future utils with a compatible API for native, non-std and wasm environments.
- id
- Id module contains types for unique identifiers.
- ops
- Configuration types for tensor operations (conv, pool, interpolate, pad, etc). Configuration types for tensor operations.
- pool
- A dynamically-growing pool that leases exclusive, reusable single-cell items. A dynamically-growing pool of single-cell items handed out as exclusive, non-cloneable handles.
- profile
- Module for profiling any executable part
- quant
- Quantization primitives required outside of
cubecl-quant - rand
- Rand module contains types for random number generation for non-std environments and for std environments.
- reader
- Read async data without having to decorate each function with async notation.
- runtime_
kind - Runtime kind of the host program (async / sync / no-std). Runtime kind of the host program.
- self
- Common Errors.
- stream
- Stream identity, policies and manual stream management. Stream identity, policies and manual stream management.
- sync
- Synchronization primitives working across std, no-std and wasm environments.
- tensor
- Tensor utilities.
- work
- The work a benchmark or a kernel performs, for scoring against measured peaks.
Macros§
- make_
element - Macro to implement the element trait for a type.
- obfuscate
- Generate a type-erased, inline wrapper for a single value.
- s
- Slice argument constructor for tensor indexing.
Structs§
- Access
Policy - What an access is allowed to do to satisfy a read/write of a
Bytes. - Bytes
- A buffer similar to
Box<[u8]>that supports custom memory alignment and allows trailing uninitialized bytes. - Comptime
Float - A finite float usable as a comptime kernel parameter.
- Device
Handle - A handle to one service, reached as
S. - Device
Settings - Settings controlling the default data types for a specific device.
- File
Read Counter std - The bytes read from one file through file-backed
Byteswhile this counter is alive. - Invalid
Comptime Float - A float value that cannot be used as a
ComptimeFloatbecause it is infinite or NaN. - Ratio
- An exact ratio of two integers, reduced to lowest terms on construction.
- Reader
- Configures a read of a
Bytes. - Shared
Allocation Controller - Allocation controller that shares a view into another
Bytesbehind anArc. - Shared
Bytes Allocation Controller shared-bytes - Allocation controller backed by
bytes::Bytesfor zero-copy access. - Stride
Record - Common Errors. Collected shape/stride record.
- Writer
- Configures a mutable access of a
Bytes. - bf16
- A 16-bit floating point type implementing the
bfloat16format. - e2m1
- A 4-bit floating point type with 2 exponent bits and 1 mantissa bit.
- e2m3
- A 6-bit floating point type with 2 exponent bits and 3 mantissa bits.
- e2m1x2
- A 4-bit floating point type with 2 exponent bits and 1 mantissa bit. Packed with two elements per value, to allow for conversion to/from bytes. Care must be taken to ensure the shape is adjusted appropriately.
- e3m2
- A 6-bit floating point type with 3 exponent bits and 2 mantissa bits.
- e4m3
fp8 - A 8-bit floating point type with 4 exponent bits and 3 mantissa bits.
- e5m2
fp8 - A 8-bit floating point type with 5 exponent bits and 2 mantissa bits.
- f16
- A 16-bit floating point type implementing the IEEE 754-2008 standard
binary16a.k.a “half” format. - flex32
- A floating point type with relaxed precision, minimum
f16, maxf32. - tf32
- A 19-bit floating point type implementing the
tfloat32format. - ue8m0
- An 8-bit unsigned floating point type with 8 exponent bits and no mantissa bits. Used for scaling factors.
Enums§
- Access
Error - Error returned when accessing a
Bytes. - Allocation
Error - Errors that may occur during memory allocation operations.
- Allocation
Property - The kind of allocation behind the Bytes type.
- Bounds
Error - Common Errors. Access Bounds Error.
- Device
Error - Errors returned by device-related operations.
- Execution
Error - An error that can happen when syncing a device.
- Expression
Error - Common Errors. Common Expression Error.
- Index
Kind - Common Errors. Describes the kind of an index.
- Split
Error - Error when splitting an allocation.
- Split
Policy - Controls how
Bytes::splitbehaves when the allocation can’t be split in place. - Stride
Error - Common Errors. Error describing striding issues.
- View
Error - Error when taking a view into an allocation.
Traits§
- Allocation
Controller - Defines how an
Allocationcan be controlled. - Float
Bits - A float type whose bit representation can stand in for
PartialEq/Eq/Hash.
Functions§
- powi_
portable - Rust’s
powireturns mathematically incorrect results on Windows for large negative exponents. This is an implementation of the standard exponentiation by squaring algorithm used by compilers on most platforms to implement accurate powi. Should be bit-identical to the one in LLVM’scompiler-rt.