Compare backends at a stated precision
Shared polynomial coefficients provide a mathematical common source. Floating-point results also depend on dtype, operation ordering, compiler transformations, device, and the selected algorithm.
Set up a useful comparison
- Use the same activation, derivative order, shapes, and input values.
- Enable JAX float64 before array construction with
JAX_ENABLE_X64=1when comparing float64 results. - Match the Torch dtype explicitly. Keep model parameters and inputs consistent.
- Select the same mathematical path; a directional estimator and exact support enumeration are different algorithms.
- Compare absolute and relative errors against a suitable independent reference, and include difficult inputs.
Riccati and general-composition paths can have different accumulation order. Algebraic equivalence is not a promise of bit identity. Report the actual tolerance and inputs of a passing comparison.
The benchmark methodology separates numerical accuracy from speed. Numerical scope describes supported operator paths.