-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Constant have no input which is weird for an operator #2274
Comments
Yes, it is reasonable to have an operator with no inputs. Of course, the only case where it makes sense is where the output is a constant or is a randomly-generated tensor. Thus, RandomUniform and RandomNormal are two other examples of an operator with no inputs. Why is your test failing? There are "optimizer" passes that convert uses of "Constant" to replace it with an Initializer (just like you mention). It is possible that this creates an empty graph, which causes something to fail. But it sounds like an error in some other code. |
Thanks for your reply.
onnx-go works somehow like Keras; it is independent of the execution backend. Each node of the graph is either a Then a backend (here, a particular implementation based on Gorgonia) walks the graph to create its internal structure. The main issue is a design problem. Some checks are made against the arity of the operators. But I never considered that any operator could have an arity of zero (neither did Gorgonia I think).
This can be implemented as a workaround in the main decoder package (onnx-go). Thanks for the tip. |
I am closing this issue as I have all the required information to implement this in onnx-go. |
I have a PR against onnx-go to implement the
Constant
Operator in the Gorgonia backend.The test I have fails because it creates an empty graph.
It is because the
Constant
Operator does not have any input.Is it an expected behavior to be able to define an operator without input? It sounds counter-intuitive. My understanding is that its usage can be avoided by using Initializers.
Are they any other operators "input-less"?
WDYT?
The text was updated successfully, but these errors were encountered: