Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion tests/python/relax/test_ast_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,23 @@ def f(
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():
Expand Down
Loading