MasterJH5574 commented on code in PR #18229:
URL: https://github.com/apache/tvm/pull/18229#discussion_r2303913698


##########
python/tvm/script/parser/ir/parser.py:
##########
@@ -49,21 +52,39 @@ def _visit_class_def(self: Parser, node: doc.ClassDef) -> 
None:
             fake_module = ModuleWithGlobalVars()
             self.var_table.add(node.name, fake_module)
 
-            # Step 1. Visit non-function stmts, including but not limited to
+            # Step 1: Check if this class inherits from BasePyModule
+            is_base_py_module = _check_base_py_module_inheritance(node)
+            if is_base_py_module:
+                print(
+                    f"✓ Class '{node.name}' inherits from BasePyModule - 
Python functions allowed"
+                )
+                # Store this information in the IRModule for later use
+                I.module_attrs({"base_py_module": True})
+                # Set the parser context to allow Python functions
+                self.set_class_context(node.name, True)
+            else:
+                print(
+                    f"ℹ Class '{node.name}' does not inherit from BasePyModule 
- "
+                    f"Python functions not allowed"
+                )

Review Comment:
   Are these prints intentional? It looks like they are debug prints that can 
be removed.



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