Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeStyle][UP034] remove (()) cases #52060

Merged
merged 11 commits into from
Mar 29, 2023
Merged

Conversation

Liyulingyue
Copy link
Contributor

@Liyulingyue Liyulingyue commented Mar 23, 2023

PR types

Others

PR changes

Others

Describe

#51729 case 17
ruff rules

UP034: 删除多层括号。提高代码可读性。

是否可以引入本 rule:✅ 可引入。
是否可引入自动修复:✅ 可引入。

@paddle-bot
Copy link

paddle-bot bot commented Mar 23, 2023

你的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.

SigureMo
SigureMo previously approved these changes Mar 24, 2023
Copy link
Member

@SigureMo SigureMo left a comment

Choose a reason for hiding this comment

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

UP034: 删除多层括号。提高代码可读性。

可以提及一点,(x) 会被初学者认为是一个拥有一个元素的 tuple,而实际上拥有一个元素的 tuple 需要写成 (x,),该 rule 可以避免该情况下写出的 bug

LGTM

@luotao1
Copy link
Contributor

luotao1 commented Mar 24, 2023

@Liyulingyue 卡住的CI需要rerun下

@luotao1
Copy link
Contributor

luotao1 commented Mar 25, 2023

CINN 流水线一直失败

2023-03-25 12:01:30 WITH_DLNNE:
2023-03-25 12:01:48 CMake Error at python/paddle/fluid/tests/unittests/CMakeLists.txt:1194 (set_tests_properties):
2023-03-25 12:01:48   set_tests_properties Can not find test to add properties to: test_slice
2023-03-25 12:01:48 
2023-03-25 12:01:48 
2023-03-25 12:01:48 -- test_dist_hapi_model

@SigureMo
Copy link
Member

CINN 流水线一直失败

我重新看了一遍,没有发现错误修复的 case

@Liyulingyue 可以麻烦重新 merge 下最新的 develop 试试吗

@SigureMo
Copy link
Member

我发现只要不修改 test_slice.py 就不会导致这个问题,奇怪,这条流水线还会看修改了哪个文件嘛?关键是这个 test_slice 也和 CINN 没关系啊,CINN 里只会对 test_slice_op 进行特判

@Liyulingyue 可以多测测定位下具体问题,如果定位不了可以暂时在 tool.ruff.per-file-ignores ignore 掉 test_slice.py,这个 PR 先改其他文件

@Liyulingyue
Copy link
Contributor Author

我发现只要不修改 test_slice.py 就不会导致这个问题,奇怪,这条流水线还会看修改了哪个文件嘛?关键是这个 test_slice 也和 CINN 没关系啊,CINN 里只会对 test_slice_op 进行特判

@Liyulingyue 可以多测测定位下具体问题,如果定位不了可以暂时在 tool.ruff.per-file-ignores ignore 掉 test_slice.py,这个 PR 先改其他文件

get it~

@SigureMo
Copy link
Member

get it~

这个 PR 还是直接合吧,我来 ignore,你可以之后新提一个 PR 来看看 test_slice.py 的问题

@PaddlePaddle PaddlePaddle locked and limited conversation to collaborators Mar 28, 2023
@PaddlePaddle PaddlePaddle unlocked this conversation Mar 28, 2023
@SigureMo
Copy link
Member

奇怪的问题,#52069 动了 dy2st 单测里的 test_slice 和 test_cast 两个文件结果 CINN 里这俩都报找不到

2023-03-28 18:31:09 copy prim xxx_tensor_operants.tmp to xxx_tensor_operants
2023-03-28 18:31:09 WITH_DLNNE:
2023-03-28 18:31:25 CMake Error at python/paddle/fluid/tests/unittests/CMakeLists.txt:1188 (set_tests_properties):
2023-03-28 18:31:25   set_tests_properties Can not find test to add properties to: test_cast
2023-03-28 18:31:25 
2023-03-28 18:31:25 
2023-03-28 18:31:25 CMake Error at python/paddle/fluid/tests/unittests/CMakeLists.txt:1188 (set_tests_properties):
2023-03-28 18:31:25   set_tests_properties Can not find test to add properties to: test_slice
2023-03-28 18:31:25

可是这里 set_tests_properties 不会遍历到 test_slice 呀,只会遍历到 test_slice_op

set(TEST_CINN_OPS
test_softmax_op
test_expand_v2_op
test_reduce_op
test_slice_op
test_stack_op
test_activation_op
test_full_like_op
test_index_select_op
test_fill_any_like_op
test_concat_op
test_top_k_v2_op
test_elementwise_add_op
test_elementwise_sub_op
test_elementwise_div_op
test_elementwise_mul_op
test_gather_nd_op
test_squeeze2_op
test_elementwise_pow_op
test_elementwise_max_op
test_transpose_op
test_reshape_op
test_mean_op
test_unsqueeze2_op
test_meshgrid_op
test_gather_op
test_cast_op
test_dropout_op)
foreach(TEST_CINN_OPS ${TEST_CINN_OPS})
if(WITH_CINN)
set_tests_properties(${TEST_CINN_OPS} PROPERTIES LABELS "RUN_TYPE=CINN")
endif()
endforeach()

@luotao1 luotao1 merged commit c069729 into PaddlePaddle:develop Mar 29, 2023
longranger2 pushed a commit to longranger2/Paddle that referenced this pull request Mar 30, 2023
* add up34

* modify var name in loop

* revert changes in test_slice

* Revert "modify var name in loop"

This reverts commit 6d748e3.

* temporarily ignore test_slice.py

* add comment

* empty commit, re-trigger all ci

* fix inc

---------

Co-authored-by: SigureMo <sigure.qaq@gmail.com>
jeff41404 pushed a commit that referenced this pull request Apr 4, 2023
* remove op.py

* [Zero-Dim] change Tensor.numpy() usage to other equivalent usage, avoid hack (#52197)

* [BugFix] fix compute error in fused_dropout_add (#52261)

* fix bg

* add utest

* add utest

* [CodeStyle][UP034] remove (()) cases (#52060)

* add up34

* modify var name in loop

* revert changes in test_slice

* Revert "modify var name in loop"

This reverts commit 6d748e3.

* temporarily ignore test_slice.py

* add comment

* empty commit, re-trigger all ci

* fix inc

---------

Co-authored-by: SigureMo <sigure.qaq@gmail.com>

* [AMP OP&Test] add unittest for log_softmax (#52264)

* Fix_Linux_[-Wterminate]warning (#52186)

* [CustomOP Inplace] Automap inplace dtype and shape, prepare for vector<Tensor> output (#52214)

* [CustomOP Inplace] Automap inplace dtype and shape, prepare for vector<Tensor> output

* delete dtype,shape func of multi_inplace op

* [CustomOP Inplace] Automap inplace dtype and shape, support vector<Tensor> output

* [CustomOP Inplace] Auto-generate python API for inplace vector<Tensor> output

* [AMP OP&Test] add float16 optest for reshape_op (#51678)

* [AMP OP&Test] add float16 optest for reshape_op

* add public_python_api

* [AMP OP&Test] Add fp16/bf16 to clip op (#52158)

* add fp16/bf16 to clip op

* fix as reviewed

* update test_clip_op.py

* update test_clip_op.py

* fix bug

* fix code style

* fix bug

* fix bug

---------

Co-authored-by: Zhou Wei <1183042833@qq.com>
Co-authored-by: ShenLiang <1422485404@qq.com>
Co-authored-by: 张春乔 <83450930+Liyulingyue@users.noreply.github.com>
Co-authored-by: SigureMo <sigure.qaq@gmail.com>
Co-authored-by: Ccc <52520497+juncaipeng@users.noreply.github.com>
Co-authored-by: Galaxy1458 <55453380+Galaxy1458@users.noreply.github.com>
Co-authored-by: HongyuJia <jiahongyu@baidu.com>
Co-authored-by: zhaoyingli <86812880+zhaoyinglia@users.noreply.github.com>
Co-authored-by: wuyefeilin <30919197+wuyefeilin@users.noreply.github.com>
@Liyulingyue Liyulingyue deleted the up34 branch April 6, 2023 13:45
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.

3 participants