Skip to main content

luma_tensor/
lib.rs

1//! **luma-tensor** — a tensor computation library with:
2//! - Compile-time **kind** separation (`Float`, `Int`, `Bool`) so a `Float`
3//!   tensor cannot accidentally participate in a `Bool` operation.
4//! - Runtime **precision** (`f32`, `f64`, `i32`, …) within each kind, decided
5//!   at construction time via [`DType`].
6//! - A **device** abstraction ([`Device`]) that lets the same code run on `Cpu`
7//!   or (in the future) `Cuda`.
8//! - A tape-based **autograd** engine that tracks only `Float`-kind tensors.
9pub mod device;
10pub mod dtype;
11pub mod dynamic;
12pub mod error;
13pub mod grad;
14pub mod ops;
15pub mod scalar;
16pub mod tensor;
17
18// convenience re-exports
19pub use device::cpu::{Cpu, CpuBoolStorage, CpuFloatStorage, CpuIntStorage};
20#[cfg(feature = "cuda")]
21pub use device::cuda::{Cuda, CudaBoolStorage, CudaFloatStorage, CudaIntStorage};
22pub use device::{BoolOps, Device, FloatOps, IntOps};
23
24pub use dtype::{Bool, DType, DTypeKind, Float, Int, KindTag, Storage, FloatDType, IntDType, BoolDType};
25pub use dynamic::DynTensor;
26pub use error::{Error, Result};
27pub use grad::{FloatMeta, GradStore, NoGradGuard, TensorMeta, is_grad_enabled, set_grad_enabled};
28pub use ops::{BinaryOp, CmpOp, FloatUnaryOp, Op, ReduceOp, TransferDTypeKind, UnaryOp, ViewOp};
29pub use ops::{IndexOp, Indexer, Slice};
30pub use scalar::Scalar;
31pub use tensor::{D, Dim, Dims, Layout, Shape, StorageIndices, Tensor, TensorId, TensorImpl};