Unverified Commit 5f317530 authored by ihb2032's avatar ihb2032 Committed by GitHub
Browse files

fix(tests): Resolve late binding of loop variable in assert message lambda (#26249)


Signed-off-by: default avatarlyd1992 <liuyudong@iscas.ac.cn>
Signed-off-by: ihb2032 <1355790728@qq.com
parent 557b2e96
...@@ -562,15 +562,15 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens): ...@@ -562,15 +562,15 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens):
Y_ref_seq[: chunked_seqlens[i], ...], Y_ref_seq[: chunked_seqlens[i], ...],
atol=atol, atol=atol,
rtol=rtol, rtol=rtol,
msg=lambda x: f"seq{i} output part1 " + x, msg=lambda x, i=i: f"seq{i} output part1 " + x,
) # noqa: B023 )
torch.testing.assert_close( torch.testing.assert_close(
Y_seq[chunked_seqlens[i] :, ...], Y_seq[chunked_seqlens[i] :, ...],
Y_ref_seq[chunked_seqlens[i] :, ...], Y_ref_seq[chunked_seqlens[i] :, ...],
atol=atol, atol=atol,
rtol=rtol, rtol=rtol,
msg=lambda x: f"seq{i} output part2 " + x, msg=lambda x, i=i: f"seq{i} output part2 " + x,
) # noqa: B023 )
state_seq = state_chunked[i] state_seq = state_chunked[i]
state_seq_ref = state_ref[i] state_seq_ref = state_ref[i]
...@@ -579,5 +579,5 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens): ...@@ -579,5 +579,5 @@ def test_mamba_chunk_scan_cont_batch_prefill_chunking(chunk_size, seqlens):
state_seq_ref, state_seq_ref,
atol=atol, atol=atol,
rtol=rtol, rtol=rtol,
msg=lambda x: f"seq{i} state " + x, msg=lambda x, i=i: f"seq{i} state " + x,
) # noqa: B023 )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment