You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/01/22 21:11:25 UTC

[GitHub] [tvm] masahi commented on a change in pull request #7329: Allow TuplePattern to have null fields and match any tuple

masahi commented on a change in pull request #7329:
URL: https://github.com/apache/tvm/pull/7329#discussion_r562913049



##########
File path: src/relay/ir/dataflow_matcher.cc
##########
@@ -400,12 +400,16 @@ bool DFPatternMatcher::VisitDFPattern_(const TupleGetItemPatternNode* op, const
 bool DFPatternMatcher::VisitDFPattern_(const TuplePatternNode* op, const Expr& expr) {
   bool matches = false;
   if (const auto* tuple_node = expr.as<TupleNode>()) {
-    if (op->fields.size() == tuple_node->fields.size()) {
-      matches = true;
-      size_t i = 0;
-      while (matches && i < op->fields.size()) {
-        matches &= VisitDFPattern(op->fields[i], tuple_node->fields[i]);
-        ++i;
+    matches = true;
+    if (op->fields.defined()) {
+      if (op->fields.size() == tuple_node->fields.size()) {
+        size_t i = 0;

Review comment:
       `if (op->fields.defined() && op->fields.size() == tuple_node->fields.size()) {`




----------------------------------------------------------------
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:
users@infra.apache.org