Skip to content

Add test suite for batch-invariant operations#16

Open
Jah-yee wants to merge 3 commits into
thinking-machines-lab:mainfrom
Jah-yee:test-suite
Open

Add test suite for batch-invariant operations#16
Jah-yee wants to merge 3 commits into
thinking-machines-lab:mainfrom
Jah-yee:test-suite

Conversation

@Jah-yee
Copy link
Copy Markdown

@Jah-yee Jah-yee commented Apr 15, 2026

Summary

This PR adds a comprehensive test suite to verify the batch-invariant operations work correctly.

Tests Added

The test suite covers mm, addmm, log_softmax, and mean operations.

All tests verify the batch-invariant property: op(x[:1], y) == op(x, y)[:1]

RoomWithOutRoof and others added 3 commits April 15, 2026 20:22
Handle edge case when reduction dimension size is 0 to avoid
division by zero leading to NaN values. This fix adds explicit
checks in both mean_kernel (Triton kernel) and mean_dim
(Python wrapper) to properly handle empty tensors.
…ibility

The flatten parameter was removed in Triton 3.x public release.
This changes tl.range(..., flatten=True) to Python's built-in range(),
which works inside @triton.jit functions and is compatible with all versions.

Fixes: TypeError: range.__init__() got an unexpected keyword argument 'flatten'
- Add pytest tests for mm, addmm, log_softmax, mean operations
- Test batch-invariant property: op(x[:1], y) == op(x, y)[:1]
- Include tests for multiple dtypes (float32, float16, bfloat16)
- Add tests for batch invariant mode context manager
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant