KhronosGroup / NNEF-Docs

NNEF public repository
Apache License 2.0
14 stars 3 forks source link

External operation in graph body #8

Closed zoeoz closed 5 years ago

zoeoz commented 6 years ago

The specification says "Parameters of a graph (which are implicitly of type tensor) must be defined as the result of an external operation. The external operation must not be used in a fragment."

This makes sense. It raises the question: should it also be invalid for any other identifier in the graph body that is not a parameter of the graph to be defined as the result of an external operation. Rationale being, the parameters of the graph should be the only tensors in the entire graph that come from external data sources. Otherwise, what is the meaning and semantics of a node in the graph body that is not a parameter but is defined as external; or, conversely, what is the purpose of the graph parameters at all in this case?

gyenesvi commented 6 years ago

You are right, and this was the original intention; there should be a one-to-one correspondence between graph parameters and tensors defined as external. We can clarify the text to be more clear about it.

This may seem redundant, but here's a bit of further explanation: in principle, it would be enough to declare input tensors as external, and that would provide enough information about what the parameters of the graph are. However, we wanted to explicitly enumerate the parameters in the beginning of the document, so that a parser can easily see the interface of the graph. This requires consistency checking between the parameter names and the external tensors.

zoeoz commented 6 years ago

Thank you for the clarification. That's what I was wondering. The consistency checking is a nice design. But for it to have meaning, there needs to be a one-to-one relation between graph parameters and external nodes.

gyenesvi commented 6 years ago

Clarifying this in the spec.

gyenesvi commented 5 years ago

Fixed in spec version 1.0.1.

zoeoz commented 5 years ago

Yes, nice.