Skip to content

Commit

Permalink
[CodeStyle][Ruff][BUAA][A-[5-6]] Fix ruff Q003 diagnostic for 2 fil…
Browse files Browse the repository at this point in the history
…es in `paddle/fluid/operators/generator/` (#67314)

* Add lerp CINN.

* update

* Refine lerp op CINN.

* Refine code.

* Refine code.

* Refine code.

* Refine A-5-6
  • Loading branch information
Marcusryz authored Aug 12, 2024
1 parent 7232797 commit 6664f02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion paddle/fluid/operators/generator/generate_op.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def process_invoke_op(forward_op_dict, backward_op_dict):
for attr in reuse_op['attrs']:
if args_index < len(args_list):
attr_value = (
f"this->GetAttr(\"{args_list[args_index]}\")"
f'this->GetAttr("{args_list[args_index]}")'
if args_list[args_index] in bw_fluid_attrs_set
else args_list[args_index]
)
Expand Down
10 changes: 5 additions & 5 deletions paddle/fluid/operators/generator/ops_extra_info_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ def get_op_name(api_item):
for attr in extra_args_map['attrs']:
attr_type, attr_name, default_val = parse_attr(attr)
attr_checker_func_list.append(
f"[](framework::AttributeMap* attr_map, bool only_check_exist_value)-> void {{ ExtraAttrChecker<{attr_type}>(\"{attr_name}\", {default_val})(attr_map, only_check_exist_value);}}"
f'[](framework::AttributeMap* attr_map, bool only_check_exist_value)-> void {{ ExtraAttrChecker<{attr_type}>("{attr_name}", {default_val})(attr_map, only_check_exist_value);}}'
)
if attr_type.startswith("std::vector"):
attr_map_list.append(
f"{{\"{attr_name}\", {attr_type}{default_val}}}"
f'{{"{attr_name}", {attr_type}{default_val}}}'
)
else:
attr_map_list.append(
f"{{\"{attr_name}\", {attr_type}{{{default_val}}}}}"
f'{{"{attr_name}", {attr_type}{{{default_val}}}}}'
)
api_extra_attr_map = ", ".join(attr_map_list)
api_extra_attr_checkers = ",\n ".join(
Expand All @@ -119,10 +119,10 @@ def get_op_name(api_item):
for bw_item in op_compat_args['backward'].split(','):
bw_op_name = get_op_name(bw_item)
extra_map_str_list.append(
f"{{\"{bw_op_name}\", {{ {api_extra_attr_map} }}}}"
f'{{"{bw_op_name}", {{ {api_extra_attr_map} }}}}'
)
extra_checker_str_list.append(
f"{{\"{bw_op_name}\", {{ {api_extra_attr_checkers} }}}}"
f'{{"{bw_op_name}", {{ {api_extra_attr_checkers} }}}}'
)

ops_extra_info_file = open(ops_extra_info_path, 'w')
Expand Down

0 comments on commit 6664f02

Please sign in to comment.