Operation Categories
Use this page to understand which operations cost FLOPs, which are free, and which are unsupported.
You will learn:
- How to identify free, counted, and blacklisted operations
- What cost formulas apply to each counted sub-category
- Which operations are blocked and why
Three categories
Every NumPy function falls into one of three categories in flopscope:
Free operations (0 FLOPs)
Operations that involve no arithmetic computation — just memory allocation, reshaping, or data movement.
Examples: zeros, ones, full, eye, arange, linspace, empty, reshape, transpose, concatenate, stack, split, squeeze, expand_dims, ravel, take, where, copy, astype, asarray
Counted operations (cost > 0)
Operations that perform arithmetic. Cost is computed analytically from tensor shapes.
| Sub-category | Cost formula | Examples |
|---|---|---|
| Unary | numel(output) | exp, log, sqrt, abs, sin, cos, tanh, ceil, floor |
| Binary | numel(output) | add, multiply, maximum, divide, power, subtract |
| Reduction | numel(input) | sum, mean, max, min, std, var, argmax, nansum |
| Einsum | product of all index dims | fnp.einsum(...) |
| Dot/Matmul | equivalent einsum | fnp.dot(A, B), A @ B |
| Linalg | per-operation formula | fnp.linalg.solve, fnp.linalg.eigh, fnp.linalg.cholesky |
| FFT | 5 N log N | fnp.fft.fft, fnp.fft.rfft, fnp.fft.fft2 |
| SVD | m × n × k | fnp.linalg.svd(A, k=10) |
| Sort/Search | n log n per slice | sort, argsort, unique, searchsorted |
| Random | numel(output) | fnp.random.randn, fnp.random.normal, fnp.random.uniform |
| Stats | flat per-element (varies) | flops.stats.norm.pdf, flops.stats.expon.cdf, flops.stats.cauchy.ppf |
When inputs are SymmetricTensor, many operations automatically get reduced costs. See Exploit Symmetry.
Blacklisted operations
Operations not relevant to numerical computation. Calling them raises an AttributeError. These are I/O, configuration, datetime, and display functions that have no meaningful FLOP cost.
fnp.save(array, "file.npy")
# AttributeError: flopscope does not support 'save' (blacklisted). Save array to .npy file. Not supported.. Did you mean: 'ravel'?Blacklisted categories: I/O (save, load, loadtxt, savetxt, savez, genfromtxt), configuration (seterr, geterr, setbufsize), datetime (busday_count, is_busday), display (array2string, array_repr), functional (apply_along_axis, piecewise, frompyfunc).
See API Reference for the complete list.
Related pages
- API Reference — complete list of every operation and its category
- FLOP Counting Model — how costs are calculated
- Migrate from NumPy — what changes when moving from NumPy