Search code examples
deep-learningcntk

What's the difference between primitive and composite function in CNTK?


From what I've learned, as_block function is used to turn composite function to primitive function. But what's the difference between the two? In what condition do I need to use this function? Thanks for your help!


Solution

  • The arguments of a composite function vs. primitive function are different. primitive function's arguments are the variables used as direct input, while composite function traces back to the beginning of graph.

    For example, if you have code like: a = b * c s = a + d If you inspect s.arguments, you'll find b, c and d. This is because the primitive function Plus is wrapped with as_composite. But you can inspect s.owner.arguments, and it'll show a and d, which are the direct inputs to Plus.