quic-sanirudh commented on code in PR #16859:
URL: https://github.com/apache/tvm/pull/16859#discussion_r1572692210


##########
include/tvm/relax/expr.h:
##########
@@ -915,18 +843,113 @@ class SeqExprNode : public ExprNode {
 
 class SeqExpr : public Expr {
  public:
+  /* \brief Implicit conversion constructor
+   *
+   * Relax nodes that introduce a new scope (e.g. `relax::Function`)
+   * are required to be held as SeqExpr.  This implicit conversion
+   * provides allows callsites to use these member variables when the
+   * C++ compile-time type is a `relax::Expr`.  For example,
+   * a transform may use `func.CopyOnWrite()->body = expr;`.
+   *
+   * If the expression is already a `relax::SeqExpr`, the same
+   * underlying `relax::SeqExprNode` is used, and no copies are made.
+   */
+  TVM_DLL SeqExpr(Expr body);  // NOLINT(*)
+
   TVM_DLL explicit SeqExpr(Array<BindingBlock> blocks, Expr body, Span span = 
Span());
   TVM_DEFINE_OBJECT_REF_METHODS(SeqExpr, Expr, SeqExprNode);
   TVM_DEFINE_OBJECT_REF_COW_METHOD(SeqExprNode);
 };
 
+/*!
+ * \brief Condition expression
+ *
+ * Unlike traditional statement `if`s, the if evalutes
+ * to the result of the branch taken.
+ *
+ * x = if (true) { 1 } else { 0 }; // x is 1
+ * y = if (false) { 1 } else { 0 }; // y is 0
+ *
+ * \note This is similar to C's ternary operator.
+ */
+class IfNode : public ExprNode {

Review Comment:
   Do we have to move the whole definition of `IfNode` to a new location, 
because this would make the git history a bit harder to read later on. Could we 
perhaps do a forward declaration of `SeqExpr` class and change the definition 
of `IfNode` in place?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to