manupa-arm commented on a change in pull request #10548:
URL: https://github.com/apache/tvm/pull/10548#discussion_r823565703



##########
File path: src/relay/backend/contrib/cmsisnn/relay_to_tir.cc
##########
@@ -548,7 +560,21 @@ class RelayToTIRVisitor : public MixedModeMutator {
   }
 
   void EmitAdd(const GlobalVar& global_var, const Expr& expr) {
-    auto* add_call = expr.as<CallNode>();
+    const CallNode* clip_call = nullptr;
+    const CallNode* add_call = nullptr;
+    const CallNode* final_call = expr.as<CallNode>();
+    const OpNode* final_op = final_call->op.as<OpNode>();
+    int32_t output_min = std::numeric_limits<int8_t>::min();
+    int32_t output_max = std::numeric_limits<int8_t>::max();
+    if (final_op->name == "clip") {

Review comment:
       Can we refactor the parsing of binop --> clip into a function ?
   
   As for a suggestion :
   Something like : ParseBinaryElementwiseOpClipPattern(const Expr& expr) --> 
   struct BinaryElementwiseClipPattern {
       Call binary_operator;
       Optional\<Call\> clip_operator;
   }
   
   So we can avoid duplicating the same code at two places.




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to