| armijo_line_search |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/armijo_sgd.py code served (permissive licence) · get_code("e9cbb4350bfa47bf") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax
import jax.numpy as jnp
from jaxopt.tree_util import tree_add_scalar_mul, tree_l2_norm
from jaxopt._src import loop
import jax.lax as lax
# Define a simple function with auxiliary output
def simple_fun_with_aux(params, *args, **kwargs):
"""Simple quadratic function for testing."""
# params is a pytree (dict of arrays)
loss = jnp.sum(params['w'] ** 2)
aux = jnp.array(0.0)
return loss, aux
# Setup initial parameters
params = {
'w': jnp.array([1.0, 2.0, 3.0, 4.0])
}
# Compute gradient manually (gradient of sum(w^2) is 2*w)
grad = {
'w': 2.0 * params['w']
}
# Compute current loss
f_cur = jnp.sum(params['w'] ** 2)
# Initial stepsize
stepsize = jnp.array(0.1)
# Coefficients and factors
coef = jnp.array(0.1) # 1 - aggressiveness
decrease_factor = jnp.array(0.5)
increase_factor = jnp.array(1.5)
max_stepsize = jnp.array(1.0)
# Line search parameters
maxls = 10
unroll = "auto"
jit = False
goldstein = False
# Additional args and kwargs for fun_with_aux
args = ()
kwargs = {}
ARGS = {
'fun_with_aux': simple_fun_with_aux,
'unroll': unroll,
'jit': jit,
'goldstein': goldstein,
'maxls': maxls,
'params': params,
'f_cur': f_cur,
'stepsize': stepsize,
'grad': grad,
'coef': coef,
'decrease_factor': decrease_factor,
'increase_factor': increase_factor,
'max_stepsize': max_stepsize,
'args': args,
'kwargs': kwargs,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxopt — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 1, dtype family float — a tuple output has no array shape of its own; none is stated
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| curvature_cond_violated |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/armijo_sgd.py code served (permissive licence) · get_code("38807fc2275c4d77") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import numpy as np
torch.manual_seed(0)
# Analyzing the function:
# def curvature_cond_violated(stepsize, coef, f_cur, f_next, grad_sqnorm):
# return f_next < f_cur - stepsize * (1.0 - coef) * grad_sqnorm
#
# All parameters are numeric scalars used in arithmetic operations.
# The function returns a boolean result from a comparison.
stepsize = 0.01
coef = 0.5
f_cur = 1.5
f_next = 1.0
grad_sqnorm = 0.1
ARGS = {
"stepsize": stepsize,
"coef": coef,
"f_cur": f_cur,
"f_next": f_next,
"grad_sqnorm": grad_sqnorm,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| fori_loop_body_fun |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/cd_qp.py code served (permissive licence) · get_code("dc113831e42e2e7b") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
import jax
# Construct small test tensors for the function
n = 4 # dimension
# x: current iterate (vector of size n)
x = jnp.array([1.0, 2.0, 3.0, 4.0])
# Q: quadratic matrix (n x n)
Q = jnp.array([
[2.0, 0.5, 0.1, 0.2],
[0.5, 3.0, 0.3, 0.1],
[0.1, 0.3, 1.5, 0.4],
[0.2, 0.1, 0.4, 2.5]
])
# c: linear term (vector of size n)
c = jnp.array([0.1, -0.2, 0.3, -0.1])
# l: lower bounds (vector of size n)
l = jnp.array([0.0, 0.0, 0.0, 0.0])
# u: upper bounds (vector of size n)
u = jnp.array([10.0, 10.0, 10.0, 10.0])
# error: accumulator scalar
error = jnp.array(0.0)
# i: loop index (this would normally come from jax.lax.fori_loop)
i = 0
# Construct the tuple argument
tup = (x, Q, c, l, u, error)
ARGS = {
"i": i,
"tup": tup
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple — a tuple output has no array shape of its own; none is stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| inv_jacobian_product |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/broyden.py code served (permissive licence) · get_code("5800e882d4fe024f") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
from functools import partial
from jaxopt.tree_util import tree_map
# Create small test arrays for the pytree and histories
history_size = 3
leaf_shape = (4,)
# Create a simple pytree - a dict with some arrays
pytree = {
'weights': jnp.ones((4,)),
'bias': jnp.ones((2,))
}
# Create d_history - pytree with same structure, leaves have shape (history_size, ...)
d_history = {
'weights': jnp.ones((history_size, 4)),
'bias': jnp.ones((history_size, 2))
}
# Create c_history - pytree with same structure, leaves have shape (history_size, ...)
c_history = {
'weights': jnp.ones((history_size, 4)) * 0.5,
'bias': jnp.ones((history_size, 2)) * 0.5
}
gamma = 1.0
start = 0
ARGS = {
'pytree': pytree,
'd_history': d_history,
'c_history': c_history,
'gamma': gamma,
'start': start
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxopt — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| inv_jacobian_product_leaf |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/broyden.py code served (permissive licence) · get_code("20124fe32bb0401b") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 1, dtype family float, shape (4,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
import numpy as np
# Create small tensors for testing
batch_size = 2
dim = 4
history_size = 3
# v: a vector of shape (dim,)
v = jnp.array([1.0, 2.0, 3.0, 4.0])
# d_history: shape (history_size, dim)
d_history = jnp.array([
[0.1, 0.2, 0.3, 0.4],
[0.5, 0.6, 0.7, 0.8],
[0.9, 1.0, 1.1, 1.2]
])
# c_history: shape (history_size, dim)
c_history = jnp.array([
[1.1, 1.2, 1.3, 1.4],
[1.5, 1.6, 1.7, 1.8],
[1.9, 2.0, 2.1, 2.2]
])
# gamma: a float scalar
gamma = 1.0
# start: an integer
start = 0
ARGS = {
"v": v,
"d_history": d_history,
"c_history": c_history,
"gamma": gamma,
"start": start
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 1, dtype family float, shape (4,) — shape (4,) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| matvec |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/broyden.py code served (permissive licence) · get_code("415c82f2e99d1db3") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
import numpy as np
# Construct arguments for matvec function
# The function performs:
# 1. dtx = jnp.einsum('j..., ... -> j', d_history[indices], x)
# - d_history[indices] has shape (j, ...) where ... matches x's shape
# - x has shape (...)
# - result dtx has shape (j,)
# 2. cdtx = jnp.einsum('j..., j -> ...', c_history[indices], dtx)
# - c_history[indices] has shape (j, ...)
# - dtx has shape (j,)
# - result cdtx has shape (...)
# Define dimensions
batch_size = 2 # number of history entries
vector_dim = 4 # dimension of vectors
num_indices = 3 # number of indices to select
output_dim = 5 # extra dimension for c_history and d_history
# Create d_history: shape (batch_size, output_dim)
d_history = jnp.ones((batch_size, output_dim))
# Create c_history: shape (batch_size, output_dim)
c_history = jnp.ones((batch_size, output_dim))
# Create x: shape (output_dim,)
x = jnp.ones((output_dim,))
# Create indices: shape (num_indices,) with valid indices into batch_size
indices = jnp.array([0, 1, 0])
ARGS = {
'd_history': d_history,
'c_history': c_history,
'x': x,
'indices': indices
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| minimize_residuals |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/anderson.py code served (permissive licence) · get_code("449e64595fa2035f") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 1, dtype family float, shape (5,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
import numpy as np
# Create a small positive definite matrix for residual_gram
# Shape: (m, m) where m=4
m = 4
residual_gram_np = np.array([
[2.0, 0.5, 0.2, 0.1],
[0.5, 2.0, 0.3, 0.15],
[0.2, 0.3, 2.0, 0.25],
[0.1, 0.15, 0.25, 2.0]
], dtype=np.float32)
residual_gram = jnp.array(residual_gram_np)
# Ridge parameter for regularization
ridge = 0.01
ARGS = {
"residual_gram": residual_gram,
"ridge": ridge,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 1, dtype family float, shape (5,) — shape (5,) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| pytree_replace_elem |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/anderson.py code served (permissive licence) · get_code("db766bbeba988263") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import torch
import numpy as np
from jaxopt._src.tree_util import tree_map
torch.manual_seed(0)
# Construct tree_batched: a pytree of JAX arrays with batch dimension
# The function uses .at[index].set(elem) which is JAX array syntax
# We need to use jax arrays, not torch tensors
import jax.numpy as jnp
# Create a pytree with batch_size=2
# Each leaf should be a JAX array of shape (batch_size, ...)
tree_batched = {
'a': jnp.array([[1.0, 2.0, 3.0, 4.0],
[5.0, 6.0, 7.0, 8.0]]),
'b': jnp.array([[10.0, 20.0],
[30.0, 40.0]]),
'nested': {
'c': jnp.array([[100.0, 200.0, 300.0],
[400.0, 500.0, 600.0]])
}
}
# Index to replace
index = 0
# new_elems: a pytree with same structure as tree_batched but WITHOUT batch dimension
new_elems = {
'a': jnp.array([99.0, 99.0, 99.0, 99.0]),
'b': jnp.array([99.0, 99.0]),
'nested': {
'c': jnp.array([99.0, 99.0, 99.0])
}
}
ARGS = {
'tree_batched': tree_batched,
'index': index,
'new_elems': new_elems
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxopt, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| pytree_to_flat_array |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/bfgs.py code served (permissive licence) · get_code("ec80ac21c72aa6e7") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 1, dtype family float, shape (11,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax
import jax.numpy as jnp
# Create a pytree with various nested structures
pytree = {
'a': jnp.array([1.0, 2.0, 3.0]),
'b': {
'c': jnp.array([[4.0, 5.0], [6.0, 7.0]]),
'd': jnp.array([8.0])
},
'e': [jnp.array([9.0, 10.0]), jnp.array([11.0])]
}
ARGS = {
'pytree': pytree,
'dtype': jnp.float32
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 1, dtype family float, shape (11,) — shape (11,) as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| wolfe_cond_violated |
Ran ran on a synthesized input |
google/jaxopt/jaxopt/_src/armijo_sgd.py code served (permissive licence) · get_code("c8bccea39b14d8db") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ArrayImpl, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.
import jax.numpy as jnp
import numpy as np
# Construct valid arguments for wolfe_cond_violated
stepsize = 0.01
coef = 0.5
f_cur = jnp.array(1.5, dtype=jnp.float32)
f_next = jnp.array(1.2, dtype=jnp.float32)
grad_sqnorm = jnp.array(0.8, dtype=jnp.float32)
ARGS = {
"stepsize": stepsize,
"coef": coef,
"f_cur": f_cur,
"f_next": f_next,
"grad_sqnorm": grad_sqnorm,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 0, dtype family float, shape () — shape () as a later run recorded it
- dtype family
- int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
- Environment
- image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
|
| anderson_step |
Not yet run unverified (harvested, no recorded run) |
google/jaxopt/jaxopt/_src/anderson.py code served (permissive licence) · get_code("c5da06ff653c0c3c") How it ran |
| cond |
Not yet run unverified (harvested, no recorded run) |
google/jaxopt/jaxopt/_src/cond.py code served (permissive licence) · get_code("f5b8220535f8bb31") How it ran |