mbrookhart commented on a change in pull request #7754:
URL: https://github.com/apache/tvm/pull/7754#discussion_r604230272
##########
File path: tests/python/relay/test_dataflow_pattern.py
##########
@@ -1375,6 +1392,63 @@ def test_partition_overused():
assert pattern.partition(out) == out
+def test_partition_fuzzy_tuple():
+ x = relay.var("x")
+ y = relay.var("y")
+ z = x + y
+ tuple_pattern = is_tuple(None)
Review comment:
The problem is that we're not actually talking about a pattern, which
explicitly represents an AST node. Instead, we're trying to represent an
attribute of an AST node, particularly an attribute of the type Array\<Exp\r>,
that's what needs to be passed in. In the backend I need to be able to
distinguish between a valid array of size 0 that I want to match on, and an
invalid fuzzy array I don't want to match on. The simplest way to do that is to
store a nullptr, and when I pass python None to the backend, that's what I get.
I could introduce something like an `arg+` pattern that goes into the
argument list, but that screws with the locality of the pattern matcher and
creates a need to do a lot of look-ahead to determine how to match arguments so
I don't accidentally index into an array I shouldn't or reject the match
because the arguments don't match. It's feasible, but messy.
##########
File path: tests/python/relay/test_dataflow_pattern.py
##########
@@ -1375,6 +1392,63 @@ def test_partition_overused():
assert pattern.partition(out) == out
+def test_partition_fuzzy_tuple():
+ x = relay.var("x")
+ y = relay.var("y")
+ z = x + y
+ tuple_pattern = is_tuple(None)
Review comment:
The problem is that we're not actually talking about a pattern, which
explicitly represents an AST node. Instead, we're trying to represent an
attribute of an AST node, particularly an attribute of the type Array\<Expr>,
that's what needs to be passed in. In the backend I need to be able to
distinguish between a valid array of size 0 that I want to match on, and an
invalid fuzzy array I don't want to match on. The simplest way to do that is to
store a nullptr, and when I pass python None to the backend, that's what I get.
I could introduce something like an `arg+` pattern that goes into the
argument list, but that screws with the locality of the pattern matcher and
creates a need to do a lot of look-ahead to determine how to match arguments so
I don't accidentally index into an array I shouldn't or reject the match
because the arguments don't match. It's feasible, but messy.
--
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:
[email protected]