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/12/06 19:19:54 UTC

[GitHub] [tvm] AndrewZhaoLuo commented on a change in pull request #9660: [Relay][Quantization] Fq2i hard fail option

AndrewZhaoLuo commented on a change in pull request #9660:
URL: https://github.com/apache/tvm/pull/9660#discussion_r763309427



##########
File path: src/relay/transforms/fake_quantization_to_integer.cc
##########
@@ -154,14 +154,30 @@ class SubgraphMutator : public ExprMutator {
     out_type_ = affine_types_[expr];
     static auto fqfq =
         Op::GetAttrMap<FTVMFakeQuantizationToInteger>("FTVMFakeQuantizationToInteger");
-    for (auto node : subgraph_) {
-      if (!fqfq.count(Downcast<Op>(node.as<CallNode>()->op))) {
-        // Only modify the subgraph if we have translation
-        // rules for every op
+    if (hard_fail_) {
+      for (auto node : subgraph_) {
+        const Op op = Downcast<Op>(node.as<CallNode>()->op);
+        ICHECK(fqfq.count(op) > 0)
+            << "Found no rewrite rule for " << AsText(op, false) << std::endl;
+      }
+      return Mutate(expr);
+    } else {
+      for (auto node : subgraph_) {
+        const Op op = Downcast<Op>(node.as<CallNode>()->op);
+        if (!fqfq.count(Downcast<Op>(op))) {
+          // Only modify the subgraph if we have translation
+          // rules for every op
+          DLOG(INFO) << "Found no rewrite rule for " << AsText(op, false) << std::endl;

Review comment:
       Can you move the if else for `hard_fail_` in here and use `LOG(FATAL)`, `ICHECK` just hits LOG_FATAL




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org