flopscope.accounting.polysub_cost
flopscope.accounting.polysub_cost(n1, n2)[flopscope source]
Cost for polysub: max(n1, n2) FLOPs.
Legacy length-based formula, kept for the public flops.polysub_cost
analytical-cost API (1-D coefficient arrays, where axis-0 length is
the element count). The polysub wrapper itself bills via
_polyaddsub_cost, which also covers higher-rank/broadcasting inputs
-- see that function's docstring for why axis-0 length alone is not
enough there.
Parameters
Returns
- :int
Weighted public cost estimate, floored to match runtime accounting.
Notes
This helper multiplies the analytical FLOP count by the active weight from flopscope._weights and then applies int(...) so public estimates match budget deductions.