Skip to content

v2.2.2 - Count two-operand einsum as a functional product (#183)

Latest

Choose a tag to compare

@github-actions github-actions released this 01 Oct 09:34
cb49ed7

🌟 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

Full Changelog: v2.2.1...v2.2.2