onnx_kernels#

This module documents the C++ static library lib_onnx_kernels that bundles the per-operator ONNX kernel implementations (Add, Conv, Resize, …) for every standard domain. It only depends on lib_onnx_proto and lib_onnx_core.

The generic execution engine that onnx_kernels plugs into — the runtime value types (onnx_light::core::runtime::Tensor, onnx_light::core::runtime::Sequence, onnx_light::core::runtime::Map), onnx_light::core::runtime::RuntimeContext, the onnx_light::core::runtime::RunNode() / onnx_light::core::runtime::RunModel() traversal, random-number helpers, and the raw-buffer allocator — lives in onnx_core instead (see runtime), so that it has no dependency on any particular set of operator kernels. Control-flow operators (If, Loop, Scan) live there too, for the same reason.

onnx_core’s kernel dispatch table (onnx_light::core::runtime::KernelDispatchTable()) starts out empty. onnx_kernels populates it with its own per-operator trampolines by calling onnx_light::onnx_kernels::RegisterKernelFunctions() once, which also registers the SequenceMap output-packing callback used by onnx_light::core::runtime::RunNode(). Any consumer that runs nodes/graphs/models built from standard ONNX operators (Python bindings, the backend-test runner, the gtest binary, …) must call onnx_light::onnx_kernels::RegisterKernelFunctions() once before doing so.

This module also documents:

  • a onnx_light::onnx_backend_test::TestCase bundle of onnx_light::ModelProto + expected input/output data sets;

  • the onnx_light::onnx_backend_test::Expect() helper and onnx_light::onnx_backend_test::CollectTestCases() registry;

  • the ONNX operator kernel implementations themselves under onnx_extensions/kernels/kernels/.