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/04/29 17:43:51 UTC

[GitHub] [incubator-tvm] zhiics commented on a change in pull request #5360: [QNN] Support CallNode inputs in qnn.concatenate

zhiics commented on a change in pull request #5360:
URL: https://github.com/apache/incubator-tvm/pull/5360#discussion_r417496245



##########
File path: python/tvm/relay/qnn/op/qnn.py
##########
@@ -180,15 +180,16 @@ def concatenate(data,
         The concatenated quantized tensor.
     """
 
-    data = list(data)
-    if not data:
-        raise ValueError("relay.concatenate requires data to be non-empty.")
+    if isinstance(data, (list, tuple)):
+        data = Tuple(data)
+    if isinstance(data, TupleWrapper):

Review comment:
       I think we should use `elif` so that there is no need to check again if `data` is list of tuple

##########
File path: src/relay/qnn/op/concatenate.cc
##########
@@ -149,8 +149,18 @@ Expr ConcatenateQnnCanonicalize(const Attrs& attrs, const Array<Expr>& new_args,
   // If the output qnn params do not match the input qnn params, we can call requantize on the input
   // expr first, followed by a concatenate on the requantized input exprs.
 
-  auto tuple_data = data.as<TupleNode>();
-  CHECK(tuple_data != nullptr);
+  Array<Expr> tuple_exprs;
+  if (data->IsInstance<TupleNode>()) {
+    tuple_exprs = data.as<TupleNode>()->fields;
+  }
+  // if the data is a CallNode, use TupleGetItems
+  if (data->IsInstance<CallNode>()) {

Review comment:
       `else if` 




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