Skip to main content

Module elementwise

Module elementwise 

Source
Expand description

Generic elementwise kernels (binary, binary-scalar, unary, comparison, in-place accumulate). Ported from luma-core’s arith.rs, generalized over the CpuNum element trait and returning plain Vecs.

Functions§

binary
out[i] = f(lhs[i], rhs[i]) over two (possibly non-contiguous) views of the same logical shape. Mirrors luma-core compute_binary_op.
binary_
In-place dst = f(dst, src) respecting both layouts. Mirrors luma-core binary_inplace_op; used by the backward pass to accumulate gradients.
binary_scalar
out[i] = f(lhs[i], scalar).
binary_scalar_
In-place dst[i] = f(dst[i], rhs).
cmp_scalar
Out-of-place comparison against scalar: out[i] = f(lhs[i], rhs).
float_unary
Dispatch a float unary op over one view.
num_binary
Dispatch a numeric binary op over two views.
num_binary_fn
num_binary_scalar
Dispatch a numeric binary-scalar op over one view.
num_cmp
Dispatch a comparison op over two views, producing a bool buffer.
num_scalar_binary
Dispatch a numeric scalar-binary op (scalar OP element) over one view.
scalar_binary
out[i] = f(scalar, rhs[i]).
unary
out[i] = f(x[i]).
unary_
In-place dst[i] = f(dst[i]).