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_NAMESPACEso 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 withONNX_APIcompile without modification.Namespace alias so that ONNX C++ code (and consumers such as onnxruntime) that refers to the literal
onnxnamespace — rather than theONNX_NAMESPACEmacro — resolves to the onnx-light namespace. The standard onnx package lives innamespace onnx; onnx-light usesonnx_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 fromonnx.-
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 fromrt.tensors()by name, call the matching kernel (constructed withrt.kernel_ctx()), and insert the produced outputs back intort.tensors()under the names declared bynode.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 inNodeProto::domain()) is normalised to"ai.onnx"before lookup; adding a new operator only requires inserting one new entry in this table.
-
using NodeKernelFn = std::function<void(const NodeProto &node, RuntimeContext &rt)>#
-
namespace onnx_kernels#