
Contents
More
This class replaces the python implementation by custom implementation.The Array API extends many operator to all types not supportedby the onnx specifications. The evaluator allows to testscenarios outside what an onnx backend bound to the official onnxoperators definition could do.
fromonnx.referenceimportReferenceEvaluatorfromonnx.reference.c_opsimportConvref=ReferenceEvaluator(...,new_ops=[Conv])
This class implements methodenumerate_results which iterates onintermediates results. By default, it usesonnx_array_api.reference.ExtendedReferenceEvaluator.
onnx_model – model to run
recursive – dig into subgraph and functions as well
cls – evaluator to use, default value isExtendedReferenceEvaluator
Executes the onnx model and enumerate all the intermediate results.
output_names: requested outputs by names, None for allfeed_inputs: dictionary{ input name: input value }
iterator on tuple(result kind, name, value, node.op_type or None)
Executes the onnx model and enumerate intermediate results without their names.
output_names – requested outputs by names, None for all
feed_inputs – dictionary{inputname:inputvalue}
raise_exc – raises an exception if the execution fails or stop where it is
keep_tensor – keep the tensor in order to compute precise distances
iterator on ResultExecution
Computes a distance between two results.
(ResultType.RESULT, np.dtype(“float32”), (2, 2), “CEIO”, “Abs”),
r1 – first result
r2 – second result
distance
Computes the distance between two sequences of results.
s1 – first sequence
s2 – second sequence
distance and alignment
Prints out the alignment between two sequences into a string.:param s1: first sequence:param s2: second sequence:param alignment: alignment:param column_size: column size:return: test
Compares the execution of two onnx models.The function assumes both models takes the same inputs.SeeCompares the conversions of the same model with different options to see a full example usingthis function.
model1 – first model
model2 – second model
inputs – inputs to use, a list of inputs if both models havethe same number of inputs or two dictionaries, one for each model
verbose – verbosity
raise_exc – raise exception if the execution fails or stop at the error
mode – the model should be executed but the function can be executedbut the comparison may append on nodes only
keep_tensor – keeps the tensor in order to compute a precise distance
cls – evaluator class to use
four results, a sequence of resultsfor the first model and the second model,the alignment between the two, DistanceExecution