
An accelerator supports many graph operators but leaves one expensive stage on the CPU. An operation count alone can make acceleration look more complete than it is. The illustrative weights are baseline time costs. The fraction reports what share of that baseline belongs to supported operators.
Give the calculation a known answer
These values are illustrative planning inputs rather than hardware measurements. Replace them with observations from the same device, model file, runtime and power setting when turning the estimate into a release decision. Keep units beside each value in the result export.
def evaluate(v):
return round(sum(cost for supported,cost in v if supported)/sum(cost for supported,cost in v),3)
for sample in [[[True, 2], [True, 3], [False, 40]], [[False, 2], [True, 40]], [[True, 10], [True, 10]]]:
print(evaluate(sample))Inspect the computed values
| Example input | Calculated output |
|---|---|
| [[true, 2], [true, 3], [false, 40]] | 0.111 |
| [[false, 2], [true, 40]] | 0.952 |
| [[true, 10], [true, 10]] | 1.0 |
For [[true, 2], [true, 3], [false, 40]], the observed output is 0.111. With [[false, 2], [true, 40]], it becomes 0.952. These are useful regression fixtures because an integration test can send both through the same entry point. A test of only the first case can stay green after a change that affects the other.
The value for [[true, 10], [true, 10]] is 1.0. Record the unit or indexing convention next to that expectation. A second implementation can return the same type and still disagree about where a boundary falls or which observations enter the calculation.
The second case changes the reported quantity by 0.841 compared with the first. That is an absolute difference in the reported scale. Calling it a relative percent change would require dividing by an appropriate starting value and handling a baseline of zero.
The decision beyond the score
Transfers between execution providers can add overhead, and supported operators can accelerate by different factors. Verify the full graph on target hardware.
For a repeatable comparison, retain one counterexample as well as one ordinary success. In this fixture, [[false, 2], [true, 40]] makes a useful starting point: its reference result is 0.952. A changed result is a prompt to inspect the inputs, dependency version and chosen policy before accepting a new baseline.
A reproduction of execution provider coverage should keep the runtime configuration with the case. Here the original first input is [[true, 2], [true, 3], [false, 40]]. In a production note, include the tensor layout or measured workload used to populate the example. This makes it possible to tell a code regression apart from a device or serving configuration with a different memory or latency profile when the same evaluation is run again.
ONNX Runtime execution providers · Python numeric types
Sources and further reading
Cover photograph: GeForce 6800 by Hellisp. Public domain. Cropped and typeset for this cover. The photograph illustrates the topic.
