gemini-code-assist[bot] commented on code in PR #18664:
URL: https://github.com/apache/tvm/pull/18664#discussion_r2696849285
##########
src/relax/transform/legalize_ops.cc:
##########
@@ -287,8 +287,15 @@ class LegalizeMutator : public ExprMutator {
return false;
}
- std::string op_name(op->name);
- bool is_data_dependent_op = (op_name.find("dynamic") !=
std::string::npos);
+ bool is_data_dependent_op = [&]() -> bool {
+ if (Op::HasAttrMap("FDataDependent")) {
+ auto op_map = Op::GetAttrMap<Bool>("FDataDependent");
+ if (op_map.count(op)) {
+ return op_map[op]->value;
+ }
+ }
+ return false;
+ }();
Review Comment:

This immediately-invoked lambda expression can be simplified to a more
concise and idiomatic one-liner using `Op::GetAttrMap` and the `.get()` method
with a default value. This will improve readability.
```c
bool is_data_dependent_op =
Op::GetAttrMap<Bool>("FDataDependent").get(op, Bool(false))->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]