tree_to_jax#
- t3toolbox.backend.common.tree_to_jax(T)#
def tree_to_jax(T):
Move every array leaf of a pytree (nested tuples/lists of arrays) onto jax, preserving the tree structure; leaves already jax are a no-op (
jnp.asarray). Numpyfloat64leaves become jaxfloat32unless jax x64 is enabled – the caller opts into jax precision. Requires jax – guard onjax_availableat the call site (jnpis only bound when jax is importable).