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

mshr 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 41cac2e083 [Relax] Add test case for op attributes in AST printer 
(#18618)
41cac2e083 is described below

commit 41cac2e08313430d888e2911214b8c58e9338f2a
Author: Guan-Ming (Wesley) Chiu <[email protected]>
AuthorDate: Sun Dec 28 22:15:08 2025 +0800

    [Relax] Add test case for op attributes in AST printer (#18618)
    
    ## Why
    
    Resolve todo in `tests/python/relax/test_ast_printer.py`
    
    ## How
    
    - Added a new test function `test_op_attrs` in
    `tests/python/relax/test_ast_printer.py`.
    - Removed the TODO comment.
    
    ---------
    
    Co-authored-by: gemini-code-assist[bot] 
<176961590+gemini-code-assist[bot]@users.noreply.github.com>
---
 tests/python/relax/test_ast_printer.py | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/tests/python/relax/test_ast_printer.py 
b/tests/python/relax/test_ast_printer.py
index 6a65b1b751..96ebbfc2ef 100644
--- a/tests/python/relax/test_ast_printer.py
+++ b/tests/python/relax/test_ast_printer.py
@@ -414,7 +414,23 @@ def test_call_packed():
         op_call_text,
     )
 
-    # TODO: add testcase for op attrs
+
+def test_op_attrs():
+    x = rx.Var("x", R.Tensor((10,), "float32"))
+    # Manually create a Call with attributes to test printer support for Op 
attributes
+    op = tvm.ir.Op.get("relax.add")
+    attrs = tvm.ir.make_node("ir.DictAttrs", my_attr="my_value")
+    call_node = rx.Call(op, [x, x], attrs=attrs)
+
+    call_str = dump_ast(call_node, include_call_attrs=True)
+    assert_fields(
+        "Call",
+        {
+            "op": 'Op(name="relax.add")',
+            "attrs": '{"my_attr": "my_value"}',
+        },
+        call_str,
+    )
 
 
 def test_call_tir():

Reply via email to