Relative Content

Tag Archive for pythonjax

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 many gaussian samples to have an accurate estimator.

constant-memory vectorized sum of function values with jax

Let’s say I have a function f that takes an integer argument and returns a fixed-size array. I want to evaluate the sum of f(i) over range(N) for some large N, such that storing all values in memory becomes problematic. With a simple for loop I can fix this easily and evaluate the sum with constant memory use:

deque-like data structure in JAX

I am trying to create a data structure that has a fixed length, appends to the right and pops from the left in JAX, similar to a deque.

Multiplying chains of matrices in JAX

Suppose I have a vector of parameters p which parameterizes a set of matrices A_1(p), A_2(p),...,A_N(p). I have a computation in which for some list of indices q, I have to compute A_{q_M} * ... * A_{q_2} * A_{q_1} * v for several different q s. Each q has a different length, but crucially doesn’t change! What changes, and what I wish to take gradients against is p.