Skip to main content

Crate coeus_ops

Crate coeus_ops 

Source
Expand description

Tensor operation kernels and backend dispatch for the Coeus stack.

§Operation families

  • Elementwise — unary and binary kernels dispatched via ElementwiseOps::elementwise_unary / ElementwiseOps::elementwise_binary.
  • Linear algebra — matmul(), sparse SpMM/SpMV.
  • Reductions — reduction: sum, mean, max/min, argmax/argmin, topk, cumulative sum/product scans, plus vector arithmetic dot (flat inner product) and cross (per-channel 3-vector cross along dim), plus matrix norms frobenius_norm / frobenius_norm_batched (compose on norm for torch.linalg.matrix_norm(A, ord='fro')).
  • Convolution — 1-D/2-D/3-D forward+backward routed through BackendOps::conv1d/conv2d/conv3d.
  • Pooling — max and average pooling (2-D/3-D) with backward gradients.
  • Resize — nearest/bilinear/bicubic/area spatial resize (1-D/2-D) in resize, with the matching reverse-mode scatter.
  • Attention — attention::scaled_dot_product_attention with causal/padding mask support.
  • Fused expressions — fuse lazy expression DAG evaluated in a single pass on CPU.
  • Optimizer steps — provider-dispatched sgd_step, adam_step, adamw_step, rmsprop_step, and adagrad_step on OptimizerOps.

Re-exports§

pub use backend_ops::cross_fold;
pub use backend_ops::AttentionOps;
pub use backend_ops::AttentionScalar;
pub use backend_ops::BackendOps;
pub use backend_ops::ConvOps;
pub use backend_ops::ConvolutionBackward;
pub use backend_ops::ConvolutionForward;
pub use backend_ops::CpuBackend;
pub use backend_ops::CrossEntropyOps;
pub use backend_ops::CrossOps;
pub use backend_ops::CtcBatch;
pub use backend_ops::CtcOps;
pub use backend_ops::ElementwiseOps;
pub use backend_ops::FiniteDifference3DOps;
pub use backend_ops::MatmulOps;
pub use backend_ops::OptimizerOps;
pub use backend_ops::OptimizerStateRef;
pub use backend_ops::OptimizerStepRule;
pub use backend_ops::OptimizerStepValidation;
pub use backend_ops::PoolOps;
pub use backend_ops::RandomInitOps;
pub use backend_ops::ReductionOps;
pub use backend_ops::RotateHalfOps;
pub use backend_ops::ScalarPowerOps;
pub use backend_ops::StaggeredPairOps;
pub use backend_ops::UnfoldFoldOps;
pub use unary::abs;
pub use unary::abs_assign;
pub use unary::acos;
pub use unary::acosh;
pub use unary::asin;
pub use unary::asinh;
pub use unary::atan;
pub use unary::atanh;
pub use unary::causal_softmax;
pub use unary::ceil;
pub use unary::ceil_assign;
pub use unary::cos;
pub use unary::cos_assign;
pub use unary::cosh;
pub use unary::elementwise_unary;
pub use unary::elementwise_unary_assign;
pub use unary::elementwise_unary_to;
pub use unary::elu;
pub use unary::elu_assign;
pub use unary::erf;
pub use unary::erfc;
pub use unary::exp;
pub use unary::exp2;
pub use unary::exp_assign;
pub use unary::expm1;
pub use unary::floor;
pub use unary::floor_assign;
pub use unary::gelu;
pub use unary::gelu_assign;
pub use unary::gelu_tanh;
pub use unary::gelu_tanh_assign;
pub use unary::glu;
pub use unary::leaky_relu;
pub use unary::leaky_relu_assign;
pub use unary::lgamma;
pub use unary::log;
pub use unary::log10;
pub use unary::log1p;
pub use unary::log2;
pub use unary::log_assign;
pub use unary::log_softmax_axis;
pub use unary::masked_softmax;
pub use unary::mish;
pub use unary::mish_assign;
pub use unary::neg;
pub use unary::neg_assign;
pub use unary::pow_scalar;
pub use unary::recip;
pub use unary::recip_assign;
pub use unary::relu;
pub use unary::relu_assign;
pub use unary::round;
pub use unary::round_assign;
pub use unary::sigmoid;
pub use unary::sigmoid_assign;
pub use unary::sign;
pub use unary::sign_assign;
pub use unary::silu;
pub use unary::silu_assign;
pub use unary::sin;
pub use unary::sin_assign;
pub use unary::sinh;
pub use unary::softplus;
pub use unary::softplus_assign;
pub use unary::sqrt;
pub use unary::sqrt_assign;
pub use unary::tan;
pub use unary::tanh;
pub use unary::tanh_assign;
pub use unary::trunc;
pub use unary::trunc_assign;
pub use binary::add;
pub use binary::add_assign;
pub use binary::div;
pub use binary::div_assign;
pub use binary::elementwise_binary;
pub use binary::elementwise_binary_to;
pub use binary::eq;
pub use binary::ge;
pub use binary::gt;
pub use binary::le;
pub use binary::lt;
pub use binary::mul;
pub use binary::mul_assign;
pub use binary::ne;
pub use binary::sub;
pub use binary::sub_assign;
pub use embedding::embedding;
pub use embedding::embedding_backward;
pub use embedding::embedding_backward_with_padding_idx;
pub use interpolation::linear_interpolation;
pub use interpolation::linear_interpolation_backward;
pub use interpolation::BoundaryPolicy;
pub use interpolation::Dimension;
pub use interpolation::InterpolationError;
pub use interpolation::InterpolationFailure;
pub use interpolation::InterpolationGradients;
pub use interpolation::Replicate;
pub use interpolation::SupportedDimension;
pub use matmul::bmm;
pub use matmul::matmul;
pub use matmul::matmul_accumulate;
pub use matmul::outer;
pub use reduction::amax;
pub use reduction::amin;
pub use reduction::argmax;
pub use reduction::argmin;
pub use reduction::cross;
pub use reduction::cumprod;
pub use reduction::cumprod;
pub use reduction::cumsum;
pub use reduction::cumsum;
pub use reduction::dot;
pub use reduction::frobenius_norm;
pub use reduction::frobenius_norm_batched;
pub use reduction::max_axis;
pub use reduction::mean;
pub use reduction::mean;
pub use reduction::mean_axis;
pub use reduction::min_axis;
pub use reduction::norm;
pub use reduction::norm_p;
pub use reduction::norm_p_axis;
pub use reduction::norm_p_tensor;
pub use reduction::prod;
pub use reduction::prod_axis;
pub use reduction::prod_tensor;
pub use reduction::std_dev;
pub use reduction::std_dev_axis;
pub use reduction::std_mean;
pub use reduction::std_mean_axis;
pub use reduction::suffix_prod;
pub use reduction::suffix_sum;
pub use reduction::sum;
pub use reduction::sum;
pub use reduction::sum_axis;
pub use reduction::topk;
pub use reduction::topk;
pub use reduction::var;
pub use reduction::var_axis;
pub use reduction::var_mean;
pub use reduction::var_mean_axis;
pub use resize::resize_1d;
pub use resize::resize_1d_backward;
pub use resize::resize_1d_backward_with_scale;
pub use resize::resize_1d_with_scale;
pub use resize::resize_2d;
pub use resize::resize_2d_backward;
pub use resize::resize_2d_backward_with_scale;
pub use resize::resize_2d_with_scale;
pub use resize::ResizeMode;
pub use rotate_half::rotate_half;
pub use shape::broadcast_to;
pub use shape::cat;
pub use shape::chunk;
pub use shape::diag;
pub use shape::diagonal;
pub use shape::einsum;
pub use shape::einsum3;
pub use shape::flip;
pub use shape::gather;
pub use shape::gather;
pub use shape::index_put;
pub use shape::index_select;
pub use shape::masked_fill;
pub use shape::masked_select;
pub use shape::meshgrid;
pub use shape::nonzero;
pub use shape::one_hot;
pub use shape::pad;
pub use shape::repeat_interleave;
pub use shape::roll;
pub use shape::scatter_add;
pub use shape::sort;
pub use shape::split;
pub use shape::stack;
pub use shape::tile;
pub use shape::tril;
pub use shape::triu;
pub use shape::where_cond;
pub use sparse::coo_to_csr;
pub use sparse::coo_to_dense;
pub use sparse::csr_to_dense;
pub use sparse::dense_to_coo;
pub use sparse::dense_to_csr;
pub use sparse::spmm;
pub use sparse::spmm_backward_dense;
pub use sparse::spmm_backward_values;
pub use sparse::spmv;
pub use fuse::evaluate_fused_cpu;
pub use fuse::evaluate_fused_mean_cpu;
pub use fuse::evaluate_fused_reduce_cpu;
pub use fuse::scalar;
pub use fuse::CpuExprNode;
pub use fuse::Expr;
pub use fuse::ExprNode;
pub use fuse::TensorExprExt;
pub use attention::scaled_dot_product_attention;
pub use attention::scaled_dot_product_attention_backward;
pub use conv_transpose::conv_transpose1d;
pub use conv_transpose::conv_transpose2d;
pub use conv_transpose::conv_transpose3d;
pub use adaptive_pool::adaptive_avg_pool1d;
pub use adaptive_pool::adaptive_avg_pool2d;
pub use adaptive_pool::adaptive_max_pool1d;
pub use adaptive_pool::adaptive_max_pool2d;
pub use constructors::geomspace;
pub use constructors::linspace;
pub use constructors::logspace;
pub use unfold_fold::fold1d;
pub use unfold_fold::fold2d;
pub use unfold_fold::unfold1d;
pub use unfold_fold::unfold2d;

Modules§

adaptive_pool
Adaptive pooling operations (avg and max in 1D/2D).
attention
Scaled dot-product attention with causal and padding mask support.
backend_ops
Backend dispatch trait and CPU implementation.
binary
Element-wise binary operations (add, sub, mul, div).
constructors
Tensor constructors (linspace, logspace, geomspace).
conv_transpose
Transposed convolution operations (1-D, 2-D, and 3-D).
embedding
Embedding lookup and backward pass.
fuse
Device-neutral fused expression DAG with CPU-addressable evaluation support.
interpolation
Coordinate-grid interpolation operations. Dimension-generic coordinate-grid interpolation operations.
matmul
Matrix multiplication kernels (matmul, bmm, outer).
reduction
Reduction operations (sum, mean, max, min, norms, variance). Reduction and selection operators over one or more tensor axes.
resize
Spatial resize (nearest / bilinear / bicubic / area) forward and reverse mode. Spatial resize (nearest / bilinear / bicubic / area) with reverse mode.
rotate_half
Provider-selected half-vector rotation.
shape
Shape manipulation operations (cat, stack, reshape, flip, sort, etc.).
sparse
Sparse tensor operations (SpMM, SpMV, format conversions). Sparse tensor operations: COO/CSR format conversions and sparse BLAS routines.
unary
Element-wise unary operations (activations, math functions).
unfold_fold
Sliding-window extraction and adjoint accumulation. Sliding-window extraction and adjoint accumulation.

Enums§

Axis
Arbitrary-even-order staggered gradient/divergence pair for a Yee leapfrog. The spatial axis a gradient or divergence differentiates along.
BinaryOp
Binary element-wise operation tag.
FiniteDifference3DScheme
Generic 3-D finite-difference operator (provider-SSOT for kwavers/CFDrs/helios first-derivative kernels: central 2nd/4th/6th + Yee staggered forward/backward). Stencil family + kernel ordering for FiniteDifference3D.
ReductionOp
Reduction operation tag.
UnaryOp
CPU unary operation dispatch tag.