mbrookhart commented on a change in pull request #6704:
URL: https://github.com/apache/incubator-tvm/pull/6704#discussion_r510240029



##########
File path: include/tvm/relay/expr_functor.h
##########
@@ -408,6 +409,73 @@ Expr PostOrderRewrite(const Expr& expr, ExprRewriter* 
rewriter);
  */
 void PostOrderVisit(const Expr& node, std::function<void(const Expr&)> fvisit);
 
+/*!
+ * \brief A function to iteratively traverse dataflow regions of a graph
+ *
+ * ExpandDataflow manually manages a stack and performs DFS to determine the 
processing
+ * order of nodes in an input graph.
+ *
+ * If it finds a dataflow node (Call, Tuple, TupleGetItem), it checks if the 
arguments to that node
+ * need to be processed via fcheck_visited. If so, the function pushes those 
arguments to the stack
+ * and continues iteratively to process the top of the stack. When it finds a 
node that doesn't
+ * match the dataflow types, or a node who's inputs have all been processed, 
it visits the current
+ * leaf via fvisit_leaf.
+ *
+ * This function should be used internally to other classes to implement 
mixed-mode traversals. The
+ * expectation is that fvisit_leaf will perform recursive analysis within 
mixed-mode traversal if it
+ * hits a non-dataflow node.
+ *
+ * fcheck_visited and fvisit_leaf are templated to encourage compiler inlining.
+ */
+template <typename FCheckVisited, typename FVisitLeaf>

Review comment:
       InferType directly extends ExprFunctor instead of using ExprVisitor or 
ExprMutator




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to