attribute_binder.h#
-
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 internal
Typedefs
-
using AttributeMap = std::unordered_map<std::string, const AttributeProto*>#
Maps formal attribute names to concrete attribute values from a call-site node.
-
class AttributeBinder : public onnx_light::internal::MutableVisitor#
- #include <attribute_binder.h>
Binds attribute references in a function body to call-site attribute values.
A bound attribute keeps the original attribute name from the callee function and copies only the value from the corresponding call-site attribute. If the call-site does not supply a value for a referenced attribute, the referenced attribute is removed.
Public Functions
-
inline explicit AttributeBinder(const AttributeMap &attr_map)#
Initializes the binder with a map of call-site attributes indexed by name.
-
inline virtual void VisitNode(NodeProto &node) override#
Updates attributes in a node and recursively updates attributes in subgraphs.
Binding a formal attribute parameter may remove an attribute from a node when the call-site omits that parameter. This requires processing at node scope (not at attribute scope) because attributes may be erased from the node list.
Public Static Functions
-
static inline void BindAttributes(const NodeProto &callnode, FunctionProto &callee)#
Binds all attribute references in a callee function using a call-site node.
- Parameters:
callnode – Node that provides concrete attribute values.
callee – Function body to update in place.
Private Members
-
const AttributeMap &attr_map_#
-
inline explicit AttributeBinder(const AttributeMap &attr_map)#
-
using AttributeMap = std::unordered_map<std::string, const AttributeProto*>#
-
namespace internal