flopscope.accounting.pointwise_cost
flopscope.accounting.pointwise_cost(op_name: 'str', *, shape: 'tuple[int, ...]', symmetry: 'SymmetryGroup | None' = None) -> 'int'[flopscope source]
Weighted FLOP cost of a pointwise operation.
Parameters
- op_name:str
Operation name used for weight lookup, e.g.
"exp"or"add".- shape:tuple of int
Output shape of the pointwise operation.
- symmetry:SymmetryGroup or None, optional
If provided, only unique elements are counted analytically before the operation weight is applied.
Returns
- :int
Weighted public cost estimate, floored to match runtime accounting.
Notes
This helper multiplies the analytical pointwise count by the active weight
for op_name and then floors with int(...) to match runtime budget
accounting.
Examples
>>> import flopscope as flops
>>> cost = flops.accounting.pointwise_cost("exp", shape=(2, 3))
>>> isinstance(cost, int)
True