Skip to main content

oxmera_tensor/
lib.rs

1//! The oxmera tensor: shared storage viewed through a layout, with
2//! multi-device backends and reverse-mode autograd.
3//!
4//! This crate is the hub of the framework:
5//!
6//! - [`Tensor`] — the value type: constructors, zero-copy strided views,
7//!   element access, and the full differentiable op surface (`add`,
8//!   `matmul`, `softmax`, …) plus `std::ops` operator sugar.
9//! - [`backend`] — the op vocabulary ([`backend::UnaryOp`],
10//!   [`backend::BinaryOp`], [`backend::ReduceOp`]), the [`backend::Backend`]
11//!   trait every device implements, and the registry that resolves a
12//!   [`oxmera_core::Device`] handle. The traits live here so tensor
13//!   methods and operator overloads can dispatch without violating the
14//!   orphan rule.
15//! - [`autograd`] — the tape: recording switch, [`autograd::no_grad`],
16//!   and gradient propagation; `Tensor::backward` drives it.
17//!
18//! Backends register themselves at load time (linking `oxmera-cpu` or
19//! `oxmera-metal` is what makes their device usable); the `oxmera`
20//! umbrella crate links every backend for the current platform.
21
22#![deny(unsafe_code)] // the two Metal Send/Sync impls in `storage` opt in locally
23#![warn(missing_docs)]
24
25pub mod autograd;
26pub mod backend;
27pub mod cpu;
28mod cpu_iter;
29mod cpu_matmul;
30pub mod ops;
31pub mod overload;
32pub mod storage;
33pub mod tensor;
34
35pub use autograd::{NoGradGuard, no_grad};
36pub use backend::{Backend, BinaryOp, ReduceOp, UnaryOp, backend_for, register_backend};
37pub use storage::{CpuStorage, OpaqueBuffer, Storage, StorageData};
38pub use tensor::Tensor;