Skip to main content

oxmera_ops/
lib.rs

1//! The operation vocabulary oxmera backends implement.
2//!
3//! The trait and enums are defined in `oxmera-tensor` (they must live with
4//! `Tensor` so its methods and `std::ops` overloads can dispatch under the
5//! orphan rule); this crate re-exports them as the stable, documented
6//! vocabulary for backend authors.
7//!
8//! Semantics every backend must honor:
9//!
10//! - Binary elementwise operations broadcast per
11//!   [`oxmera_core::shape::broadcast_shapes`].
12//! - Operands must share a device and dtype; violations are typed errors,
13//!   never coercions.
14//! - The output of every operation is a fresh contiguous tensor on the
15//!   operands' device.
16//! - The CPU backend defines correct answers; every other backend is
17//!   validated against it within floating-point tolerance.
18
19#![forbid(unsafe_code)]
20#![warn(missing_docs)]
21
22pub use oxmera_tensor::backend::{
23    Backend, BinaryOp, MatmulPlan, ReduceOp, UnaryOp, backend_for, plan_matmul, register_backend,
24    registered_devices,
25};