Skip to content

Commit 17da9b9

Browse files
maedocCopilot
andauthored
fix: conditional type preservation in vcc test
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a316308 commit 17da9b9

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

vbjax/tests/test_crosscoder.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -456,14 +456,13 @@ def test_encode_all():
456456

457457
def test_add_view_preserves_dtype():
458458
"""add_view should not force-cast to float32."""
459-
import jax
460-
jax.config.update('jax_enable_x64', True)
461-
462-
triu = np.random.randn(20, 28).astype(np.float64)
463-
cc = vb.CrossCoder(variational=False)
464-
cc.add_view(triu, 'SC', normalize='center')
465-
assert cc.conns[0].dtype == np.float64
466-
459+
if jax.config.jax_enable_x64:
460+
triu = np.random.randn(20, 28).astype(np.float64)
461+
cc = vb.CrossCoder(variational=False)
462+
cc.add_view(triu, 'SC', normalize='center')
463+
assert cc.conns[0].dtype == np.float64
464+
else:
465+
pytest.skip("float64 dtype preservation requires JAX x64 to be enabled in the test environment")
467466
triu32 = np.random.randn(20, 28).astype(np.float32)
468467
cc2 = vb.CrossCoder(variational=False)
469468
cc2.add_view(triu32, 'SC', normalize='center')

0 commit comments

Comments
 (0)