gemini-code-assist[bot] commented on code in PR #18618:
URL: https://github.com/apache/tvm/pull/18618#discussion_r2648877469
##########
tests/python/relax/test_ast_printer.py:
##########
@@ -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)
Review Comment:

The `relax.Call` constructor can directly accept a dictionary for the
`attrs` argument. The TVM FFI layer will automatically convert it to
`tvm.ir.DictAttrs`. This simplifies the code and makes it more idiomatic, as
seen in other parts of the codebase like `ExprWithOp.__call__`.
```suggestion
call_node = rx.Call(op, [x, x], attrs={"my_attr": "my_value"})
```
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]