🌟 Summary
THOP 2.2.2 improves FLOPs estimates for models that use two-operand torch.einsum, including open-vocabulary models such as YOLO-World and YOLOE.
📊 Key Changes
- 🧮 Added profiling support for two-operand
torch.einsum, alongside the other functional matrix-product operations already counted. - ✅ Added a test for region-to-text similarity calculations, a pattern used by open-vocabulary model heads.
- 📈 At 640 input size, reported FLOPs increased from 10.456 to 11.220 GFLOPs for YOLOv8-World and from 10.074 to 10.836 GFLOPs for YOLOv8-Worldv2. These updated counts matched PyTorch’s einsum breakdown for those models.
⚠️ One-operand einsum calls and calls with more than two operands remain uncounted by this rule.
🎯 Purpose & Impact
- 🔍 Makes profiling more complete for models that calculate similarities with einsum, rather than making those operations appear to cost nothing.
- 📊 Gives users more useful FLOPs estimates for comparing model workloads. Higher reported counts reflect improved accounting—not a change in model behavior or speed.
What's Changed
- Count two-operand einsum as a functional product by @raimbekovm in #183
Full Changelog: v2.2.1...v2.2.2