Skip to main content

Crate ruxla_transforms

Crate ruxla_transforms 

Source
Expand description

Transformations of the IR: vmap, jvp, partial evaluation, transposition, vjp, and grad.

vmap batches a function with each primitive’s batching rule. jvp differentiates in forward mode with each primitive’s JVP rule; vjp linearizes (jvp and partial_eval) and transposes the linear part, as JAX does; value_and_grad builds a gradient function.

Structs§

PartialEval
The two parts of a function split by partial_eval.
Vjp
The two halves of reverse-mode differentiation, from vjp.

Functions§

jvp
Differentiates f in forward mode.
partial_eval
Splits f into the computation of what depends only on the inputs marked known, and the rest, as JAX’s partial evaluation does. Outputs marked instantiate are made unknown (passed through as residuals if they are known). Equations whose inputs are all known are known.
transpose
Transposes f, which must be linear in the inputs marked linear.
value_and_grad
A function that returns the outputs of f and the gradient of its first output (a float scalar, the loss) with respect to the inputs marked wrt: value_and_grad. The other outputs are auxiliary values, as with JAX’s has_aux, and are not differentiated.
vjp
Linearizes f and transposes it: reverse-mode differentiation with respect to the inputs marked wrt (which must be floats).
vmap
Batches f over a batch of axis_size examples.
vmap_with_out_axes
vmap with the batch dimension of each output: Some(d) puts it at dimension d (broadcasting outputs that do not depend on the batched inputs), and None requires the output to be the same for every example.