coeus-ops 0.14.0

Numerical tensor operators for Coeus.
Documentation
//! Interface-segregated sub-traits for [`BackendOps`].
//!
//! This module exports single-concern capability traits. `BackendOps`
//! composes the six capabilities shared by every backend; attention, optimizer,
//! random initialization, and half-vector rotation remain optional capabilities
//! so unrelated kernels do not acquire unsupported bounds. Backends implement
//! each trait independently;
//! the blanket impl in
//! [`crate::backend_ops::trait_def`] provides `BackendOps` automatically.  This satisfies
//! the interface-segregation principle: call sites can bound on only the
//! sub-trait they need (e.g. `B: ElementwiseOps<T>`) instead of pulling in
//! all 36 methods.
//!
//! Sub-traits and their concerns:
//! - [`ElementwiseOps`] — binary and unary element-wise ops
//! - [`FiniteDifference3DOps`] — 3-D first-derivative stencils, fixed schemes
//!   and the arbitrary-order staggered gradient/divergence pair
//! - [`MatmulOps`] — matmul, batched matmul, accumulate variants
//! - [`ReductionOps`] — reduce, argmax/argmin, topk, cumulative sum/product scans
//! - [`ConvOps`] — regular convolution and 1D/2D transposed convolution
//! - [`CrossOps`] — per-channel 3-vector cross product
//! - [`PoolOps`] — max/avg pool 1D/2D/3D forward+backward
//! - [`AttentionOps`] — scaled dot-product attention forward+backward
//! - [`CrossEntropyOps`] — mean classification loss and additive backward
//! - [`CtcOps`] — sequence alignment loss and additive log-probability gradients
//! - [`OptimizerOps`] — fused SGD/Adam/RMSProp/AdamW/AdaGrad steps
//! - [`RandomInitOps`] — seeded provider-native parameter initialization
//! - [`RotateHalfOps`] — rotary half-vector permutation
//! - [`UnfoldFoldOps`] — sliding-window unfold and adjoint fold (1D/2D)
//!
//! [`BackendOps`]: super::BackendOps

#![expect(
    clippy::too_many_arguments,
    reason = "kernel trait methods carry per-axis geometry; grouping into a parameter struct is a cross-crate API change"
)]

pub mod attention;
pub mod conv;
/// Per-channel 3-vector cross product capability.
pub mod cross;
pub mod cross_entropy;
pub mod ctc;
pub mod elementwise;
/// Three-dimensional first-derivative stencils.
pub mod finite_difference;
pub mod matmul;
pub mod optimizer;
pub mod pool;
pub mod random_init;
pub mod reduction;
/// Half-vector rotation capability.
pub mod rotate_half;
pub mod unfold_fold;

pub use attention::{AttentionOps, AttentionScalar};
pub use conv::{ConvOps, ConvolutionBackward, ConvolutionForward};
pub use cross::CrossOps;
pub use cross_entropy::CrossEntropyOps;
pub use ctc::{CtcBatch, CtcOps};
pub use elementwise::{ElementwiseOps, ScalarPowerOps};
pub use finite_difference::{
    Axis, FiniteDifference3DOps, FiniteDifference3DScheme, StaggeredPairOps,
};
pub use matmul::MatmulOps;
pub use optimizer::{OptimizerOps, OptimizerStateRef, OptimizerStepRule, OptimizerStepValidation};
pub use pool::PoolOps;
pub use random_init::RandomInitOps;
pub use reduction::ReductionOps;
pub use rotate_half::RotateHalfOps;
pub use unfold_fold::UnfoldFoldOps;