-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Description
This is a proposal to add a couple of primitive operators, whose primary purpose is to allow us to define other ops as functions. It is intended to specifically help address scenarios where the op/function has optional attributes or optional inputs, and we need to check if the optional attribute/input was supplied or not.
New Operator
(a) AttributeHasValue() : an operator that returns true if it has an attribute specified.
(b) StaticOptionalHasValue(X): an operator that returns true if an optional input is specified.
Describe the operator
As mentioned above, this is intended to enable function-definition for ops that have optional
attributes or inputs which determine the behavior of the function.
Can this operator be constructed using existing onnx operators?
No.
Is this operator used by any model currently? Which one?
There are examples of ops: eg., CumSum has two optional attributes. Squeeze is an example of an op with an optional input.
Are you willing to contribute it? (Y/N)
Y
Notes
The existing mechanism of context-dependent functions is a workaround for the above issue. However, context-dependent functions have their own disadvantages. Eg., it is not easy to embed their function expansion as a model-local function. The above primitives will allow us to express such functions as context-free functions, which are easy to export as a model-local function.