validation#

C API#

_validation#

onnx_extended.validation._validation.benchmark_cache(size: int, verbose: bool = True) float#

Runs a benchmark to measure the cache performance. The function measures the time for N random accesses in array of size N and returns the time divided by N. It copies random elements taken from the array size to random position in another of the same size. It does that size times and return the average time per move. See example Measuring CPU performance.

Parameters:

size – array size

Returns:

average time per move

onnx_extended.validation._validation.benchmark_cache_tree(n_rows: int = 100000, n_features: int = 50, n_trees: int = 200, tree_size: int = 4096, max_depth: int = 10, search_step: int = 64) List[onnx_extended.validation._validation.ElementTime]#

Simulates the prediction of a random forest. Returns the time taken by every rows for a function doing random addition between an element from the same short buffer and another one taken from a list of trees. See example Measuring CPU performance.

Parameters:
  • n_rows – number of rows of the whole batch size

  • n_features – number of features

  • n_trees – number of trees

  • tree_size – size of a tree (= number of nodes * sizeof(node) / sizeof(float))

  • max_depth – depth of a tree

  • search_step – evaluate every…

Returns:

array of time take for every row