jax_functions¶
Override machinery and jax.numpy mirroring wrappers.
jnp.reshape(custom_obj, ...) cannot be intercepted by a custom array-like object: JAX has no
override protocol, __jax_array__ is no longer honored, and pytree registration only covers
jax.jit, jax.vmap and jax.tree. This module supplies the missing piece: a
__jax_function__ hook with has_jax_function() and handle_jax_function(), plus thin
wrappers over the jax.numpy functions probly needs. Call jax_reshape(x, ...) instead of
jnp.reshape(x, ...) so custom objects get a say.
Dispatch duck-types on __jax_function__ being defined on the argument’s type, so this module
never imports probly.representation.jax_like and the import graph stays one-way.
The jax_function_dispatch() decorator selects operands by parameter name and preserves
public signatures and documentation. Operator overloads give native operands precise array
result types; arbitrary SupportsJaxFunction overrides have an object result type.
Their native implementation bodies run only after dispatch has excluded custom overrides,
which is why narrowing casts to native operand types are safe there.
Classes¶
Structural interface for custom JAX function overrides. |
Functions¶
Dispatch a call to the |
|
Check whether any of the arguments overrides the jax function protocol. |
|
Compute absolute values elementwise, mirroring |
|
Add two operands elementwise, mirroring |
|
Cast the array to a new data type, mirroring |
|
Compute a possibly weighted average, mirroring |
|
Compute bitwise AND, mirroring |
|
Compute bitwise OR, mirroring |
|
Compute bitwise exclusive OR, mirroring |
|
Join a sequence of arrays along an existing axis, mirroring |
|
Return the complex conjugate of the array, mirroring |
|
Return a copy of the array, mirroring |
|
Compute quotients and remainders, mirroring |
|
Compare operands for equality, mirroring |
|
Insert axes of length one, mirroring |
|
Floor-divide operands, mirroring |
|
Decorate a native implementation with JAX function override dispatch. |
|
Test whether the left operand is larger, mirroring |
|
Test the greater-than-or-equal relation, mirroring |
|
Invert bits elementwise, mirroring |
|
Shift bits left elementwise, mirroring |
|
Test whether the left operand is smaller, mirroring |
|
Test the less-than-or-equal relation, mirroring |
|
Multiply matrices or vectors, mirroring |
|
Transpose the last two axes of the array, mirroring |
|
Compute the arithmetic mean, mirroring |
|
Move axes of the array to new positions, mirroring |
|
Multiply operands elementwise, mirroring |
|
Negate an operand elementwise, mirroring |
|
Compare operands for inequality, mirroring |
|
Apply unary positive, mirroring |
|
Raise operands to powers elementwise, mirroring |
|
Compute floor-division remainders, mirroring |
|
Return a reshaped version of the array, mirroring |
|
Shift bits right elementwise, mirroring |
|
Remove axes of length one, mirroring |
|
Join a sequence of arrays along a new axis, mirroring |
|
Compute the standard deviation, mirroring |
|
Subtract operands elementwise, mirroring |
|
Compute the sum, mirroring |
|
Swap two axes of the array, mirroring |
|
Take values along an axis, mirroring |
|
Return a transposed version of the array, mirroring |
|
Divide operands elementwise, mirroring |
|
Compute the variance, mirroring |
|
Try function overrides without preventing Python's reflected operator fallback. |