kornia/kornia
Auf GitHub ansehen[Feature]: Add comprehensive test suite for NaFlex vision embedding processor
Open
#3.554 geöffnet am 4. Feb. 2026
help wantedtriage
Repository-Metriken
- Stars
- (8.677 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 19T 9h) (7 gemergte PRs in 30 T)
Beschreibung
🚀 Feature Description
Add comprehensive test coverage for the NaFlex vision embedding processor in kornia/models/processors/naflex.py, which currently has 0 test coverage despite being a core utility function.
📂 Feature Category
VLM/VLA Models (Vision Language Models/Agents) - Priority
💡 Motivation
NaFlexprocessor has 0 tests (274 lines of implementation, 0 test lines)- Core utility for vision embedding processing with flexible resolution has no verification
- No tests for image preprocessing functionality
- No gradient checks or torch.compile compatibility tests
- Users have no reference for proper processor usage
- No validation of output format for vision models
Why this is needed:
- Verify image preprocessing pipeline works correctly
- Ensure flexible resolution handling produces correct outputs
- Test processor compatibility with PyTorch features (autograd, torch.compile)
- Prevent regressions in vision embedding processing
- Provide usage examples for integrating with vision models
💭 Proposed Solution
Add comprehensive test suite covering NaFlex vision embedding processor:
Test Coverage Plan
Core functionality tests:
- ✅ Smoke tests: Basic instantiation with different configurations
- ✅ Exception tests: Invalid inputs, edge cases (invalid resolutions, wrong tensor formats)
- ✅ Cardinality tests: Output shape verification for various input resolutions
- ✅ Flexible resolution tests: Verify handling of arbitrary input sizes
- ✅ Image preprocessing: Test normalization, resizing, padding operations
- ✅ Batch consistency: Verify batch processing produces same results as individual processing
- ✅ Gradient checks: Verify backpropagation correctness using
gradcheck - ✅ Torch.compile compatibility: Test with
torch_optimizerfixture - ✅ Integration tests: Test with actual vision model pipelines
Target metrics:
- 70-90 test cases covering all scenarios
- ~230+ lines of test code (similar to implementation size)
- All tests following
BaseTesterpattern
Additional Documentation
Jupyter notebook demonstrating:
- Processor instantiation and configuration
- Image preprocessing pipeline walkthrough
- Flexible resolution handling examples
- Integration with vision-language models
- Performance benchmarks for different input sizes
- Visual demonstration of preprocessing steps
🔄 Alternatives Considered
No response
🎯 Use Cases
For developers:
- Verify processor works correctly after code changes
- Test compatibility with new PyTorch versions
- Understand preprocessing pipeline internals
For users:
- Learn how to use NaFlex processor with vision models
- Understand flexible resolution capabilities
- See practical integration examples
- Get copy-paste examples for custom pipelines
For maintainers:
- Ensure preprocessing quality
- Catch regressions in vision embedding processing
- Reduce maintenance burden from integration issues
📝 Additional Context
- Location:
kornia/models/processors/naflex.py - Use case: Vision embedding processor with flexible resolution
- Purpose: Preprocessing utility for vision models
🤝 Contribution Intent
- I plan to submit a PR to implement this feature
- I'm requesting this feature but not planning to implement it