Questions tagged [jax]
JAX allows to write auto-differentiable functions. It provides a NumPy and native Python compatible interface built on composable function transformations. Further optimization happens by automatic vectorization and running code on GPUs/TPUs.
660
questions
1
vote
1
answer
23
views
Jax jitting of kd-tree code taking an intractably long amount of time
I've written myself into a corner with the following situation:
I'm running an optimiser which requires smooth gradients to work, and I'm using Jax for automatic differentiation. Since this code is ...
1
vote
1
answer
31
views
Execution of conditional branches causing errors in Jax (kd-tree implementation)
I'm writing a kd-tree in Jax, and using custom written Node objects for the tree elements. Each Node is very simple, with a single data field (for holding numeric values) and left and right fields ...
0
votes
1
answer
94
views
Pixelwise least square in Python
I have a non-linear forward model which computes a gray scale image for a per-pixel parameter w. I am also able to invert the model using scipys optimize functions. The only problem I am having ...
1
vote
1
answer
41
views
JAX/Equinox pipeline slows down after adding an integer argument to a loss function
I have the following training pipeline in JAX and Equinox. I want to pass a batch index to the loss function in order to apply different logic depending on index. Without batch index training loop ...
1
vote
1
answer
32
views
Jax vs numpy for generating Heston paths
I have this python code (from QuantPy) which generates stock paths under the Heston model using numpy. I am trying to convert it to using Jax. For some reason, the numpy version runs in about 2 ...
2
votes
2
answers
57
views
Dictionary indexing with Numpy/Jax
I'm writing an interpolation routine and have a dictionary which stores the function values at the fitting points. Ideally, the dictionary keys would be 2D Numpy arrays of the fitting point ...
1
vote
1
answer
40
views
Taking derivatives with multiple inputs in JAX
I am trying to take first and second derivatives of functions in JAX however, my ways of doing that give me the wrong number or zeros. I have an array with two columns for each variable and two rows ...
1
vote
1
answer
51
views
weird shape when indexing a jax array
I am experiencing a weird issue when indexing a Jax array using a list.
If I place a debugger in the middle of my code, I have the following:
This array are created by convering a numpy array.
...
1
vote
1
answer
47
views
Basic Hutchinson-Skilling estimator in Jax
I'm trying to implement the Hutchinson-Skilling estimator (later used in the context of diffusion models) in Jax, but I'm having difficuly understanding why even in some very basic cases, I need so ...
1
vote
1
answer
44
views
jax bottom up processing non-perfect tree of objects
I have non-perfect, non-complete tree, which I would like to process bottom-up. I.e. level-t out put some values, which will be used in computations for level-(t+1), but level t+1 includes some fixed ...
1
vote
1
answer
42
views
Jax vmap with lax scan having different sequence length in batch dimension
I have this following code , where my sim_timestep is in batch
I am not able to run this since the lax.scan(fwd_dynamics, (xk,uk) ,jnp.arange(sim_timestep) ) requires the concrete array , but since I ...
1
vote
1
answer
42
views
Colab, Jax, and GPU: why does cell execution take 60 seconds when %%timeit says it only takes 70 ms?
As the basis for a project on fractals, I'm trying to use GPU computation on Google Colab using the Jax library.
I'm using Mandelbrot on all accelerators as a model, and I'm encountering a problem.
...
1
vote
1
answer
61
views
jax.lax.cond executing both branches instead of just the True branch
I'm encountering an AttributeError: 'NoneType' object has no attribute in my Python code using JAX's jax.lax.cond. Here's a simplified version of what I'm trying to do:
from typing import NamedTuple, ...
1
vote
1
answer
55
views
Implementing a vectorized function over LinkedLists using Jax’s vmap function
Trying to implement a vectorized version of an algorithm (from computational geometry) using Jax. I have made the minimum working example using a LinkedList to particularly express my query (I am ...
0
votes
0
answers
18
views
Print Output Value of Neural Network in Flax
I use Flax to solve a neural differential equation i.e. part of my PDE is represented by a NN. Doesn't really matter, just for context. Assume we have a neural network like this
import flax.linen as ...