Agility

Examples

  1. Measure the processing time of a function

  2. Measure the processing time of a function

Measure the processing time of a function

<<<

from onnxcustom.utils import measure_time
from math import cos

res = measure_time("cos(x)", context=dict(cos=cos, x=5.))
print(res)

>>>

    {'average': 1.2753857299685479e-05, 'deviation': 1.0989660059633723e-06, 'min_exec': 1.1770054697990417e-05, 'max_exec': 1.5929341316223145e-05, 'repeat': 10, 'number': 50}

(original entry : benchmark.py:docstring of onnxcustom.utils.benchmark.measure_time, line 10)

Measure the processing time of a function

<<<

from onnxcustom.utils import measure_time
from math import cos

res = measure_time("cos(x)", context=dict(cos=cos, x=5.))
print(res)

>>>

    {'average': 1.2742914259433747e-05, 'deviation': 9.609509757276385e-07, 'min_exec': 1.1940021067857742e-05, 'max_exec': 1.5470199286937714e-05, 'repeat': 10, 'number': 50}

(original entry : benchmark.py:docstring of onnxcustom.utils.benchmark.measure_time, line 10)

Ligne de commande

Commande check

check

Checks the module works as expected.

<<<

python -m onnxcustom check --help

>>>

usage: check [-h] [-v VERBOSE]

Runs a couple of functions to check the module is working.

optional arguments:
  -h, --help            show this help message and exit
  -v VERBOSE, --verbose VERBOSE
                        0 to hide the standout output (default: 1)