File size: 643 Bytes
2d4936d | 1 2 3 4 5 6 7 8 9 10 | import sys, time
import numpy as np, onnxruntime as ort
for th in (1, 4):
o = ort.SessionOptions(); o.intra_op_num_threads = th; o.inter_op_num_threads = 1
s = ort.InferenceSession("export/codec_decoder.onnx", o, providers=["CPUExecutionProvider"])
for T in (12, 38, 80, 200):
z = np.zeros((1, 32, T), np.float32); s.run(None, {"z": z}); t = []
for _ in range(4): a = time.perf_counter(); s.run(None, {"z": z}); t.append(time.perf_counter() - a)
m = min(t); print(f"codec, {th} thread(s), {T} frames ({T * 46.44 / 1000:.2f} s of sound): {m * 1e3:.0f} ms = {m / (T * 0.04644):.2f} of real time", flush=True)
|