Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
机器未来
Paddle
提交
cf15da65
P
Paddle
项目概览
机器未来
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
cf15da65
编写于
4月 21, 2019
作者:
S
sneaxiy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move gc test to op_test
test=develop
上级
45ebafc3
变更
30
显示空白变更内容
内联
并排
Showing
30 changed file
with
92 addition
and
51 deletion
+92
-51
python/paddle/fluid/tests/unittests/op_test.py
python/paddle/fluid/tests/unittests/op_test.py
+54
-0
python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py
...n/paddle/fluid/tests/unittests/test_bilinear_interp_op.py
+2
-0
python/paddle/fluid/tests/unittests/test_concat_op.py
python/paddle/fluid/tests/unittests/test_concat_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py
...ests/test_eager_deletion_no_need_buffer_vars_inference.py
+0
-51
python/paddle/fluid/tests/unittests/test_elementwise_add_op.py
...n/paddle/fluid/tests/unittests/test_elementwise_add_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py
...n/paddle/fluid/tests/unittests/test_elementwise_sub_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py
.../tests/unittests/test_fill_constant_batch_size_like_op.py
+3
-0
python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
.../paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_gather_op.py
python/paddle/fluid/tests/unittests/test_gather_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py
...ests/unittests/test_gaussian_random_batch_size_like_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py
.../paddle/fluid/tests/unittests/test_linear_chain_crf_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_lod_reset_op.py
python/paddle/fluid/tests/unittests/test_lod_reset_op.py
+4
-0
python/paddle/fluid/tests/unittests/test_lookup_table_op.py
python/paddle/fluid/tests/unittests/test_lookup_table_op.py
+2
-0
python/paddle/fluid/tests/unittests/test_mean_op.py
python/paddle/fluid/tests/unittests/test_mean_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_nearest_interp_op.py
...on/paddle/fluid/tests/unittests/test_nearest_interp_op.py
+2
-0
python/paddle/fluid/tests/unittests/test_pad2d_op.py
python/paddle/fluid/tests/unittests/test_pad2d_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_scatter_op.py
python/paddle/fluid/tests/unittests/test_scatter_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_seq_conv.py
python/paddle/fluid/tests/unittests/test_seq_conv.py
+1
-0
python/paddle/fluid/tests/unittests/test_seq_pool.py
python/paddle/fluid/tests/unittests/test_seq_pool.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_concat.py
python/paddle/fluid/tests/unittests/test_sequence_concat.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_expand.py
python/paddle/fluid/tests/unittests/test_sequence_expand.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_expand_as.py
...n/paddle/fluid/tests/unittests/test_sequence_expand_as.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_pad_op.py
python/paddle/fluid/tests/unittests/test_sequence_pad_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py
.../paddle/fluid/tests/unittests/test_sequence_scatter_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_slice_op.py
...on/paddle/fluid/tests/unittests/test_sequence_slice_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py
...on/paddle/fluid/tests/unittests/test_sequence_unpad_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_slice_op.py
python/paddle/fluid/tests/unittests/test_slice_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_space_to_depth_op.py
...on/paddle/fluid/tests/unittests/test_space_to_depth_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py
...ddle/fluid/tests/unittests/test_squared_l2_distance_op.py
+3
-0
python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py
...tests/unittests/test_uniform_random_batch_size_like_op.py
+1
-0
未找到文件。
python/paddle/fluid/tests/unittests/op_test.py
浏览文件 @
cf15da65
...
...
@@ -371,6 +371,20 @@ class OpTest(unittest.TestCase):
no_check_set
=
None
,
equal_nan
=
False
,
check_dygraph
=
False
):
self
.
_check_output_with_place
(
place
,
atol
,
no_check_set
,
equal_nan
,
check_dygraph
)
if
self
.
_is_gc_test_enabled
():
self
.
_enable_gc
(
True
)
self
.
_check_output_with_place
(
place
,
atol
,
no_check_set
,
equal_nan
,
check_dygraph
)
self
.
_enable_gc
(
False
)
def
_check_output_with_place
(
self
,
place
,
atol
,
no_check_set
=
None
,
equal_nan
=
False
,
check_dygraph
=
False
):
if
check_dygraph
:
dygraph_outs
=
self
.
_calc_dygraph_output
(
place
,
no_check_set
=
no_check_set
)
...
...
@@ -492,6 +506,19 @@ class OpTest(unittest.TestCase):
places
.
append
(
core
.
CUDAPlace
(
0
))
return
places
def
_is_gc_test_enabled
(
self
):
if
hasattr
(
self
,
"test_gc"
)
and
self
.
test_gc
:
# FIXME(zjl): if ngraph is enabled, some ops would be fused in Executor
# This may cause error of gc. Disable unittests of gc when FLAGS_use_ngraph is True
is_ngraph_enabled
=
bool
(
os
.
environ
.
get
(
'FLAGS_use_ngraph'
,
False
))
return
False
if
is_ngraph_enabled
else
True
else
:
return
False
def
_enable_gc
(
self
,
enabled
):
threshold
=
0.0
if
enabled
else
-
1.0
fluid
.
core
.
_set_eager_deletion_mode
(
threshold
,
1.0
,
True
)
def
check_output
(
self
,
atol
=
1e-5
,
no_check_set
=
None
,
...
...
@@ -503,6 +530,13 @@ class OpTest(unittest.TestCase):
check_dygraph
)
def
check_output_customized
(
self
,
checker
):
self
.
_check_output_customized
(
checker
)
if
self
.
_is_gc_test_enabled
():
self
.
_enable_gc
(
True
)
self
.
_check_output_customized
(
checker
)
self
.
_enable_gc
(
False
)
def
_check_output_customized
(
self
,
checker
):
places
=
self
.
_get_places
()
for
place
in
places
:
outs
=
self
.
calc_output
(
place
)
...
...
@@ -553,6 +587,26 @@ class OpTest(unittest.TestCase):
in_place
=
False
,
max_relative_error
=
0.005
,
user_defined_grads
=
None
):
self
.
_check_grad_with_place
(
place
,
inputs_to_check
,
output_names
,
no_grad_set
,
numeric_grad_delta
,
in_place
,
max_relative_error
,
user_defined_grads
)
if
self
.
_is_gc_test_enabled
():
self
.
_enable_gc
(
True
)
self
.
_check_grad_with_place
(
place
,
inputs_to_check
,
output_names
,
no_grad_set
,
numeric_grad_delta
,
in_place
,
max_relative_error
,
user_defined_grads
)
self
.
_enable_gc
(
False
)
def
_check_grad_with_place
(
self
,
place
,
inputs_to_check
,
output_names
,
no_grad_set
=
None
,
numeric_grad_delta
=
0.005
,
in_place
=
False
,
max_relative_error
=
0.005
,
user_defined_grads
=
None
):
self
.
scope
=
core
.
Scope
()
op_inputs
=
self
.
inputs
if
hasattr
(
self
,
"inputs"
)
else
dict
()
op_outputs
=
self
.
outputs
if
hasattr
(
self
,
"outputs"
)
else
dict
()
...
...
python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py
浏览文件 @
cf15da65
...
...
@@ -85,6 +85,7 @@ def bilinear_interp_np(input,
class
TestBilinearInterpOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
out_size
=
None
self
.
actual_shape
=
None
self
.
init_test_case
()
...
...
@@ -217,6 +218,7 @@ class TestBilinearInterpActualShape(TestBilinearInterpOp):
class
TestBilinearInterpOpUint8
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
out_size
=
None
self
.
actual_shape
=
None
self
.
init_test_case
()
...
...
python/paddle/fluid/tests/unittests/test_concat_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestConcatOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"concat"
self
.
init_test_data
()
self
.
inputs
=
{
'X'
:
[(
'x0'
,
self
.
x0
),
(
'x1'
,
self
.
x1
),
(
'x2'
,
self
.
x2
)]}
...
...
python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py
已删除
100644 → 0
浏览文件 @
45ebafc3
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import
unittest
import
paddle.fluid
as
fluid
import
importlib
fluid
.
core
.
_set_eager_deletion_mode
(
0.0
,
1.0
,
True
)
from
test_bilinear_interp_op
import
*
from
test_concat_op
import
*
from
test_elementwise_add_op
import
*
from
test_elementwise_sub_op
import
*
from
test_fill_constant_batch_size_like_op
import
*
from
test_fill_zeros_like2_op
import
*
from
test_gather_op
import
*
from
test_gaussian_random_batch_size_like_op
import
*
from
test_linear_chain_crf_op
import
*
from
test_lod_reset_op
import
*
from
test_lookup_table_op
import
*
from
test_mean_op
import
*
from
test_nearest_interp_op
import
*
from
test_pad2d_op
import
*
from
test_scatter_op
import
*
from
test_sequence_concat
import
*
from
test_seq_conv
import
*
from
test_seq_pool
import
*
from
test_sequence_expand_as
import
*
from
test_sequence_expand
import
*
from
test_sequence_pad_op
import
*
from
test_sequence_unpad_op
import
*
from
test_sequence_scatter_op
import
*
from
test_sequence_slice_op
import
*
from
test_slice_op
import
*
from
test_space_to_depth_op
import
*
from
test_squared_l2_distance_op
import
*
from
test_uniform_random_batch_size_like_op
import
*
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_elementwise_add_op.py
浏览文件 @
cf15da65
...
...
@@ -24,6 +24,7 @@ class TestElementwiseAddOp(OpTest):
self
.
use_mkldnn
=
False
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"elementwise_add"
self
.
dtype
=
np
.
float32
self
.
axis
=
-
1
...
...
python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py
浏览文件 @
cf15da65
...
...
@@ -20,6 +20,7 @@ from op_test import OpTest
class
TestElementwiseOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"elementwise_sub"
self
.
inputs
=
{
'X'
:
np
.
random
.
uniform
(
0.1
,
1
,
[
2
,
3
]).
astype
(
"float32"
),
...
...
python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestFillConstantBatchSizeLikeWhenFirstDimIsBatchSize
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"fill_constant_batch_size_like"
self
.
inputs
=
{
'Input'
:
np
.
random
.
random
((
219
,
232
)).
astype
(
"float32"
)}
self
.
attrs
=
{
'value'
:
3.5
,
'shape'
:
[
-
1
,
132
,
7
]}
...
...
@@ -35,6 +36,7 @@ class TestFillConstantBatchSizeLikeWhenFirstDimIsBatchSize(OpTest):
class
TestFillConstantBatchSizeLikeWhenSecondDimIsBatchSize
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"fill_constant_batch_size_like"
self
.
inputs
=
{
'Input'
:
np
.
random
.
random
((
219
,
232
)).
astype
(
"float32"
)}
self
.
attrs
=
{
...
...
@@ -54,6 +56,7 @@ class TestFillConstantBatchSizeLikeWhenSecondDimIsBatchSize(OpTest):
class
TestFillConstantBatchSizeLikeWithLoDTensor
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"fill_constant_batch_size_like"
self
.
inputs
=
{
'Input'
:
(
np
.
random
.
random
((
31
,
28
)).
astype
(
"float32"
),
...
...
python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py
浏览文件 @
cf15da65
...
...
@@ -22,6 +22,7 @@ from op_test import OpTest
class
TestFillZerosLike2Op
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"fill_zeros_like2"
self
.
dtype
=
np
.
float32
self
.
init_dtype
()
...
...
python/paddle/fluid/tests/unittests/test_gather_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestGatherOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"gather"
self
.
config
()
xnp
=
np
.
random
.
random
(
self
.
x_shape
).
astype
(
"float32"
)
...
...
python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestGaussianRandomBatchSizeLike
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"gaussian_random_batch_size_like"
self
.
inputs
=
{
'Input'
:
np
.
zeros
((
500
,
2000
),
dtype
=
"float32"
)}
self
.
attrs
=
{
'mean'
:
1.
,
'std'
:
2.
,
'shape'
:
[
-
1
,
2000
]}
...
...
python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py
浏览文件 @
cf15da65
...
...
@@ -143,6 +143,7 @@ class TestLinearChainCrfOp(OpTest):
}
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"linear_chain_crf"
self
.
set_test_data
()
...
...
python/paddle/fluid/tests/unittests/test_lod_reset_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestLodResetOpByAttr
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lod_reset"
x
=
np
.
random
.
random
((
10
,
20
)).
astype
(
"float32"
)
lod
=
[[
3
,
2
,
5
]]
...
...
@@ -42,6 +43,7 @@ class TestLodResetOpByAttr(OpTest):
class
TestLodResetOpByInput
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lod_reset"
x
=
np
.
random
.
random
((
10
,
20
)).
astype
(
"float32"
)
lod
=
[[
3
,
2
,
5
]]
...
...
@@ -64,6 +66,7 @@ class TestLodResetOpByInput(OpTest):
class
TestLodResetOpBoth
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lod_reset"
x
=
np
.
random
.
random
((
10
,
20
)).
astype
(
"float32"
)
lod
=
[[
3
,
2
,
5
]]
...
...
@@ -86,6 +89,7 @@ class TestLodResetOpBoth(OpTest):
class
TestLodResetOpYIsLoDTensor
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lod_reset"
x
=
np
.
random
.
random
((
10
,
20
)).
astype
(
"float32"
)
lod
=
[[
3
,
2
,
5
]]
...
...
python/paddle/fluid/tests/unittests/test_lookup_table_op.py
浏览文件 @
cf15da65
...
...
@@ -24,6 +24,7 @@ import paddle.compat as cpt
class
TestLookupTableOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lookup_table"
table
=
np
.
random
.
random
((
17
,
31
)).
astype
(
"float32"
)
ids
=
np
.
random
.
randint
(
0
,
17
,
4
).
astype
(
"int64"
)
...
...
@@ -40,6 +41,7 @@ class TestLookupTableOp(OpTest):
class
TestLookupTableOpWithTensorIds
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"lookup_table"
table
=
np
.
random
.
random
((
17
,
31
)).
astype
(
"float32"
)
ids
=
np
.
random
.
randint
(
...
...
python/paddle/fluid/tests/unittests/test_mean_op.py
浏览文件 @
cf15da65
...
...
@@ -22,6 +22,7 @@ import paddle.fluid.core as core
class
TestMeanOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"mean"
self
.
dtype
=
np
.
float32
self
.
init_dtype_type
()
...
...
python/paddle/fluid/tests/unittests/test_nearest_interp_op.py
浏览文件 @
cf15da65
...
...
@@ -67,6 +67,7 @@ def nearest_neighbor_interp_np(X,
class
TestNearestInterpOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
out_size
=
None
self
.
actual_shape
=
None
self
.
init_test_case
()
...
...
@@ -189,6 +190,7 @@ class TestNearestNeighborInterpActualShape(TestNearestInterpOp):
class
TestNearestInterpOpUint8
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
out_size
=
None
self
.
actual_shape
=
None
self
.
init_test_case
()
...
...
python/paddle/fluid/tests/unittests/test_pad2d_op.py
浏览文件 @
cf15da65
...
...
@@ -19,6 +19,7 @@ from op_test import OpTest
class
TestPad2dOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
pad_value
=
0.0
self
.
variable_paddings
=
False
self
.
initTestCase
()
...
...
python/paddle/fluid/tests/unittests/test_scatter_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestScatterOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"scatter"
ref_np
=
np
.
ones
((
3
,
3
)).
astype
(
"float32"
)
index_np
=
np
.
array
([
1
,
2
]).
astype
(
"int32"
)
...
...
python/paddle/fluid/tests/unittests/test_seq_conv.py
浏览文件 @
cf15da65
...
...
@@ -69,6 +69,7 @@ def seqconv(x,
class
TestSeqProject
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
init_test_case
()
self
.
op_type
=
'sequence_conv'
...
...
python/paddle/fluid/tests/unittests/test_seq_pool.py
浏览文件 @
cf15da65
...
...
@@ -56,6 +56,7 @@ class TestSeqAvgPool(OpTest):
compute_seqpool_avg
(
x
,
offset
,
out
)
def
setUp
(
self
):
self
.
test_gc
=
True
x
,
offset
,
out
=
self
.
set_data
()
self
.
compute
(
x
,
offset
,
out
)
...
...
python/paddle/fluid/tests/unittests/test_sequence_concat.py
浏览文件 @
cf15da65
...
...
@@ -26,6 +26,7 @@ class TestSequenceConcat(OpTest):
self
.
out_lod
=
[
19
,
11
]
def
setUp
(
self
):
self
.
test_gc
=
True
x1
=
np
.
random
.
random
(
size
=
(
10
,
80
))
x2
=
np
.
random
.
random
(
size
=
(
20
,
80
))
self
.
setLoD
()
...
...
python/paddle/fluid/tests/unittests/test_sequence_expand.py
浏览文件 @
cf15da65
...
...
@@ -67,6 +67,7 @@ class TestSequenceExpand(OpTest):
self
.
outputs
=
{
'Out'
:
(
out
,
out_lod
)}
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
'sequence_expand'
self
.
set_data
()
self
.
compute
()
...
...
python/paddle/fluid/tests/unittests/test_sequence_expand_as.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestSequenceExpandAs
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
'sequence_expand_as'
self
.
set_data
()
self
.
compute
()
...
...
python/paddle/fluid/tests/unittests/test_sequence_pad_op.py
浏览文件 @
cf15da65
...
...
@@ -66,6 +66,7 @@ class TestSequencePadOp(OpTest):
self
.
outputs
=
{
'Out'
:
out_data
,
'Length'
:
length
}
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
'sequence_pad'
self
.
set_attr
()
self
.
set_data
()
...
...
python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py
浏览文件 @
cf15da65
...
...
@@ -22,6 +22,7 @@ class TestSequenceScatterOp(OpTest):
return
[[
3
,
5
,
4
]]
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"sequence_scatter"
X_data
=
np
.
random
.
uniform
(
0.1
,
1.0
,
[
3
,
6
]).
astype
(
'float32'
)
...
...
python/paddle/fluid/tests/unittests/test_sequence_slice_op.py
浏览文件 @
cf15da65
...
...
@@ -49,6 +49,7 @@ class TestSequenceSliceOp(OpTest):
self
.
length
=
[[
10
],
[
8
],
[
6
],
[
4
],
[
2
]]
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"sequence_slice"
self
.
set_data
()
...
...
python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py
浏览文件 @
cf15da65
...
...
@@ -46,6 +46,7 @@ class TestSequenceUnpadOp(OpTest):
self
.
outputs
=
{
'Out'
:
(
out
.
reshape
(
out_shape
),
out_lod
)}
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
'sequence_unpad'
self
.
init
()
self
.
compute
()
...
...
python/paddle/fluid/tests/unittests/test_slice_op.py
浏览文件 @
cf15da65
...
...
@@ -22,6 +22,7 @@ from op_test import OpTest
class
TestSliceOp
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"slice"
self
.
config
()
self
.
inputs
=
{
'Input'
:
self
.
input
}
...
...
python/paddle/fluid/tests/unittests/test_space_to_depth_op.py
浏览文件 @
cf15da65
...
...
@@ -41,6 +41,7 @@ class TestSpaceToDepthOp(OpTest):
out_
[
in_index
]
=
in_
[
out_index
]
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
init_data
()
self
.
op_type
=
"space_to_depth"
...
...
python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestSquaredL2DistanceOp_f0
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"squared_l2_distance"
self
.
inputs
=
{
'X'
:
np
.
random
.
uniform
(
0.1
,
0.6
,
(
2
,
3
)).
astype
(
"float32"
),
...
...
@@ -42,6 +43,7 @@ class TestSquaredL2DistanceOp_f0(OpTest):
class
TestSquaredL2DistanceOp_f1
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"squared_l2_distance"
self
.
inputs
=
{
'X'
:
np
.
random
.
uniform
(
0.1
,
0.6
,
(
2
,
3
)).
astype
(
"float32"
),
...
...
@@ -63,6 +65,7 @@ class TestSquaredL2DistanceOp_f1(OpTest):
class
TestSquaredL2DistanceOp_f2
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"squared_l2_distance"
self
.
inputs
=
{
'X'
:
np
.
random
.
uniform
(
0.1
,
0.6
,
(
2
,
3
,
4
)).
astype
(
"float32"
),
...
...
python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py
浏览文件 @
cf15da65
...
...
@@ -21,6 +21,7 @@ from op_test import OpTest
class
TestUniformRandomBatchSizeLike
(
OpTest
):
def
setUp
(
self
):
self
.
test_gc
=
True
self
.
op_type
=
"uniform_random_batch_size_like"
self
.
inputs
=
{
'Input'
:
np
.
zeros
((
500
,
2000
),
dtype
=
"float32"
)}
self
.
attrs
=
{
'min'
:
1.
,
'max'
:
2.
,
'shape'
:
[
-
1
,
2000
]}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录