You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refactor sparse optimization code following DRY and single responsibility principles
- Split pack_bitmasks into modular functions with single responsibilities:
- _validate_bitmask_shape(): Input validation
- _pack_bits_torch(): Core PyTorch packing logic
- _pack_bits_numpy_fallback(): NumPy fallback
- Refactored get_24_bytemasks with helper functions:
- _validate_24_sparsity_tensor(): Tensor validation
- _get_topk_mask(): Isolated mask generation algorithm
- Improved error messages with actual tensor dimensions
- Reduced test suite from 222 to 182 lines by removing redundancy
- Organized tests into focused classes by functionality
- All optimizations preserved, code is now more maintainable
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
0 commit comments