| invert_tags |
Ran ran; our contract draft was wrong, not the code |
google/lineax/lineax/_tags.py code served (permissive licence) · get_code("a48b712d0f4fd930") 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 frozenset. 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
from typing import Optional
# Define some tag classes to use as examples
class SymmetricTag:
def __repr__(self):
return "SymmetricTag"
class DiagonalTag:
def __repr__(self):
return "DiagonalTag"
class TriangularTag:
def __repr__(self):
return "TriangularTag"
class PositiveSemidefiniteTag:
def __repr__(self):
return "PositiveSemidefiniteTag"
class UnitDiagonalTag:
def __repr__(self):
return "UnitDiagonalTag"
class TridiagonalTag:
def __repr__(self):
return "TridiagonalTag"
# Define rules for inverting tags
def preserve_symmetric_rule(tags: frozenset[object]) -> Optional[object]:
"""Symmetric property is preserved under inversion."""
if any(isinstance(tag, SymmetricTag) for tag in tags):
return SymmetricTag()
return None
def preserve_diagonal_rule(tags: frozenset[object]) -> Optional[object]:
"""Diagonal property is preserved under inversion."""
if any(isinstance(tag, DiagonalTag) for tag in tags):
return DiagonalTag()
return None
def remove_tridiagonal_rule(tags: frozenset[object]) -> Optional[object]:
"""Tridiagonal is NOT preserved under inversion."""
# This rule removes tridiagonal tags, so it returns None if present
return None
def preserve_triangular_rule(tags: frozenset[object]) -> Optional[object]:
"""Triangular property is preserved under inversion."""
if any(isinstance(tag, TriangularTag) for tag in tags):
return TriangularTag()
return None
def preserve_psd_rule(tags: frozenset[object]) -> Optional[object]:
"""Positive semidefinite is preserved under inversion."""
if any(isinstance(tag, PositiveSemidefiniteTag) for tag in tags):
return PositiveSemidefiniteTag()
return None
def unit_diagonal_special_rule(tags: frozenset[object]) -> Optional[object]:
"""Unit diagonal is only preserved if also diagonal or triangular."""
has_unit_diagonal = any(isinstance(tag, UnitDiagonalTag) for tag in tags)
has_diagonal = any(isinstance(tag, DiagonalTag) for tag in tags)
has_triangular = any(isinstance(tag, TriangularTag) for tag in tags)
if has_unit_diagonal and (has_diagonal or has_triangular):
return UnitDiagonalTag()
return None
# Build the rules list
invert_tags_rules = [
preserve_symmetric_rule,
preserve_diagonal_rule,
remove_tridiagonal_rule,
preserve_triangular_rule,
preserve_psd_rule,
unit_diagonal_special_rule,
]
# Create test cases for the function
symmetric_tag = SymmetricTag()
diagonal_tag = DiagonalTag()
triangular_tag = TriangularTag()
psd_tag = PositiveSemidefiniteTag()
unit_diag_tag = UnitDiagonalTag()
tridiag_tag = TridiagonalTag()
# Test case 1: Simple symmetric matrix
tags_case1 = frozenset([symmetric_tag])
# Test case 2: Diagonal matrix
tags_case2 = frozenset([diagonal_tag])
# Test case 3: Triangular with unit diagonal (should preserve both)
tags_case3 = frozenset([triangular_tag, unit_diag_tag])
# Test case 4: Tridiagonal (should be removed)
tags_case4 = frozenset([tridiag_tag])
# Test case 5: Complex case with multiple tags
tags_case5 = frozenset([symmetric_tag, psd_tag, diagonal_tag])
# Test case 6: Unit diagonal without diagonal or triangular (should not be preserved)
tags_case6 = frozenset([unit_diag_tag])
# Use one of these as the main test case
ARGS = {
"tags": tags_case3
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type frozenset — a frozenset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a frozenset 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
|
| jacobian |
Ran ran; our contract draft was wrong, not the code |
google/lineax/lineax/_misc.py code served (permissive licence) · get_code("c30590f204af2200") 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
# Define a simple function to differentiate
def simple_fn(x):
return jnp.sum(x ** 2)
# Create test inputs as JAX arrays
test_input = jnp.array([1.0, 2.0, 3.0, 4.0])
ARGS = {
'fn': simple_fn,
'in_size': 4,
'out_size': 1,
'holomorphic': False,
'has_aux': False,
'jac': None
}
- 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
|
| resolve_rcond |
Ran ran, honoured the contract we drafted |
google/lineax/lineax/_misc.py code served (permissive licence) · get_code("809e62065ec84219") 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 float32, 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
ARGS = {
"rcond": None,
"n": 5,
"m": 3,
"dtype": jnp.float32,
}
- 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 float32, 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
|
| stop_gradient_transpose |
Ran ran, honoured the contract we drafted |
google/lineax/lineax/_solve.py code served (permissive licence) · get_code("fee475e0e7816aec") 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 torch
import torch.nn as nn
torch.manual_seed(0)
# The function stop_gradient_transpose takes two parameters: ct and x
# Looking at the function body, it simply returns (ct,) - a tuple containing ct
# It doesn't actually use x in any way, just returns ct wrapped in a tuple
# So ct and x can be any valid objects, but tensors make sense for a gradient-related function
ct = torch.randn(2, 4)
x = torch.randn(2, 4)
ARGS = {
"ct": ct,
"x": x,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — 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
|
| sum_squares |
Ran ran, honoured the contract we drafted |
google/lineax/lineax/_norm.py code served (permissive licence) · get_code("7d2a879b7a2e29c6") 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
from jaxtyping import PyTree
# Create a simple PyTree structure with some arrays
# Using distinct sizes to make dimensions unambiguous
tree_example = {
'weights': jnp.array([[1.0, 2.0, 3.0], [4.0, 5.0, 6.0]]),
'bias': jnp.array([0.5, 1.5]),
'nested': {
'param': jnp.array([[[1.0, 2.0], [3.0, 4.0]]])
}
}
ARGS = {
'x': tree_example
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxtyping — 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
|
| transpose_tags |
Ran ran; our contract draft was wrong, not the code |
google/lineax/lineax/_tags.py code served (permissive licence) · get_code("41f0f2dbf21c56ef") 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 frozenset. 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
from torch import nn
class _HasRepr:
def __init__(self, string: str):
self.string = string
def __repr__(self):
return self.string
symmetric_tag = _HasRepr('symmetric_tag')
antisymmetric_tag = _HasRepr('antisymmetric_tag')
def transpose_rule_1(tags):
if antisymmetric_tag in tags:
return frozenset(tags - {antisymmetric_tag} | {_HasRepr('transposed_antisymmetric')})
return None
def transpose_rule_2(tags):
if _HasRepr('orthogonal_tag') in tags:
return None
return None
transpose_tags_rules = [transpose_rule_1, transpose_rule_2]
def transpose_tags(tags: frozenset[object]):
if symmetric_tag in tags:
return tags
new_tags = []
for rule in transpose_tags_rules:
out = rule(tags)
if out is not None:
new_tags.append(out)
return frozenset(new_tags)
ARGS = {
'tags': frozenset([antisymmetric_tag, _HasRepr('some_other_tag')])
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type frozenset — a frozenset output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a frozenset 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
|
| tree_dot |
Ran ran, honoured the contract we drafted |
google/lineax/lineax/_norm.py code served (permissive licence) · get_code("8246f77328f21ea5") 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
from jaxtyping import Array, ArrayLike, Inexact, PyTree, Scalar
# Create two pytrees with the same structure
# Each pytree will contain nested arrays
tree1 = {
'layer1': jnp.array([[1.0, 2.0, 3.0, 4.0], [5.0, 6.0, 7.0, 8.0]]),
'layer2': jnp.array([9.0, 10.0, 11.0, 12.0]),
'nested': {
'sublayer': jnp.array([[13.0, 14.0], [15.0, 16.0]])
}
}
tree2 = {
'layer1': jnp.array([[1.0, 1.0, 1.0, 1.0], [1.0, 1.0, 1.0, 1.0]]),
'layer2': jnp.array([2.0, 2.0, 2.0, 2.0]),
'nested': {
'sublayer': jnp.array([[3.0, 3.0], [3.0, 3.0]])
}
}
ARGS = {
'tree1': tree1,
'tree2': tree2,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxtyping — 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
|
| tree_where |
Ran ran; our contract draft was wrong, not the code |
google/lineax/lineax/_misc.py code served (permissive licence) · get_code("bdb9f2ead609a1f7") 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
import jax.tree_util as jtu
from jaxtyping import Array, ArrayLike, Bool, PyTree
# Create a scalar boolean predicate
pred = jnp.array(True)
# Create two PyTrees with matching structure containing JAX arrays
true_tree = {
'a': jnp.array([1.0, 2.0, 3.0, 4.0]),
'b': {
'nested': jnp.array([[1.0, 2.0], [3.0, 4.0]])
},
'c': jnp.array(5.0)
}
false_tree = {
'a': jnp.array([5.0, 6.0, 7.0, 8.0]),
'b': {
'nested': jnp.array([[5.0, 6.0], [7.0, 8.0]])
},
'c': jnp.array(10.0)
}
ARGS = {
'pred': pred,
'true': true_tree,
'false': false_tree
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- jax, jaxtyping — 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
|
| tags_from_checks |
Not yet run unverified (harvested, no recorded run) |
google/lineax/lineax/_tags.py code served (permissive licence) · get_code("c36b199b5608ed5d") How it ran |
| two_norm |
Not yet run unverified (harvested, no recorded run) |
google/lineax/lineax/_norm.py code served (permissive licence) · get_code("b0c90a3ae8b1c1ad") How it ran |