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 2020/11/27 17:34:15 UTC
[GitHub] [tvm] d-smirnov commented on a change in pull request #6655: [BYOC] Added "include_non_call_ops" parameter to AnnotateTarget pass
d-smirnov commented on a change in pull request #6655:
URL: https://github.com/apache/tvm/pull/6655#discussion_r531711366
##########
File path: tests/python/relay/test_pass_annotate_target.py
##########
@@ -327,6 +327,42 @@ def after():
assert tvm.ir.structural_equal(expected, result)
+def test_tuple_two_targets():
+ """Tests whether the TupleNode is promoted to previously annotatated operation or is excluded."""
+ target_relu = "relu_target"
+ target_maximum = "maximum_target"
+ target_default = "default"
+
+ @tvm.ir.register_op_attr("nn.relu", "target." + target_relu)
+ def relu(attrs, args): # pylint: disable=unused-variable
+ return True
+
+ @tvm.ir.register_op_attr("maximum", "target." + target_maximum)
+ def maximum(attrs, args): # pylint: disable=unused-variable
+ return True
+
+ def before():
+ a = relay.var("a", shape=(10, 5))
+ b = relay.var("b", shape=(10, 5))
+ r = relay.nn.relu(b)
+ t1 = relay.Tuple((r, r))
+ r2 = relay.nn.relu(t1)
+ m = relay.maximum(a, b)
+ t2 = relay.Tuple((m, r2))
+ f = relay.Function([a, b], t2)
+ return tvm.IRModule.from_expr(f)
+
+ for default_tuples, parts in [(True, 3), (False, 2)]:
+ result = before()
+ result = transform.AnnotateTarget([target_relu], default_tuples)(result)
+ result = transform.AnnotateTarget([target_maximum], True)(result)
Review comment:
this is outdated, hence closing
----------------------------------------------------------------
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