Short examples#

  1. 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.7344800289720298e-05, 'deviation': 1.5329334451984916e-06, 'min_exec': 1.6209989553317428e-05, 'max_exec': 2.169000799767673e-05, 'repeat': 10, 'number': 50}

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