| blackbox_mcmc |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/mcmc/utils.py code served (permissive licence) · get_code("fc0e06b443e799f7") 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 2, dtype family float, shape (2, 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
import jax.numpy as jnp
import time
# Define a minimal sampler class that implements the required interface
class MinimalSampler:
def __init__(self, key, step_size=0.1):
self.key = key
self.step_size = step_size
def init(self, x0):
# Returns (sampler_state, sampler_keys)
state = {'x': x0, 'step': 0}
keys = jax.random.split(self.key, x0.shape[0] + 1)
return state, keys
def get_params(self, state):
return state['x']
def propose(self, i, dx, state, keys, is_final=False):
# Propose new parameters using gradient
x = state['x']
key = keys[0]
noise = jax.random.normal(key, x.shape) * 0.01
x_new = x + self.step_size * dx + noise
new_state = {'x': x_new, 'step': state['step'] + 1}
new_keys = jax.random.split(keys[1], len(keys))
return new_state, new_keys
def accept(self, i, fx, fx_prop, dx, state, dx_prop, prop_state, keys):
# Accept/reject based on log probability ratio
batch_size = fx.shape[0]
log_ratio = fx_prop - fx
key = keys[0]
log_u = jnp.log(jax.random.uniform(key, (batch_size,)))
accept_idxs = log_ratio > log_u
new_keys = jax.random.split(keys[1], len(keys))
return accept_idxs, new_keys
def update(self, i, accept_idxs, dx, state, dx_old, prop_state, keys):
# Update state based on acceptance
x = state['x']
x_prop = prop_state['x']
# Select accepted proposals
x_new = jnp.where(accept_idxs[:, None], x_prop, x)
new_state = {'x': x_new, 'step': state['step'] + 1}
new_keys = jax.random.split(keys[1], len(keys))
return new_state, new_keys
def sampler_decorator(fn):
"""Decorator that marks a sampler function"""
return fn
@sampler_decorator
def create_sampler(key, step_size=0.1):
"""Factory function that creates a sampler"""
return MinimalSampler(key, step_size=step_size)
# Define a simple log probability function
def logprob_fn(x):
# Negative quadratic (Gaussian target)
return -jnp.sum(x**2, axis=-1)
# Create initial samples (batch_size=2, dim=4)
x0 = jnp.zeros((2, 4))
ARGS = {
'logprob': logprob_fn,
'x0': x0,
'sampler_fn': create_sampler,
'num_iters': 5,
'proposal_iters': 1,
'seed': 42,
'recompute_grad': False,
'use_jit': False,
'step_size': 0.1,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ArrayImpl, ndim 2, dtype family float, shape (2, 4) — shape (2, 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
|
| certainty_acc |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/utils.py code served (permissive licence) · get_code("b3c398a4fc4597c2") 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 numpy as np
# Set seed for reproducibility
np.random.seed(0)
# Create small test data
batch_size = 2
n_classes = 4
# pp: (batch_size, n_classes) array of probabilities
# Create valid probability distributions (sum to 1 along class axis)
pp_data = np.array([
[0.1, 0.2, 0.5, 0.2],
[0.3, 0.3, 0.2, 0.2]
], dtype=np.float32)
pp = jnp.array(pp_data)
# targets: (batch_size,) array of label class indices
# The function uses targets[certain_idxs] to index, so it expects 1D array of indices
targets = jnp.array([2, 0], dtype=jnp.int32)
# cert_threshold: float minimum probability for making a prediction
cert_threshold = 0.5
ARGS = {
"pp": pp,
"targets": targets,
"cert_threshold": cert_threshold
}
- 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 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
|
| confidence_bands |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/utils.py code served (permissive licence) · get_code("9be1b2a28b82874f") 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 3, 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.numpy as jnp
# Create a sample array with shape (4, 3, 5)
# This represents 5 samples along the last axis, with shape (4, 3) for each sample
y = jnp.ones((4, 3, 5))
ARGS = {
"y": y,
"sample_axis": -1,
}
- 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, ndim 3, 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
|
| elbo_noscore |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/variational/families.py code served (permissive licence) · get_code("1eeb499267ffa147") 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
import jax.numpy as jnp
# Define a simple logprob function that takes samples and returns log probabilities
def logprob(samples):
# samples shape: (batch_size, dim)
# Return a scalar log probability for each sample
return jnp.sum(samples ** 2, axis=1)
# Define a simple variational approximation function
def var_approx(samples, var_params):
# samples shape: (batch_size, dim)
# var_params: parameters for the approximation
# Return a scalar value for each sample
weight = var_params['weight'] # shape (dim,)
return jnp.sum(samples * weight, axis=1)
# Create variational parameters
var_params = {
'weight': jnp.array([0.1, 0.2, 0.3, 0.4])
}
# Create sample data
samples = jnp.array([
[1.0, 2.0, 3.0, 4.0],
[0.5, 1.5, 2.5, 3.5]
])
ARGS = {
'logprob': logprob,
'samples': samples,
'var_approx': var_approx,
'var_params': var_params
}
- 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 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
|
| elbo_reparam |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/variational/families.py code served (permissive licence) · get_code("98764cfc3c1442a4") 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
import jax.numpy as jnp
import numpy as np
# Define a simple log probability function
def logprob(samples):
# samples shape: (batch_size, dim)
# Return log probabilities for each sample
return -jnp.sum(samples ** 2, axis=1)
# Define a variational approximation function
def var_approx(samples, var_params):
# samples shape: (batch_size, dim)
# var_params is a dict with 'scale' key
# Return log q(samples) or similar
scale = var_params['scale']
return -jnp.sum((samples ** 2) / (2 * scale ** 2), axis=1)
# Create sample data
np.random.seed(0)
samples = jnp.array(np.random.randn(2, 4), dtype=jnp.float32)
# Create variational parameters
var_params = {
'scale': jnp.array(1.0, dtype=jnp.float32)
}
ARGS = {
'logprob': logprob,
'samples': samples,
'var_approx': var_approx,
'var_params': var_params
}
- 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
|
| entropy |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/utils.py code served (permissive licence) · get_code("a9d7883e526e416c") 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 (2,) 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
import numpy as np
# The function uses @jax.vmap which means it will be vectorized over the first dimension
# So we need to pass a batch of probability distributions
# Each probability distribution should have shape (n_classes,)
# With vmap applied, the input will be (batch_size, n_classes)
# Create a batch of probability distributions
batch_size = 2
n_classes = 4
# Generate random probabilities that sum to 1 for each batch element
np.random.seed(0)
p_batch = np.random.dirichlet(np.ones(n_classes), size=batch_size).astype(np.float32)
p_batch = jnp.array(p_batch)
ARGS = {
"p": p_batch
}
- 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 (2,) — shape (2,) 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
|
| gaussian_elbo_reparam |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/variational/families.py code served (permissive licence) · get_code("aa2c4808af189ebf") 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
# Create a simple logprob function that takes samples and returns log probabilities
def logprob_fn(samples):
# samples shape: (batch_size, dim)
# Return log probabilities for each sample
return jnp.sum(samples ** 2, axis=1)
# Create samples: shape (batch_size, dim) = (2, 4)
samples = jnp.array([
[0.1, 0.2, 0.3, 0.4],
[0.5, 0.6, 0.7, 0.8]
], dtype=jnp.float32)
# Create var_params (logcov): shape (dim,) = (4,)
var_params = jnp.array([0.1, 0.2, 0.3, 0.4], dtype=jnp.float32)
ARGS = {
"logprob": logprob_fn,
"samples": samples,
"var_params": var_params
}
- 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
|
| make_mcmc_step_fn |
Ran ran; our contract draft was wrong, not the code |
jamesvuc/nonlinear-mcmc-paper/experiments/2d_exp/2d_exp.py code served (permissive licence) · get_code("e8694e16e7b7ad29") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned function. 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
torch.manual_seed(0)
class MockSampler:
def __init__(self):
self.param_dim = 4
self.batch_size = 2
def get_params(self, state):
# Extract parameters from state dict
return state['params']
def propose(self, i, dx, state, keys):
# Propose new state based on gradient
params = state['params']
prop_params = params + 0.01 * dx
prop_state = {'params': prop_params, 'step': i}
# Return new keys (could be random state)
new_keys = keys + 1
return prop_state, new_keys
def accept(self, i, fx, fx_prop, dx, state, dx_prop, prop_state, keys):
# Simple acceptance: accept if proposed value is lower
accept_idxs = (fx_prop < fx).nonzero(as_tuple=True)[0]
new_keys = keys + 1
return accept_idxs, new_keys
def update(self, i, accept_idxs, dx, state, dx_prop, prop_state, keys):
# Update state based on accepted proposals
params = state['params'].clone()
prop_params = prop_state['params']
# Update accepted indices
if len(accept_idxs) > 0:
params[accept_idxs] = prop_params[accept_idxs]
new_state = {'params': params, 'step': i}
new_keys = keys + 1
return new_state, new_keys
def mock_val_and_grad_fn(x):
# x has shape (batch_size, param_dim)
# Return scalar value per batch element and gradient
fx = (x ** 2).sum(dim=1) # shape (batch_size,)
dx = 2 * x # shape (batch_size, param_dim)
return fx, dx
sampler = MockSampler()
ARGS = {
'sampler': sampler,
'val_and_grad_fn': mock_val_and_grad_fn
}
- Setup block drafted by
- a language model, Claude Sonnet 4.5, prompt python_fixture_v1
- Imports
- numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| make_mcmc_step_fn |
Ran ran; our contract draft was wrong, not the code |
jamesvuc/nonlinear-mcmc-paper/experiments/cifar10/cifar10_nonlin_resnet_mcmc.py code served (permissive licence) · get_code("aae7b12cdd6c24f8") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned function. 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
import jax.numpy as jnp
import numpy as np
# Set random seed for reproducibility
np.random.seed(0)
# Create a simple sampler class with required methods
class SimpleSampler:
def __init__(self, num_chains=2, param_dim=4):
self.num_chains = num_chains
self.param_dim = param_dim
def get_params(self, sampler_state):
# Return parameters from sampler state
return sampler_state['params']
def propose(self, i, dx, sampler_state, keys):
# Propose new state based on gradients
params = sampler_state['params']
step_size = 0.01
# Simple proposal: params + step_size * dx
new_params = params + step_size * dx
sampler_prop_state = {'params': new_params}
# Split keys for next use
new_keys = jax.random.split(keys[0], self.num_chains)
return sampler_prop_state, new_keys
def accept(self, i, fx, fx_prop, dx, sampler_state, dx_prop, sampler_prop_state, keys):
# Accept all proposals (simplified)
accept_idxs = jnp.ones(self.num_chains, dtype=bool)
# Split keys for next use
new_keys = jax.random.split(keys[0], self.num_chains)
return accept_idxs, new_keys
def update(self, i, accept_idxs, dx, sampler_state, dx_prop, sampler_prop_state, keys):
# Update sampler state based on acceptance
params = sampler_state['params']
prop_params = sampler_prop_state['params']
# Update params where accepted
new_params = jnp.where(accept_idxs[:, None], prop_params, params)
new_sampler_state = {'params': new_params}
# Split keys for next use
new_keys = jax.random.split(keys[0], self.num_chains)
return new_sampler_state, new_keys
# Create a simple logprob function
def simple_logprob(params, hk_state, batch):
# params: (param_dim,) array
# hk_state: some state (can be dict or array)
# batch: data batch
x, y = batch
# Simple log probability: -||params - y||^2
logp = -jnp.sum((params - y) ** 2)
# Return (value, aux_state) tuple
new_hk_state = hk_state # Keep state unchanged for simplicity
return logp, new_hk_state
# Create sampler instance
sampler = SimpleSampler(num_chains=2, param_dim=4)
# Create logprob function
logprob = simple_logprob
ARGS = {
'sampler': sampler,
'logprob': logprob
}
- Setup block drafted by
- a language model, Claude Sonnet 4.5, prompt python_fixture_v1
- Imports
- jax, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| match_dims |
Ran ran; our contract draft was wrong, not the code |
jamesvuc/nonlinear-mcmc-paper/src/nonlin_mcmc_fns.py code served (permissive licence) · get_code("ab1303f5e2e4c45b") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned ArrayImpl, ndim 4, dtype family float, shape (3, 1, 1, 1) 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 source array with 1 dimension (shape: (3,))
src = jnp.array([1.0, 2.0, 3.0])
# Create a target array with 4 dimensions (shape: (2, 4, 5, 6))
target = jnp.ones((2, 4, 5, 6))
# start_dim specifies where to start adding dimensions
start_dim = 1
ARGS = {
'src': src,
'target': target,
'start_dim': start_dim
}
- Setup block drafted by
- a language model, Claude Sonnet 4.5, prompt python_fixture_v1
- 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 4, dtype family float, shape (3, 1, 1, 1) — shape (3, 1, 1, 1) 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
|
| sampler |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/mcmc/sampler.py code served (permissive licence) · get_code("604a74bdfc9c0ab6") 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 function. 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
import jax.numpy as jnp
from collections import namedtuple
import functools
def simple_sampler_builder(step_size=0.01):
"""
A simple sampler builder that returns the required tuple of functions.
This will be passed to the sampler decorator.
"""
def init(x0, key):
"""Initialize sampler state for a single array."""
return jnp.array([0.0, 0.0]), key
def propose(i, grad, state, key, **kwargs):
"""Propose a new state given gradient."""
new_key, subkey = jax.random.split(key)
noise = jax.random.normal(subkey, shape=grad.shape) * step_size
new_state = state + noise
return new_state, new_key
def log_proposal(i, grad, state, grad_prop, state_prop):
"""Log probability of proposal (symmetric random walk)."""
diff = state_prop - state
return -jnp.sum(diff ** 2) / (2 * step_size ** 2)
def update(i, accept_idxs, grad, samp_state, grad_prop, prop_samp_state, samp_keys):
"""Update state based on acceptance."""
return jnp.where(accept_idxs[:, None], prop_samp_state, samp_state)
def get_params(state):
"""Extract parameters from state."""
return state
init_key = jax.random.PRNGKey(0)
return init, propose, log_proposal, update, get_params, init_key
def dummy_sampler_builder():
"""Minimal sampler builder for testing."""
def init(x0, key):
return jnp.zeros(2), key
def propose(i, grad, state, key, **kwargs):
return state, key
def log_proposal(i, g1, s1, g2, s2):
return 0.0
def update(i, accept_idxs, grad, samp_state, grad_prop, prop_samp_state, samp_keys):
return samp_state
def get_params(state):
return state
return init, propose, log_proposal, update, get_params, jax.random.PRNGKey(0)
ARGS = {
'sampler_builder': dummy_sampler_builder
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| variational_family |
Ran ran on a synthesized input |
jamesvuc/jax-bayes/jax_bayes/variational/variational_family.py code served (permissive licence) · get_code("8651ebfa0d0e45f2") 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 function. 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
import jax.numpy as jnp
from collections import namedtuple
# Define SamplerKeys and SamplerState which are used in the code
SamplerKeys = namedtuple('SamplerKeys', ['keys'])
SamplerState = namedtuple('SamplerState', ['samples_flat', 'tree', 'subtrees'])
def simple_var_maker():
"""
Returns a tuple of (init, sample, evaluate, get_samples, next_key, entropy, init_key)
functions that work with single ndarrays.
"""
init_key = jax.random.PRNGKey(0)
def init(x0, key):
"""Initialize variational parameters from an array"""
# Returns (params, new_key) where params is a pytree
params = {'mean': jnp.zeros_like(x0), 'log_std': jnp.zeros_like(x0)}
return params, key
def sample(i, num_samples, key, params):
"""Sample from the variational distribution"""
# Returns (samples, new_key)
mean = params['mean']
samples = jnp.tile(mean[None, :], (num_samples, 1))
return samples, key
def evaluate(x, params):
"""Evaluate log probability under the variational distribution"""
# Returns a scalar log probability
return jnp.sum(params['mean'])
def get_samples(state):
"""Extract samples from state"""
return state
def next_key(key):
"""Generate next random key"""
return jax.random.fold_in(key, 0)
def entropy(params):
"""Compute entropy of the variational distribution"""
return jnp.sum(params['log_std'])
return (init, sample, evaluate, get_samples, next_key, entropy, init_key)
# Create the decorator and apply it to our var_maker
var_maker = simple_var_maker
ARGS = {
'var_maker': var_maker
}
- 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 function — a function output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a function 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
|
| net_fn |
Not yet run unverified (harvested, no recorded run) |
jamesvuc/nonlinear-mcmc-paper/experiments/cifar10/cifar10_nonlin_resnet_mcmc.py code served (permissive licence) · get_code("e660765e7624712b") How it ran |
| sum_tree_leaves |
Not yet run unverified (harvested, no recorded run) |
jamesvuc/jax-bayes/jax_bayes/mcmc/sampler.py code served (permissive licence) · get_code("6071ff452d8fb046") How it ran |