[IR] Fix a primitive check error (#5991)
authorLiangfu Chen <liangfu@apache.org>
Tue, 14 Jul 2020 03:16:49 +0000 (11:16 +0800)
committerGitHub <noreply@github.com>
Tue, 14 Jul 2020 03:16:49 +0000 (20:16 -0700)
* fix primitive check error

* assuming every Op has Type defined

* CHECK_NE -> CHECK

Co-authored-by: Liangfu Chen <liangfc@amazon.com>
include/tvm/ir/op.h

index 9a91302..e7b3577 100644 (file)
@@ -146,6 +146,7 @@ class OpNode : public RelayExprNode {
   // Internal function to compute if it is primitive op
   bool IsPrimitiveOp_() const {
     const auto& fn_ty = this->op_type;
+    CHECK(fn_ty.get() != nullptr);
     if (fn_ty->type_constraints.size() != 1) return false;
     const TypeRelationNode* rel = fn_ty->type_constraints[0].as<TypeRelationNode>();
     if (rel == nullptr) return false;