module testing.einsum.einsum_bench
#
Short summary#
module mlprodict.testing.einsum.einsum_bench
Function to measure the performance of einsum decomposition.
Functions#
function |
truncated documentation |
---|---|
Measures a statement and returns the results as a dictionary. |
|
Investigates whether or not the decomposing einsum is faster. |
Documentation#
Function to measure the performance of einsum decomposition.
- mlprodict.testing.einsum.einsum_bench._make_einsum_model(equation, opset=17)#
- mlprodict.testing.einsum.einsum_bench._make_inputs(equation, shapes)#
- mlprodict.testing.einsum.einsum_bench._measure_time(stmt, *x, repeat=5, number=5, div_by_number=True, first_run=True, max_time=None)#
Measures a statement and returns the results as a dictionary.
- Parameters:
stmt – string
*x –
inputs
repeat – average over repeat experiment
number – number of executions in one row
div_by_number – divide by the number of executions
first_run – if True, runs the function once before measuring
max_time – execute the statement until the total goes beyond this time (approximatively), repeat is ignored, div_by_number must be set to True
- Returns:
dictionary
See Timer.repeat for a better understanding of parameter repeat and number. The function returns a duration corresponding to number times the execution of the main statement.
- mlprodict.testing.einsum.einsum_bench.einsum_benchmark(equation='abc,cd->abd', shape=30, perm=False, runtime='python', use_tqdm=False, number=5, repeat=5, opset=17)#
Investigates whether or not the decomposing einsum is faster.
- Parameters:
equation – einsum equation to test
shape – an integer (all dimension gets the same size) or a list of shapes in a string separated with ;)
perm – check on permutation or all letter permutations
runtime – numpy, python, onnxruntime
use_tqdm – show progress
output – output file (usually a csv file or an excel file), it requires pandas
number – usual parameter to measure a function
repeat – usual parameter to measure a function
opset – target opset
- Returns:
list of dictionaries as an iterator