Skip to content

Commit

Permalink
[CodeStyle][Ruff][BUAA][A-[1-4]] Fix ruff Q003 diagnostic for 4 fil…
Browse files Browse the repository at this point in the history
…es in `paddle/fluid/eager/auto_code_generator/` (PaddlePaddle#67300)

* Add lerp CINN.

* update

* Refine lerp op CINN.

* Refine code.

* Refine code.

* Refine code.

* Refine A-1-4

* Apply suggestions from code review

---------

Co-authored-by: Nyakku Shigure <[email protected]>
  • Loading branch information
2 people authored and Jeff114514 committed Aug 14, 2024
1 parent 702272a commit c6c78cf
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 63 deletions.
22 changes: 11 additions & 11 deletions paddle/fluid/eager/auto_code_generator/generate_file_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def GenerateFileStructureForIntermediateDygraph(eager_dir, split_count):
f.write("add_custom_target(\n")
f.write(" copy_dygraph_node\n")
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes.tmp.h\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes.h\"\n"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes.tmp.h" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes.h"\n'
)
for i in range(split_count):
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes'
+ str(i + 1)
+ ".tmp.cc\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes"
+ '.tmp.cc" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/nodes/nodes'
+ str(i + 1)
+ ".cc\"\n"
+ '.cc"\n'
)

f.write(" DEPENDS legacy_eager_codegen\n")
Expand All @@ -151,24 +151,24 @@ def GenerateFileStructureForIntermediateDygraph(eager_dir, split_count):
f.write("add_custom_target(\n")
f.write(" copy_dygraph_forward_functions\n")
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/dygraph_forward_api.tmp.h\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/dygraph_forward_api.h\"\n"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/dygraph_forward_api.tmp.h" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/dygraph_forward_api.h"\n'
)
for i in range(split_count):
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions'
+ str(i + 1)
+ ".tmp.cc\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions"
+ '.tmp.cc" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions'
+ str(i + 1)
+ ".cc\"\n"
+ '.cc"\n'
)
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_info.tmp.cc\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_info.cc\"\n"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_info.tmp.cc" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_info.cc"\n'
)
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_type_info.tmp.cc\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_type_info.cc\"\n"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_type_info.tmp.cc" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_args_type_info.cc"\n'
)
f.write(
" COMMAND ${CMAKE_COMMAND} -E copy_if_different \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_returns_info.tmp.cc\" \"${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_returns_info.cc\"\n"
' COMMAND ${CMAKE_COMMAND} -E copy_if_different "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_returns_info.tmp.cc" "${PADDLE_SOURCE_DIR}/paddle/fluid/eager/api/generated/fluid_generated/forwards/dygraph_forward_functions_returns_info.cc"\n'
)
f.write(" DEPENDS legacy_eager_codegen\n")
f.write(" VERBATIM)\n")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -549,13 +549,13 @@ def CollectOriginalForwardInfo(self):

assert (
'op' in forward_api_contents.keys()
), "Unable to find \"op\" in forward_api_contents keys"
), 'Unable to find "op" in forward_api_contents keys'
assert (
'args' in forward_api_contents.keys()
), "Unable to find \"args\" in forward_api_contents keys"
), 'Unable to find "args" in forward_api_contents keys'
assert (
'output' in forward_api_contents.keys()
), "Unable to find \"output\" in forward_api_contents keys"
), 'Unable to find "output" in forward_api_contents keys'

# Collect Original Forward Inputs/Outputs and then perform validation checks
(
Expand Down
Loading

0 comments on commit c6c78cf

Please sign in to comment.