Skip to content

v2.1.4 - Count nn.Bilinear instead of charging it nothing (#158)

Choose a tag to compare

@github-actions github-actions released this 29 Jul 18:57
· 18 commits to main since this release
f943970

馃専 Summary

THOP 2.1.4 now accurately counts nn.Bilinear operations instead of treating them as free, improving model complexity and compute reporting. 馃幆

馃搳 Key Changes

  • Added nn.Bilinear support to THOP鈥檚 operation-counting registry.
  • Introduced a dedicated count_bilinear hook that accounts for both contractions performed by PyTorch.
  • Counts operations across standard, batched, and higher-dimensional inputs using the output tensor size.
  • Updated the package version from 2.1.3 to 2.1.4.
  • Change contributed by @raimbekovm in PR #158.

馃幆 Purpose & Impact

  • More accurate profiling: Models using bilinear layers no longer report artificially low operation counts.
  • Better comparisons: FLOPs/MACs estimates now better reflect the actual computational cost of architectures such as attention, fusion, and multimodal networks.
  • Consistent behavior: The implementation follows THOP鈥檚 existing linear-layer counting convention without adding shape-specific branches.
  • Improved resource planning: More reliable estimates can help users compare models and anticipate inference or training costs. 馃殌

What's Changed

Full Changelog: v2.1.3...v2.1.4