-m yobx stats … compute statistics on an onnx model#
The command analyses an ONNX model and reports the number of nodes per operator type together with an estimation of the computational cost (FLOPs). Results can be printed to the terminal or saved to a CSV or Excel file.
Description#
See yobx.helpers.stats_helper.model_statistics().
usage: stats [-h] [-o OUTPUT] [-v VERBOSE] input
Computes statistics on an ONNX model:
number of nodes per op_type and estimation of computational cost.
positional arguments:
input onnx model to analyze
options:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
output file (.xlsx or .csv) or empty to print on standard output
-v VERBOSE, --verbose VERBOSE
verbosity
Examples#
Print statistics to the terminal:
python -m yobx stats model.onnx
Save statistics to a CSV file:
python -m yobx stats model.onnx -o stats.csv
Save statistics to an Excel workbook:
python -m yobx stats model.onnx -o stats.xlsx
Output on a Dummy Model#
The following block builds a small MatMul + Relu model on the fly and
runs the command to show what the output actually looks like.
Number of nodes: 2
Report 1 — Node counts per op_type:
MatMul: 1
Relu: 1
Report 2 — Estimated FLOPs per op_type:
MatMul: 256
Relu: 16
Total estimated FLOPs: 272