Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f82da79c
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2298
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看板
未验证
提交
f82da79c
编写于
3月 21, 2023
作者:
A
Ainavo
提交者:
GitHub
3月 21, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[CodeStyle][C400] replace unnecessary generator list (#51839)
上级
f3ef748a
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
20 addition
and
20 deletion
+20
-20
python/paddle/distributed/auto_parallel/operators/dist_pnorm.py
.../paddle/distributed/auto_parallel/operators/dist_pnorm.py
+1
-1
python/paddle/distributed/auto_parallel/reshard.py
python/paddle/distributed/auto_parallel/reshard.py
+2
-2
python/paddle/distributed/auto_parallel/tuner/recorder.py
python/paddle/distributed/auto_parallel/tuner/recorder.py
+1
-1
python/paddle/distributed/fleet/recompute/recompute.py
python/paddle/distributed/fleet/recompute/recompute.py
+2
-2
python/paddle/fluid/tests/unittests/autograd/utils.py
python/paddle/fluid/tests/unittests/autograd/utils.py
+4
-4
python/paddle/fluid/tests/unittests/test_conv2d_layer.py
python/paddle/fluid/tests/unittests/test_conv2d_layer.py
+1
-1
python/paddle/nn/layer/conv.py
python/paddle/nn/layer/conv.py
+1
-1
python/paddle/tensor/manipulation.py
python/paddle/tensor/manipulation.py
+7
-7
python/paddle/tensor/math.py
python/paddle/tensor/math.py
+1
-1
未找到文件。
python/paddle/distributed/auto_parallel/operators/dist_pnorm.py
浏览文件 @
f82da79c
...
...
@@ -364,7 +364,7 @@ class DistributedPNormImpl0(DistributedOperatorImpl):
slice_ends
.
append
(
item
[
1
])
slices_axes
.
append
(
idx
)
infer_flags
=
list
(
1
for
i
in
range
(
len
(
slices_axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
slices_axes
))]
attrs
=
{
"axes"
:
slices_axes
,
"starts"
:
slice_starts
,
...
...
python/paddle/distributed/auto_parallel/reshard.py
浏览文件 @
f82da79c
...
...
@@ -507,7 +507,7 @@ class Inserter:
# use slice
else
:
inputs
=
{
'Input'
:
tensor
}
infer_flags
=
list
(
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
axes
))]
attrs
=
{
"axes"
:
axes
,
"starts"
:
starts
,
...
...
@@ -2944,7 +2944,7 @@ class Resharder:
to_slice_tensor_shape
=
op_desc
.
shape
slice_desc
=
{}
slice_desc
[
"op"
]
=
"slice"
infer_flags
=
list
(
1
for
i
in
range
(
len
(
op_desc
.
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
op_desc
.
axes
))]
slice_desc
[
"attrs"
]
=
{
"axes"
:
op_desc
.
axes
,
"starts"
:
op_desc
.
starts
,
...
...
python/paddle/distributed/auto_parallel/tuner/recorder.py
浏览文件 @
f82da79c
...
...
@@ -101,7 +101,7 @@ class MetricRecords:
self
.
_records
[
step
]
=
MetricRecord
(
value
,
step
=
step
)
def
get_best_value
(
self
):
values
=
list
(
r
.
mean
()
for
r
in
self
.
_records
.
values
())
values
=
[
r
.
mean
()
for
r
in
self
.
_records
.
values
()]
if
not
values
:
return
None
if
self
.
_direction
==
"min"
:
...
...
python/paddle/distributed/fleet/recompute/recompute.py
浏览文件 @
f82da79c
...
...
@@ -209,11 +209,11 @@ class RecomputeFunction(PyLayer):
if
isinstance
(
inp
,
(
core
.
VarBase
,
core
.
eager
.
Tensor
))
)
else
:
grads
=
list
(
grads
=
[
inp
.
_grad_ivar
()
for
inp
in
detached_inputs
if
isinstance
(
inp
,
(
core
.
VarBase
,
core
.
eager
.
Tensor
))
)
]
return
grads
...
...
python/paddle/fluid/tests/unittests/autograd/utils.py
浏览文件 @
f82da79c
...
...
@@ -60,9 +60,9 @@ def _compute_numerical_jacobian(func, xs, delta, np_dtype):
ys
=
list
(
as_tensors
(
func
(
*
xs
)))
fin_size
=
len
(
xs
)
fout_size
=
len
(
ys
)
jacobian
=
list
([]
for
_
in
range
(
fout_size
))
jacobian
=
[[]
for
_
in
range
(
fout_size
)]
for
i
in
range
(
fout_size
):
jac_i
=
list
([]
for
_
in
range
(
fin_size
))
jac_i
=
[[]
for
_
in
range
(
fin_size
)]
for
j
in
range
(
fin_size
):
jac_i
[
j
]
=
np
.
zeros
(
(
_product
(
ys
[
i
].
shape
),
_product
(
xs
[
j
].
shape
)),
dtype
=
np_dtype
...
...
@@ -94,9 +94,9 @@ def _compute_numerical_hessian(func, xs, delta, np_dtype):
xs
=
list
(
as_tensors
(
xs
))
ys
=
list
(
as_tensors
(
func
(
*
xs
)))
fin_size
=
len
(
xs
)
hessian
=
list
([]
for
_
in
range
(
fin_size
))
hessian
=
[[]
for
_
in
range
(
fin_size
)]
for
i
in
range
(
fin_size
):
hessian_i
=
list
([]
for
_
in
range
(
fin_size
))
hessian_i
=
[[]
for
_
in
range
(
fin_size
)]
for
j
in
range
(
fin_size
):
hessian_i
[
j
]
=
np
.
zeros
(
(
_product
(
xs
[
i
].
shape
),
_product
(
xs
[
j
].
shape
)),
dtype
=
np_dtype
...
...
python/paddle/fluid/tests/unittests/test_conv2d_layer.py
浏览文件 @
f82da79c
...
...
@@ -23,7 +23,7 @@ from paddle import fluid, nn
def
_reverse_repeat_list
(
t
,
n
):
return
list
(
x
for
x
in
reversed
(
t
)
for
_
in
range
(
n
))
return
[
x
for
x
in
reversed
(
t
)
for
_
in
range
(
n
)]
class
Conv2DTestCase
(
unittest
.
TestCase
):
...
...
python/paddle/nn/layer/conv.py
浏览文件 @
f82da79c
...
...
@@ -43,7 +43,7 @@ def _reverse_repeat_list(t, n):
This can be used to translate padding arg used by Conv and Pooling modules
to the ones used by `F.pad`.
"""
return
list
(
x
for
x
in
reversed
(
t
)
for
_
in
range
(
n
))
return
[
x
for
x
in
reversed
(
t
)
for
_
in
range
(
n
)]
class
_ConvNd
(
Layer
):
...
...
python/paddle/tensor/manipulation.py
浏览文件 @
f82da79c
...
...
@@ -324,7 +324,7 @@ def slice(input, axes, starts, ends):
)
)
infer_flags
=
list
(
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
axes
))]
tmp_tensor_type
=
core
.
eager
.
Tensor
...
...
@@ -336,7 +336,7 @@ def slice(input, axes, starts, ends):
elif
isinstance
(
starts
,
tmp_tensor_type
):
tensor_t
=
starts
.
numpy
()
starts
=
[
ele
for
ele
in
tensor_t
]
infer_flags
=
list
(
-
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
-
1
for
i
in
range
(
len
(
axes
))]
if
isinstance
(
ends
,
(
list
,
tuple
)):
ends
=
[
...
...
@@ -346,7 +346,7 @@ def slice(input, axes, starts, ends):
elif
isinstance
(
ends
,
tmp_tensor_type
):
tensor_t
=
ends
.
numpy
()
ends
=
[
ele
for
ele
in
tensor_t
]
infer_flags
=
list
(
-
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
-
1
for
i
in
range
(
len
(
axes
))]
return
_C_ops
.
slice
(
input
,
axes
,
starts
,
ends
,
infer_flags
,
[])
else
:
...
...
@@ -363,13 +363,13 @@ def slice(input, axes, starts, ends):
inputs
=
{
'Input'
:
input
}
attrs
=
{
'axes'
:
axes
}
infer_flags
=
list
(
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
axes
))]
# starts
if
isinstance
(
starts
,
Variable
):
starts
.
stop_gradient
=
True
inputs
[
'StartsTensor'
]
=
starts
infer_flags
=
list
(
-
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
-
1
for
i
in
range
(
len
(
axes
))]
elif
isinstance
(
starts
,
(
list
,
tuple
)):
attrs
[
'starts'
]
=
[]
if
paddle
.
utils
.
_contain_var
(
starts
):
...
...
@@ -389,7 +389,7 @@ def slice(input, axes, starts, ends):
if
isinstance
(
ends
,
Variable
):
ends
.
stop_gradient
=
True
inputs
[
'EndsTensor'
]
=
ends
infer_flags
=
list
(
-
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
-
1
for
i
in
range
(
len
(
axes
))]
elif
isinstance
(
ends
,
(
list
,
tuple
)):
attrs
[
'ends'
]
=
[]
if
paddle
.
utils
.
_contain_var
(
ends
):
...
...
@@ -3899,7 +3899,7 @@ def strided_slice(x, axes, starts, ends, strides, name=None):
inputs
=
{
'Input'
:
x
}
attrs
=
{
'axes'
:
axes
}
infer_flags
=
list
(
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
axes
))]
# starts
if
isinstance
(
starts
,
Variable
):
starts
.
stop_gradient
=
True
...
...
python/paddle/tensor/math.py
浏览文件 @
f82da79c
...
...
@@ -4662,7 +4662,7 @@ def diff(x, n=1, axis=-1, prepend=None, append=None, name=None):
axis
=
0
dtype
=
x
.
dtype
axes
=
[
axis
]
infer_flags
=
list
(
1
for
i
in
range
(
len
(
axes
)))
infer_flags
=
[
1
for
i
in
range
(
len
(
axes
))]
if
in_dygraph_mode
():
has_pend
=
False
input_list
=
[]
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录