jax
jax copied to clipboard
Make PyTreeDef jittable
In working with Bayesian Neural Networks, I sample a d-dimensional vector, which is then unflattened into a PyTree using PyTreeDef argument that can be used with i.e the stax library.
Because this functionality is often part of the loss function and calculating the gradient, it would speed up the training process if one can jit the entire loss function. This is currently not possible because PyTreeDef is not a valid JAX type.
Request
Make function arguments of type jaxlib.xla_extension.PyTreeDef jittable such that unflattening PyTrees can be sped up and part of jitted functions.