"""Evaluate model performance""" import time import torch import numpy as np from python.model.nnue_linear import LinearEval def benchmark(model: LinearEval, samples: int = 1000) -> dict: """ Benchmark inference speed. Returns: dict with speed metrics """ model.eval() x = torch.randn(samples, 61072) start = time.time() with torch.no_grad(): for _ in range(samples): _ = model(x) end = time.time() return { "samples": samples, "time_seconds": end - start, "ms_per_sample": (end - start) / samples * 1000, }