You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ju...@apache.org on 2022/09/24 23:28:08 UTC

[tvm] branch main updated: [IR] Use TVM_DEFINE_OBJECT_REF_METHODS macro for Op (#12893)

This is an automated email from the ASF dual-hosted git repository.

junrushao pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 71f25b3d6c [IR] Use TVM_DEFINE_OBJECT_REF_METHODS macro for Op (#12893)
71f25b3d6c is described below

commit 71f25b3d6c851046e925ef6a2d2626626084913a
Author: Eric Lunderberg <Lu...@users.noreply.github.com>
AuthorDate: Sat Sep 24 18:28:02 2022 -0500

    [IR] Use TVM_DEFINE_OBJECT_REF_METHODS macro for Op (#12893)
    
    Previously, the `get()` method wasn't defined, and returned a
    `RelayExprNode` instead of a `Op::ContainerType*`.
---
 include/tvm/ir/op.h | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/include/tvm/ir/op.h b/include/tvm/ir/op.h
index 6831700264..6e6b8bee5f 100644
--- a/include/tvm/ir/op.h
+++ b/include/tvm/ir/op.h
@@ -164,15 +164,6 @@ class OpNode : public RelayExprNode {
  */
 class Op : public RelayExpr {
  public:
-  /*! \brief default constructor  */
-  Op() {}
-  /*! \brief constructor from node pointer */
-  explicit Op(ObjectPtr<Object> n) : RelayExpr(n) {}
-  /*!
-   * \brief access the internal node container
-   * \return the pointer to the internal node container
-   */
-  inline const OpNode* operator->() const;
   /*!
    * \brief Get additional registered attribute about operators.
    *  If nothing has been registered, an empty OpAttrMap will be returned.
@@ -196,8 +187,7 @@ class Op : public RelayExpr {
    */
   TVM_DLL static const Op& Get(const String& op_name);
 
-  /*! \brief specify container node */
-  using ContainerType = OpNode;
+  TVM_DEFINE_OBJECT_REF_METHODS(Op, RelayExpr, OpNode)
 
  private:
   /*!
@@ -370,7 +360,6 @@ class OpAttrMap : public AttrRegistryMap<Op, ValueType> {
       ::tvm::OpRegEntry::RegisterOrGet(OpName).set_name()
 
 // implementations
-inline const OpNode* Op::operator->() const { return static_cast<const OpNode*>(get()); }
 
 template <typename ValueType>
 inline OpAttrMap<ValueType> Op::GetAttrMap(const String& key) {