Replies: 5 comments
-
The reason that the cond operator fails is that CachedOp, which the cond operator uses to execute a subgraph, requires to have inputs for every subgraph. |
Beta Was this translation helpful? Give feedback.
-
@mxnet-label-bot [Python, Question] |
Beta Was this translation helpful? Give feedback.
-
@zheng-da Thank you so much for providing this example and very detailed explanation! To be clear, please allow me to summarize the problem as follows: currently, the implementation of three control flow operators, To my understanding, this is actually a restriction of
I guess it will be great if it could be fixed in ongoing work #11641. |
Beta Was this translation helpful? Give feedback.
-
Yes, the problem is that CachedOp can't handle a subgraph that doesn't require inputs. There are two possible fixes: one is to find nodes such as zeros() and ones() and keep them outside the subgraph; the other is to modify CachedOp to handle the case. The problem of handling subgraph without inputs in CachedOp is that we need to find out what context we should use. |
Beta Was this translation helpful? Give feedback.
-
The python functions of the cond operator has to access some variables outside the function.
The following code will run into an error as follows.
Beta Was this translation helpful? Give feedback.
All reactions