Skip to main content

burn_std/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![warn(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4
5//! # Burn Standard Library
6//!
7//! Core types and utilities shared across the Burn crates.
8//!
9//! - [`Shape`], slicing ([`s!`]) and indexing helpers.
10//! - [`DType`], the element traits and conversions, and [`TensorData`], the backend-independent
11//!   representation of tensor contents.
12//! - [`Distribution`] for random tensor initialization.
13//! - [`DeviceSettings`], per-device defaults such as dtypes.
14//! - Quantization schemes, [`Bytes`], identifiers and errors.
15//! - [`config`]: runtime configuration read from `burn.toml`.
16//! - `network`: file downloads with a progress bar (`network` feature).
17//!
18//! Applications use these through `burn::tensor`. The crate supports `no_std` with `alloc`.
19//!
20//! # Feature flags
21//!
22//! - `std` (default): standard library support.
23//! - `network`: file downloads.
24//! - `tracing`: instrument operations with the `tracing` crate.
25
26#[macro_use]
27extern crate derive_new;
28
29extern crate alloc;
30
31/// Id module contains types for unique identifiers.
32pub mod id;
33
34/// Tensor utilities.
35pub mod tensor;
36pub use tensor::*;
37
38/// Tensor data representation and helpers.
39pub mod data;
40pub use data::*;
41
42/// Random value distributions.
43pub mod distribution;
44pub use distribution::*;
45
46/// Traits for tensor element types and conversions.
47pub mod element;
48pub use element::*;
49
50mod device_settings;
51pub use device_settings::*;
52
53/// Runtime kind of the host program (async / sync / no-std).
54pub mod runtime_kind;
55pub use runtime_kind::*;
56
57/// Distributed configurations.
58pub mod distributed;
59
60/// Configuration types for tensor operations (conv, pool, interpolate, pad, etc).
61pub mod ops;
62pub use ops::*;
63
64/// Burn runtime configurations.
65pub mod config;
66
67/// Common Errors.
68pub use cubecl_zspace::errors::{self, *};
69
70/// Network utilities.
71#[cfg(feature = "network")]
72pub mod network;
73
74pub use cubecl_common::device_handle::DeviceHandle;
75pub use cubecl_common::*;
76pub use cubecl_environment::bytes::*;
77
78// Environment shims live in `cubecl-environment`. They are re-exported here so
79// backends and other burn crates don't have to depend on it directly.
80pub use cubecl_environment::future::reader;
81pub use cubecl_environment::{backtrace, future, rand, stream, sync};
82
83pub use half::{bf16, f16};
84
85pub use cubecl_common::flex32;