Skip to content

Incorrect shape assertion in test_decode_prefixes_device_handling #23

@samuelstevens

Description

@samuelstevens

Bug Description

The test test_decode_prefixes_device_handling in tests/test_nn_objectives.py has an incorrect shape assertion on line 491.

Current Code

f_x = torch.randn(2, 32).cuda()
prefixes = torch.tensor([8, 16, 32])
x_hats = sae.decode(f_x, prefixes=prefixes)
assert x_hats.shape == (3, 2, 16)  # BUG: Wrong shape!

Expected Behavior

The decode method returns tensors with shape (batch, n_prefixes, d_model). Given:

  • batch_size = 2
  • n_prefixes = 3
  • d_model = 16

The correct shape should be (2, 3, 16) not (3, 2, 16).

Impact

This test is currently skipped on systems without CUDA, so the bug hasn't been caught by CI. However, on CUDA-enabled systems, this test would fail.

Fix

Change line 491 from:

assert x_hats.shape == (3, 2, 16)

to:

assert x_hats.shape == (2, 3, 16)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions