proto_util.h#

Utilities for building canonical string identifiers for ONNX functions and callee nodes, including onnx_light::FunctionImplId, onnx_light::GetFunctionImplId(), and onnx_light::GetCalleeId().

Utilities for building canonical string identifiers for ONNX functions and callee nodes.

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.

Typedefs

using FunctionSpecId = std::string#

Opaque string identifier for a function specification (domain + op-type + optional overload).

using FunctionImplId = std::string#

Opaque string identifier for a concrete function implementation (domain + op-type + optional overload), used as a lookup key in function registries.

Functions

inline FunctionImplId GetFunctionImplId(const std::string &domain, const std::string &op, const std::string &overload)#

Builds a canonical function-implementation identifier.

Concatenates the normalized domain, op name, and (when non-empty) overload into a “::” separated string. The resulting value can be used as a stable key in function-implementation maps.

Parameters:
  • domain – ONNX operator domain (e.g. "" or "ai.onnx.ml").

  • op – Operator type name.

  • overload – Optional overload qualifier; omitted from the key when empty.

Returns:

A string of the form "domain::op" or "domain::op::overload".

inline FunctionImplId GetFunctionImplId(const FunctionProto &function)#

Builds a canonical function-implementation identifier from a FunctionProto.

Convenience overload that extracts the domain, name, and overload fields from function and delegates to the primary overload.

Parameters:

functionFunctionProto whose domain, name, and overload fields are used to construct the identifier.

Returns:

A string of the form "domain::name" or "domain::name::overload".

inline FunctionImplId GetCalleeId(const NodeProto &node)#

Builds the callee identifier for a NodeProto.

Constructs the identifier that matches the FunctionImplId of the function called by node, using the node’s domain, op-type, and overload fields.

Parameters:

nodeNodeProto whose domain, op_type, and overload fields identify the called function.

Returns:

A string of the form "domain::op_type" or "domain::op_type::overload".