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 2019/12/27 19:32:42 UTC

[GitHub] [incubator-tvm] zhiics commented on a change in pull request #4594: [relay][refactor] Refactor Get::Op calls to IsOp utility

zhiics commented on a change in pull request #4594: [relay][refactor] Refactor Get::Op calls to IsOp utility
URL: https://github.com/apache/incubator-tvm/pull/4594#discussion_r361731687
 
 

 ##########
 File path: include/tvm/relay/op.h
 ##########
 @@ -610,6 +610,19 @@ inline bool IsPrimitiveOp(const Expr& expr) {
   return op != nullptr && op->IsPrimitiveOp();
 }
 
+/*!
+ * \brief Check if an op is the one with the provided name.
+ *
+ * \param ref The op to be checked.
+ * \param name The given operator name.
+ *
+ * \return True if the op is the same with the given name. Otherwise, false.
+ */
+inline bool IsOp(const NodeRef& ref, const std::string& name) {
+  CHECK(ref.defined());
+  return ref->IsInstance<OpNode>() && Downcast<Op>(ref) == Op::Get(name);
 
 Review comment:
   yes, it is here:
   
   https://github.com/apache/incubator-tvm/blob/e6d9f89c1ce9c45d0c65dce582de440c2fc7b8ba/src/relay/ir/op.cc#L62-L65

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


With regards,
Apache Git Services