Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
85e20755
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
85e20755
编写于
3月 25, 2023
作者:
张
张春乔
提交者:
GitHub
3月 25, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][UP028] using yield from (#52059)
上级
33b289d7
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
17 addition
and
33 deletion
+17
-33
pyproject.toml
pyproject.toml
+1
-1
python/paddle/dataset/imdb.py
python/paddle/dataset/imdb.py
+1
-2
python/paddle/distributed/fleet/data_generator/data_generator.py
...paddle/distributed/fleet/data_generator/data_generator.py
+1
-2
python/paddle/fluid/tests/unittests/dist_text_classification.py
.../paddle/fluid/tests/unittests/dist_text_classification.py
+1
-2
python/paddle/fluid/tests/unittests/feed_data_reader.py
python/paddle/fluid/tests/unittests/feed_data_reader.py
+1
-2
python/paddle/fluid/tests/unittests/test_imperative_decorator.py
...paddle/fluid/tests/unittests/test_imperative_decorator.py
+6
-12
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
...uid/tests/unittests/test_parallel_executor_transformer.py
+1
-2
python/paddle/nn/layer/layers.py
python/paddle/nn/layer/layers.py
+1
-2
python/paddle/reader/decorator.py
python/paddle/reader/decorator.py
+3
-6
python/paddle/utils/layers_utils.py
python/paddle/utils/layers_utils.py
+1
-2
未找到文件。
pyproject.toml
浏览文件 @
85e20755
...
...
@@ -70,7 +70,7 @@ select = [
"UP025"
,
"UP026"
,
# "UP027",
#
"UP028",
"UP028"
,
"UP029"
,
# "UP030",
# "UP031",
...
...
python/paddle/dataset/imdb.py
浏览文件 @
85e20755
...
...
@@ -93,8 +93,7 @@ def reader_creator(pos_pattern, neg_pattern, word_idx):
load
(
neg_pattern
,
INS
,
1
)
def
reader
():
for
doc
,
label
in
INS
:
yield
doc
,
label
yield
from
INS
return
reader
...
...
python/paddle/distributed/fleet/data_generator/data_generator.py
浏览文件 @
85e20755
...
...
@@ -228,8 +228,7 @@ class DataGenerator:
'''
def
local_iter
():
for
sample
in
samples
:
yield
sample
yield
from
samples
return
local_iter
...
...
python/paddle/fluid/tests/unittests/dist_text_classification.py
浏览文件 @
85e20755
...
...
@@ -192,8 +192,7 @@ def reader_creator(pos_pattern, neg_pattern, word_idx):
load
(
neg_pattern
,
INS
,
1
)
def
reader
():
for
doc
,
label
in
INS
:
yield
doc
,
label
yield
from
INS
return
reader
...
...
python/paddle/fluid/tests/unittests/feed_data_reader.py
浏览文件 @
85e20755
...
...
@@ -19,8 +19,7 @@ from paddle.fluid.framework import Variable
def
cyclic_reader
(
reader
):
def
__reader__
():
while
True
:
for
data
in
reader
():
yield
data
yield
from
reader
()
return
__reader__
...
...
python/paddle/fluid/tests/unittests/test_imperative_decorator.py
浏览文件 @
85e20755
...
...
@@ -105,8 +105,7 @@ class TestNoGradClass(unittest.TestCase):
)
def
test_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
a
=
0
for
i
in
test_gen
():
...
...
@@ -114,8 +113,7 @@ class TestNoGradClass(unittest.TestCase):
@
paddle
.
no_grad
()
def
test_wrapped_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
b
=
0
for
i
in
test_wrapped_gen
():
...
...
@@ -151,8 +149,7 @@ class TestEnableGradClass(unittest.TestCase):
)
def
test_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
a
=
0
for
i
in
test_gen
():
...
...
@@ -160,8 +157,7 @@ class TestEnableGradClass(unittest.TestCase):
@
paddle
.
enable_grad
()
def
test_wrapped_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
b
=
0
for
i
in
test_wrapped_gen
():
...
...
@@ -215,8 +211,7 @@ class TestSetGradEnabledClass(unittest.TestCase):
)
def
test_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
a
=
0
for
i
in
test_gen
():
...
...
@@ -224,8 +219,7 @@ class TestSetGradEnabledClass(unittest.TestCase):
@
paddle
.
set_grad_enabled
(
True
)
def
test_wrapped_gen
():
for
i
in
range
(
3
):
yield
i
yield
from
range
(
3
)
b
=
0
for
i
in
test_wrapped_gen
():
...
...
python/paddle/fluid/tests/unittests/test_parallel_executor_transformer.py
浏览文件 @
85e20755
...
...
@@ -212,8 +212,7 @@ def get_feed_data_reader():
all_batch_tensors
.
append
(
tensors
)
def
__reader__
():
for
t
in
all_batch_tensors
:
yield
t
yield
from
all_batch_tensors
feed_data_reader
=
FeedDataReader
(
feed_list
=
transformer_model
.
build_inputs
(
...
...
python/paddle/nn/layer/layers.py
浏览文件 @
85e20755
...
...
@@ -206,8 +206,7 @@ class LayerObjectHelper(LayerHelperBase):
inputs
=
inputs_in
if
(
inputs_in
is
not
None
)
else
[]
inputs
=
self
.
_multiple_input
(
inputs
)
param_attrs
=
self
.
_multiple_param_attr
(
len
(
inputs
),
param_attr_in
)
for
ipt
,
param_attr
in
zip
(
inputs
,
param_attrs
):
yield
ipt
,
param_attr
yield
from
zip
(
inputs
,
param_attrs
)
def
input_dtype
(
self
,
inputs_in
):
"""Get input data type
...
...
python/paddle/reader/decorator.py
浏览文件 @
85e20755
...
...
@@ -76,8 +76,7 @@ def cache(reader):
all_data
=
tuple
(
reader
())
def
__impl__
():
for
item
in
all_data
:
yield
item
yield
from
all_data
return
__impl__
...
...
@@ -118,8 +117,7 @@ def map_readers(func, *readers):
rs
=
[]
for
r
in
readers
:
rs
.
append
(
r
())
for
e
in
map
(
func
,
*
rs
):
yield
e
yield
from
map
(
func
,
*
rs
)
return
reader
...
...
@@ -228,8 +226,7 @@ def chain(*readers):
for
r
in
readers
:
rs
.
append
(
r
())
for
e
in
itertools
.
chain
(
*
rs
):
yield
e
yield
from
itertools
.
chain
(
*
rs
)
return
reader
...
...
python/paddle/utils/layers_utils.py
浏览文件 @
85e20755
...
...
@@ -152,8 +152,7 @@ def _yield_value(iterable):
for
key
in
_sorted
(
iterable
):
yield
iterable
[
key
]
else
:
for
value
in
iterable
:
yield
value
yield
from
iterable
def
_yield_flat_nest
(
nest
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录