Skip to content

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Nov 14, 2022

PR types

Others

PR changes

Others

Describe

本 PR 消除剩余全部 21 个 Flake8 F821 错误码(undefined variables)

本 PR 含配置修改,无需额外修改配置

Related links

@paddle-bot
Copy link

paddle-bot bot commented Nov 14, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Nov 14, 2022
@SigureMo SigureMo changed the title [CodeStyle][F821] fix remained F821 issues [WIP][CodeStyle][F821] fix remained F821 issues Nov 14, 2022
@@ -59,7 +59,7 @@ def _get_item(t, i, np_dtype):
raise ValueError("Not supported data type " + str(np_dtype))


def _set_item(t, i, e, np_dtype):
def _set_item(t, i, e, np_dtype, place):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

69 行使用了 place 但没有传递进来,因此这里加一下 place

@@ -100,9 +100,9 @@ def calc_cost(self):

if dtype == paddle.float32 or dtype == paddle.int32:
dtype_factor = 4
elif node.dtype == paddle.int64:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和第一个 if 一样,这里应该就是 dtype,不需要 node.dtype

@@ -299,6 +299,8 @@ def vlist_of_dict(x):
print(paddle.jit.to_static(vlist_of_dict)(x))

def test4(self):
import numpy as np
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否 import 不影响测试效果,因为 test2、3 也加了,所以这里就加上了

# Ignore undefined variables in CMake config and some dygraph_to_static tests
.cmake-format.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_loop.py: F821
python/paddle/fluid/tests/unittests/dygraph_to_static/test_closure_analysis.py: F821
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.cmake-format.py 配置里的 section 确实不存在,所以可以 ignore 掉

部分动转静单测需要测试的一些用例存在 F821 问题,所以也可以在这里直接 ignore 掉

@SigureMo SigureMo changed the title [WIP][CodeStyle][F821] fix remained F821 issues [WIP][CodeStyle][F821] fix remaining F821 issues Nov 14, 2022
@SigureMo SigureMo changed the title [WIP][CodeStyle][F821] fix remaining F821 issues [CodeStyle][F821] fix remaining F821 issues Nov 14, 2022
@luotao1 luotao1 self-assigned this Nov 15, 2022
@luotao1 luotao1 merged commit 4e09b08 into PaddlePaddle:develop Nov 15, 2022
@SigureMo SigureMo deleted the F821/fix/remained-issues branch November 15, 2022 06:10
SigureMo added a commit to gouzil/Paddle that referenced this pull request Jun 29, 2024
SigureMo added a commit to gouzil/Paddle that referenced this pull request Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[F821] undefined name name
2 participants