altanh commented on a change in pull request #8079:
URL: https://github.com/apache/tvm/pull/8079#discussion_r638235413



##########
File path: python/tvm/relay/op/op.py
##########
@@ -40,6 +40,42 @@ def get(op_name):
     return tvm.ir.Op.get(op_name)
 
 
+def register(op_name, describe=""):

Review comment:
       so when the op_name is not registered, this will create a new (empty?) 
op with the given name? perhaps update the documentation to mention this

##########
File path: include/tvm/ir/op.h
##########
@@ -250,6 +250,12 @@ class OpRegEntry {
    */
   template <typename AttrsType>
   inline OpRegEntry& set_attrs_type();
+  /*!
+   * \brief Set the the attrs type key and index to be AttrsType.

Review comment:
       ```suggestion
      * \brief Set the attrs type key and index to be AttrsType.
   ```

##########
File path: python/tvm/ir/op.py
##########
@@ -85,17 +85,76 @@ def reset_attr(self, attr_name):
         """
         _ffi_api.OpResetAttr(self, attr_name)
 
+    def add_type_rel(self, rel_name, type_rel_func=None):
+        """Attach the type function corresponding to the return type.
 
-def register_op(op_name):
+        Parameters
+        ----------
+        rel_name : str
+            The type relation name to register.
+
+        type_rel_func: function (args: List[Type], num_inputs:int, attrs: 
Attrs) -> Type
+            The backing relation function which can solve an arbitrary 
relation on variables.
+        """
+        _ffi_api.OpAddTypeRel(self, rel_name, type_rel_func)
+
+    def add_argument(self, name, type, description):  # pylint: 
disable=redefined-builtin
+        """Add arguments information to the function.
+
+        Parameters
+        ----------
+        name : str
+            The argument name.
+        type : str
+            The argument type.
+        description : str
+            The argument description.
+        """
+        _ffi_api.OpAddArgument(self, name, type, description)
+
+    def set_support_level(self, level):
+        """Set the support level of op.
+
+        Parameters
+        ----------
+        level : int
+            The support level.
+        """
+        _ffi_api.OpSetSupportLevel(self, level)
+
+    def set_num_inputs(self, n):
+        """Set the support level of op.
+
+        Parameters
+        ----------
+        n : int
+            The input number.
+        """
+        _ffi_api.OpSetNumInputs(self, n)
+
+    def set_attrs_type_key(self, key):
+        """Set the attribute type key of op.
+
+        Parameters
+        ----------
+        key : str
+            The type key.
+        """
+        _ffi_api.OpSetAttrsTypeKey(self, key)
+
+
+def register_op(op_name, describe=""):

Review comment:
       if `op_name` is registered, does this return the registered op? If so, 
update documentation




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


Reply via email to