kernel_dispatch_table.h#

Static, name-keyed table that maps an ONNX (domain, op_type) pair to a per-operator trampoline able to execute the matching backend-test kernel from a :cpp:class:NodeProto + :cpp:class:RuntimeContext.

The table powers :cpp:func:onnx_kernels::RunNode (defined in run_nodes.cc). It is kept in its own translation unit so that adding a new operator requires touching only one file: the kernel implementation under onnx_kernels/kernels and one new entry in :cpp:func:KernelDispatchTable in kernel_dispatch_table.cc.

The default ONNX domain (empty string in NodeProto::domain()) is normalised to "ai.onnx" by the caller before lookup, so all keys in the table use the explicit "ai.onnx:<op_type>" form.

namespace onnx_light

Alias that makes onnx-light headers compatible with code that references ONNX_LIGHT_NAMESPACE (the macro used in the standard onnx package).

Set to ONNX_LIGHT_NAMESPACE so both names resolve to the same namespace.

Symbol-visibility attribute for the public onnx-light C++ API.

Defined as empty because onnx-light does not require explicit __declspec(dllexport) or __attribute__((visibility("default"))) annotations — visibility is controlled at the shared-library level. The macro is provided so that vendored ONNX headers that decorate their declarations with ONNX_API compile without modification.

Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal onnx namespace — rather than the ONNX_NAMESPACE macro — resolves to the onnx-light namespace. The standard onnx package lives in namespace onnx; onnx-light uses onnx_light (via ONNX_LIGHT_NAMESPACE), so this alias keeps onnx-light a true drop-in. It is only introduced when the onnx-light namespace differs from onnx.

namespace onnx_kernels#

Typedefs

using NodeKernelFn = std::function<void(const NodeProto &node, RuntimeContext &rt)>#

Signature of every per-operator trampoline registered in :cpp:func:KernelDispatchTable. Implementations read their inputs from rt.tensors() by name, call the matching kernel (constructed with rt.kernel_ctx()), and insert the produced outputs back into rt.tensors() under the names declared by node.output(i).

Functions

const std::unordered_map<std::string, NodeKernelFn> &KernelDispatchTable()#

Returns the "<domain>:<op_type>" dispatch table used by :cpp:func:onnx_kernels::RunNode. The table is constructed on first use and shared across calls (the same reference is returned every time). The default ONNX domain (empty string in NodeProto::domain()) is normalised to "ai.onnx" before lookup; adding a new operator only requires inserting one new entry in this table.