Skip to content

gmalivenko/onnx-opcounter

Repository files navigation

ONNX Operations Counter [WIP]

GitHub License Downloads PyPI

Counts number of parameters / MACs for ONNX models.

Installation

pip install onnx_opcounter

Basic Usage

Using CLI (calculate number of parameters)

onnx_opcounter {path_to_onnx_model}

Using CLI (calculate number of parameters and MACs)

onnx_opcounter --calculate-macs {path_to_onnx_model}

Using API

from onnx_opcounter import calculate_params
import onnx

model = onnx.load_model('./path/to/onnx/model')
params = calculate_params(model)

print('Number of params:', params)

License

The software is covered by Apache License 2.0.