Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
432d5327
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看板
提交
432d5327
编写于
7月 30, 2021
作者:
L
lelelelelez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix function-redefined 1
上级
6c09496a
变更
16
隐藏空白更改
内联
并排
Showing
16 changed file
with
19 addition
and
73 deletion
+19
-73
python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py
...paddle/fluid/contrib/slim/tests/test_quantization_pass.py
+1
-1
python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py
...d/tests/unittests/dygraph_to_static/test_for_enumerate.py
+2
-2
python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py
...n/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py
+1
-1
python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py
...e/fluid/tests/unittests/sequence/test_sequence_reverse.py
+1
-1
python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py
python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_conv_nn_grad.py
python/paddle/fluid/tests/unittests/test_conv_nn_grad.py
+1
-1
python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py
...paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py
+0
-20
python/paddle/fluid/tests/unittests/test_eye_op.py
python/paddle/fluid/tests/unittests/test_eye_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py
...id/tests/unittests/test_fleet_recompute_meta_optimizer.py
+0
-34
python/paddle/fluid/tests/unittests/test_gather_op.py
python/paddle/fluid/tests/unittests/test_gather_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_huber_loss_op.py
python/paddle/fluid/tests/unittests/test_huber_loss_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_onnx_export.py
python/paddle/fluid/tests/unittests/test_onnx_export.py
+1
-1
python/paddle/fluid/tests/unittests/test_random_seed.py
python/paddle/fluid/tests/unittests/test_random_seed.py
+3
-3
python/paddle/fluid/tests/unittests/test_scatter_nd_op.py
python/paddle/fluid/tests/unittests/test_scatter_nd_op.py
+1
-1
tools/codestyle/test_docstring_checker.py
tools/codestyle/test_docstring_checker.py
+1
-1
未找到文件。
python/paddle/fluid/contrib/slim/tests/test_quantization_pass.py
浏览文件 @
432d5327
...
...
@@ -678,7 +678,7 @@ class TestAddQuantDequantPass(unittest.TestCase):
self
.
residual_block_quant
(
quantizable_op_type
,
skip_pattern
=
'skip_quant'
,
for_ci
=
True
)
def
test_residual_block_skip_pattern
(
self
):
def
test_residual_block_skip_pattern
_1
(
self
):
quantizable_op_type
=
[
'elementwise_add'
,
'pool2d'
,
'mul'
,
'matmul'
]
self
.
residual_block_quant
(
quantizable_op_type
,
...
...
python/paddle/fluid/tests/unittests/dygraph_to_static/test_for_enumerate.py
浏览文件 @
432d5327
...
...
@@ -406,7 +406,7 @@ class TestForEnumerateVarNumpyWithBreak(TestForIterVarNumpy):
self
.
dygraph_func
=
for_enumerate_var_numpy_with_break
class
TestForEnumerateVarNumpyWith
Break
(
TestForIterVarNumpy
):
class
TestForEnumerateVarNumpyWith
Continue
(
TestForIterVarNumpy
):
def
set_test_func
(
self
):
self
.
dygraph_func
=
for_enumerate_var_numpy_with_continue
...
...
@@ -416,7 +416,7 @@ class TestForEnumerateVarNumpyWithStartAndBreak(TestForIterVarNumpy):
self
.
dygraph_func
=
for_enumerate_var_numpy_with_start_break
class
TestForEnumerateVarNumpyWithStartAnd
Break
(
TestForIterVarNumpy
):
class
TestForEnumerateVarNumpyWithStartAnd
Continue
(
TestForIterVarNumpy
):
def
set_test_func
(
self
):
self
.
dygraph_func
=
for_enumerate_var_numpy_with_start_continue
...
...
python/paddle/fluid/tests/unittests/npu/test_dropout_op_npu.py
浏览文件 @
432d5327
...
...
@@ -80,7 +80,7 @@ class TestDropoutOpInput1d(TestDropoutOp):
}
class
TestDropoutOpInput1d
(
TestDropoutOp
):
class
TestDropoutOpInput1d
_1
(
TestDropoutOp
):
# the input is 1-D
def
setUp
(
self
):
self
.
op_type
=
"dropout"
...
...
python/paddle/fluid/tests/unittests/sequence/test_sequence_reverse.py
浏览文件 @
432d5327
...
...
@@ -73,7 +73,7 @@ class TestSequenceReverse3(TestSequenceReverseBase):
self
.
lod
=
[
3
,
0
,
6
,
3
]
class
TestSequenceReverse
3
(
TestSequenceReverseBase
):
class
TestSequenceReverse
4
(
TestSequenceReverseBase
):
def
initParameters
(
self
):
self
.
size
=
(
12
,
10
)
self
.
lod
=
[
0
,
2
,
10
,
0
]
...
...
python/paddle/fluid/tests/unittests/test_conv2d_fusion_op.py
浏览文件 @
432d5327
...
...
@@ -167,7 +167,7 @@ class TestIdentityActivation(TestConv2DFusionOp):
self
.
activation
=
'identity'
class
TestIdentityActivation
(
TestConv2DFusionOp
):
class
TestIdentityActivation
1
(
TestConv2DFusionOp
):
def
init_activation
(
self
):
self
.
activation
=
'identity'
self
.
add_residual_data
=
False
...
...
python/paddle/fluid/tests/unittests/test_conv_nn_grad.py
浏览文件 @
432d5327
...
...
@@ -52,7 +52,7 @@ class TestConvDoubleGradCheck(unittest.TestCase):
self
.
func
(
p
)
class
TestConvDoubleGradCheck
(
unittest
.
TestCase
):
class
TestConvDoubleGradCheck
Test0
(
unittest
.
TestCase
):
@
prog_scope
()
def
func
(
self
,
place
):
shape
=
[
2
,
4
,
3
,
3
]
...
...
python/paddle/fluid/tests/unittests/test_dist_fleet_grad_clip.py
浏览文件 @
432d5327
...
...
@@ -50,26 +50,6 @@ class TestDistGeoClipByGlobalNorm(TestFleetBase):
self
.
_sync_mode
=
False
self
.
_grad_clip_mode
=
2
def
check_with_place
(
self
,
model_file
,
delta
=
1e-3
,
check_error_log
=
False
,
need_envs
=
{}):
required_envs
=
{
"PATH"
:
os
.
getenv
(
"PATH"
,
""
),
"PYTHONPATH"
:
os
.
getenv
(
"PYTHONPATH"
,
""
),
"LD_LIBRARY_PATH"
:
os
.
getenv
(
"LD_LIBRARY_PATH"
,
""
),
"FLAGS_rpc_deadline"
:
"5000"
,
# 5sec to fail fast
"http_proxy"
:
""
}
required_envs
.
update
(
need_envs
)
tr0_losses
,
tr1_losses
=
self
.
_run_cluster
(
model_file
,
required_envs
)
def
test_dist_train
(
self
):
self
.
check_with_place
(
"dist_fleet_ctr.py"
,
delta
=
1e-5
,
check_error_log
=
True
)
class
TestDistASyncClipByValue
(
TestFleetBase
):
def
_setup_config
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_eye_op.py
浏览文件 @
432d5327
...
...
@@ -149,10 +149,10 @@ class API_TestTensorEye(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
test_num_columns_type_check
)
def
test_num_columns_type_check
():
def
test_num_columns_type_check
1
():
paddle
.
eye
(
10
,
num_columns
=
10
,
dtype
=
"int8"
)
self
.
assertRaises
(
TypeError
,
test_num_columns_type_check
)
self
.
assertRaises
(
TypeError
,
test_num_columns_type_check
1
)
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/test_fleet_recompute_meta_optimizer.py
浏览文件 @
432d5327
...
...
@@ -77,40 +77,6 @@ class TestFleetRecomputeMetaOptimizer(TestFleetMetaOptimizer):
]
self
.
assertIn
(
'subprog'
,
''
.
join
(
outs
))
def
test_recompute_optimizer_backward
(
self
):
""" test recompute optimizer backward """
train_prog
,
startup_prog
=
fluid
.
Program
(),
fluid
.
Program
()
avg_cost
,
strategy
=
self
.
net
(
train_prog
,
startup_prog
)
self
.
set_strategy
(
strategy
,
'recompute'
)
opt
=
fluid
.
optimizer
.
MomentumOptimizer
(
learning_rate
=
0.001
,
momentum
=
0.9
)
opt
=
RecomputeOptimizer
(
opt
)
opt
.
user_defined_strategy
=
strategy
params_grads
=
opt
.
backward
(
avg_cost
,
startup_prog
)
outs
=
[
op
.
output
(
'Out'
)[
0
]
for
op
in
avg_cost
.
block
.
ops
if
op
.
type
==
'mul'
]
self
.
assertIn
(
'subprog'
,
''
.
join
(
outs
))
def
test_recompute_optimizer_backward
(
self
):
""" test recompute optimizer backward """
train_prog
,
startup_prog
=
fluid
.
Program
(),
fluid
.
Program
()
avg_cost
,
strategy
=
self
.
net
(
train_prog
,
startup_prog
)
self
.
set_strategy
(
strategy
,
'recompute'
)
opt
=
fluid
.
optimizer
.
MomentumOptimizer
(
learning_rate
=
0.001
,
momentum
=
0.9
)
opt
=
RecomputeOptimizer
(
opt
)
opt
.
user_defined_strategy
=
strategy
params_grads
=
opt
.
backward
(
avg_cost
,
startup_prog
)
outs
=
[
op
.
output
(
'Out'
)[
0
]
for
op
in
avg_cost
.
block
.
ops
if
op
.
type
==
'mul'
]
self
.
assertIn
(
'subprog'
,
''
.
join
(
outs
))
def
test_recompute_optimizer
(
self
):
train_prog
,
startup_prog
=
fluid
.
Program
(),
fluid
.
Program
()
avg_cost
,
strategy
=
self
.
net
(
train_prog
,
startup_prog
)
...
...
python/paddle/fluid/tests/unittests/test_gather_op.py
浏览文件 @
432d5327
...
...
@@ -275,10 +275,10 @@ class TestGathertError(unittest.TestCase):
self
.
assertRaises
(
TypeError
,
test_axis_dtype
)
def
test_axis_dtype
():
def
test_axis_dtype
1
():
paddle
.
gather
(
x
,
index
,
axis
=
axis
)
self
.
assertRaises
(
TypeError
,
test_axis_dtype
)
self
.
assertRaises
(
TypeError
,
test_axis_dtype
1
)
def
test_error2
(
self
):
with
fluid
.
program_guard
(
fluid
.
Program
(),
fluid
.
Program
()):
...
...
python/paddle/fluid/tests/unittests/test_huber_loss_op.py
浏览文件 @
432d5327
...
...
@@ -76,7 +76,7 @@ def TestHuberLossOp2(TestHuberLossOp):
return
(
6
,
6
)
def
TestHuberLossOp
2
(
TestHuberLossOp
):
def
TestHuberLossOp
3
(
TestHuberLossOp
):
def
set_shape
(
self
):
return
(
6
,
6
,
1
)
...
...
python/paddle/fluid/tests/unittests/test_meshgrid_op.py
浏览文件 @
432d5327
...
...
@@ -165,7 +165,7 @@ class TestMeshgridOp7(unittest.TestCase):
assert
np
.
array_equal
(
res_4
.
shape
,
[
100
,
200
])
class
TestMeshgridOp
7
(
unittest
.
TestCase
):
class
TestMeshgridOp
8
(
unittest
.
TestCase
):
def
test_api_with_dygraph_tuple_input
(
self
):
input_3
=
np
.
random
.
randint
(
0
,
100
,
[
100
,
]).
astype
(
'int32'
)
input_4
=
np
.
random
.
randint
(
0
,
100
,
[
200
,
]).
astype
(
'int32'
)
...
...
python/paddle/fluid/tests/unittests/test_onnx_export.py
浏览文件 @
432d5327
...
...
@@ -52,7 +52,7 @@ class TestExportWithTensor(unittest.TestCase):
paddle
.
onnx
.
export
(
model
,
'linear_net'
,
input_spec
=
[
self
.
x_spec
])
class
TestExportWithTensor
(
unittest
.
TestCase
):
class
TestExportWithTensor
1
(
unittest
.
TestCase
):
def
setUp
(
self
):
self
.
x
=
paddle
.
to_tensor
(
np
.
random
.
random
((
1
,
128
)))
...
...
python/paddle/fluid/tests/unittests/test_random_seed.py
浏览文件 @
432d5327
...
...
@@ -221,7 +221,7 @@ class TestGeneratorSeed(unittest.TestCase):
self
.
assertTrue
(
np
.
allclose
(
x1_np
,
x2_np
))
self
.
assertTrue
(
np
.
allclose
(
x_np
,
x3_np
))
def
test_generator_uniform_random_static
(
self
):
def
test_generator_uniform_random_static
_1
(
self
):
fluid
.
disable_dygraph
()
gen
=
paddle
.
seed
(
123123143
)
...
...
@@ -255,7 +255,7 @@ class TestGeneratorSeed(unittest.TestCase):
self
.
assertTrue
(
np
.
allclose
(
out1_res2
,
out2_res2
))
self
.
assertTrue
(
not
np
.
allclose
(
out1_res2
,
out1_res1
))
def
test_generator_randint_dygraph
(
self
):
def
test_generator_randint_dygraph
_1
(
self
):
"""Test Generator seed."""
fluid
.
enable_dygraph
()
...
...
@@ -405,7 +405,7 @@ class TestGeneratorSeed(unittest.TestCase):
self
.
assertTrue
(
np
.
allclose
(
x1_np
,
x2_np
))
self
.
assertTrue
(
np
.
allclose
(
x_np
,
x3_np
))
def
test_generator_randperm_static
(
self
):
def
test_generator_randperm_static
_1
(
self
):
fluid
.
disable_dygraph
()
...
...
python/paddle/fluid/tests/unittests/test_scatter_nd_op.py
浏览文件 @
432d5327
...
...
@@ -294,7 +294,7 @@ class TestDygraph(unittest.TestCase):
shape
=
[
3
,
5
,
9
,
10
]
output
=
paddle
.
scatter_nd
(
index
,
updates
,
shape
)
def
test_dygraph
(
self
):
def
test_dygraph
_1
(
self
):
with
fluid
.
dygraph
.
guard
(
fluid
.
CPUPlace
()):
x
=
paddle
.
rand
(
shape
=
[
3
,
5
,
9
,
10
],
dtype
=
'float32'
)
updates
=
paddle
.
rand
(
shape
=
[
3
,
9
,
10
],
dtype
=
'float32'
)
...
...
tools/codestyle/test_docstring_checker.py
浏览文件 @
432d5327
...
...
@@ -38,7 +38,7 @@ class TestDocstring(pylint.testutils.CheckerTestCase):
assert
len
(
got
)
==
1
assert
'W9001'
==
got
[
0
][
0
]
def
test_one_line
(
self
):
def
test_one_line
_1
(
self
):
func_node
=
astroid
.
extract_node
(
'''
def test():
"""get news"""
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录