Skip to main content

burn_linalg/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![warn(missing_docs)]
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![cfg_attr(feature = "tch", allow(deprecated))]
5#![cfg_attr(feature = "ndarray", allow(deprecated))]
6
7//! Linear algebra operations for Burn tensors.
8//!
9//! No execution backend is enabled by default. Select `flex`, `wgpu`, or another
10//! backend feature on this crate. When configuring through `burn`, enable both
11//! `linalg` and the backend feature, for example `features = ["linalg", "flex"]`.
12//! Enabling only `burn/flex` does not enable this crate's backend implementations.
13//!
14//! # Migration
15//!
16//! Linear algebra previously lived at `burn_tensor::linalg` (and therefore
17//! `burn_core::tensor::linalg`). Those direct-crate paths are intentionally
18//! removed. Use this crate directly, or `burn::linalg` from the umbrella crate.
19
20extern crate alloc;
21
22use burn_core::tensor::{AsIndex, Bool, DType, Device, ElementConversion, Float, Int, Tensor, s};
23
24macro_rules! check {
25    ($check:expr) => {
26        if let $crate::check::TensorCheck::Failed(check) = $check {
27            core::panic!("{}", check.format());
28        }
29    };
30}
31
32mod check;
33mod functions;
34mod ops;
35mod svd_host;
36
37// Keep the moved implementations focused on their algorithms. These private
38// aliases mirror the old burn-tensor layout without restoring its public API.
39mod kind {
40    pub(crate) use burn_core::tensor::kind::{Basic, Numeric, Ordered};
41}
42mod tensor {
43    pub(crate) use burn_core::tensor::{Int, Shape, Tensor};
44}
45pub use functions::*;
46pub use ops::LinalgOps;