Operations#
Each operation returns a Result: the exact answer
rounded once, and the bounds that say which outputs a correct implementation
can produce. They are available at the top level, such as er.matmul, and
under their category, which this page follows.
Linear algebra: er.linalg#
matmul (
linalg.products.matmul): the matrix product, with NumPy batching.gemm (
linalg.products.gemm):beta * C + alpha * (A @ B), as inaddmm,addmv,addr, andbaddbmm.matrix_exp and matrix_exp_frechet (
linalg.matrix_function): the matrix exponential and its derivative.
Arithmetic: er.arithmetic#
add, subtract, and multiply (
arithmetic.basic): elementwisex + alpha * y,x - alpha * y, andx * y, with broadcasting.divide and reciprocal (
arithmetic.basic): elementwisex / yand1 / x, with broadcasting.
Elementary functions: er.elementary#
sqrt and rsqrt (
elementary.power): the square root and its reciprocal.exp, expm1, log, and log1p (
elementary.exp_log): the exponential and the logarithm, and their forms that stay accurate next to zero.tanh (
elementary.hyperbolic): the hyperbolic tangent.sigmoid (
elementary.logistic): the logistic function.
Reductions: er.reduction#
Scans: er.scan#
cumulative_sum (
scan.cumulative): the running sum along an axis.
Statistics: er.statistics#
Neural networks: er.nn#
scaled_dot_product_attention (
nn.attention.scaled_dot_product_attention): attention, as in PyTorch.convolution (
nn.conv): convolutions in one, two, or three dimensions, and their transposed forms.softmax and log_softmax (
nn.softmax): a row of scores as weights that sum to 1, and their logarithms.rms_norm, layer_norm, and batch_norm (
nn.normalization): activations rescaled by their own statistics.
Fourier transforms: er.fft#
fft, ifft, rfft, irfft, hfft, and ihfft (
fft.dft): the Fourier transforms, over one axis or several, astorch.ffthas them.
Arrays: er.array#
scatter_add (
array.indexing.scatter): values added into the positions an index names.
Foundations: er.foundations#
convert_float_format (
foundations.conversion): a tensor in another floating-point format.
Every operation but matrix_exp_frechet has a .backward, documented on its
page.
Named algorithms, specific ways of computing these operations with their own
bounds, such as a fixed order of additions or a tensor core's steps, are in
Algorithms.