Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e6ca78c2
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 2 年 前同步成功
通知
2325
Star
20933
Fork
5424
代码
文件
提交
分支
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看板
未验证
提交
e6ca78c2
编写于
3月 13, 2023
作者:
W
wanghuancoder
提交者:
GitHub
3月 13, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Del old dygraph optest2 (#51458)
* delete old dygraph op test
上级
48090c72
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
1017 addition
and
1048 deletion
+1017
-1048
python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py
...fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py
+1
-0
python/paddle/fluid/tests/unittests/test_activation_op.py
python/paddle/fluid/tests/unittests/test_activation_op.py
+917
-938
python/paddle/fluid/tests/unittests/test_atan2_op.py
python/paddle/fluid/tests/unittests/test_atan2_op.py
+3
-4
python/paddle/fluid/tests/unittests/test_attention_lstm_op.py
...on/paddle/fluid/tests/unittests/test_attention_lstm_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_auc_op.py
python/paddle/fluid/tests/unittests/test_auc_op.py
+3
-3
python/paddle/fluid/tests/unittests/test_auc_single_pred_op.py
...n/paddle/fluid/tests/unittests/test_auc_single_pred_op.py
+3
-3
python/paddle/fluid/tests/unittests/test_batch_fc_op.py
python/paddle/fluid/tests/unittests/test_batch_fc_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_bernoulli_op.py
python/paddle/fluid/tests/unittests/test_bernoulli_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_bicubic_interp_op.py
...on/paddle/fluid/tests/unittests/test_bicubic_interp_op.py
+3
-9
python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py
...paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py
+3
-9
python/paddle/fluid/tests/unittests/test_bilateral_slice_op.py
...n/paddle/fluid/tests/unittests/test_bilateral_slice_op.py
+22
-21
python/paddle/fluid/tests/unittests/test_bilinear_interp_v2_op.py
...addle/fluid/tests/unittests/test_bilinear_interp_v2_op.py
+6
-8
python/paddle/fluid/tests/unittests/test_bilinear_tensor_product_op.py
.../fluid/tests/unittests/test_bilinear_tensor_product_op.py
+26
-25
python/paddle/fluid/tests/unittests/test_bincount_op.py
python/paddle/fluid/tests/unittests/test_bincount_op.py
+2
-2
python/paddle/fluid/tests/unittests/test_bipartite_match_op.py
...n/paddle/fluid/tests/unittests/test_bipartite_match_op.py
+1
-1
python/paddle/fluid/tests/unittests/test_bmm_op.py
python/paddle/fluid/tests/unittests/test_bmm_op.py
+22
-20
python/paddle/fluid/tests/unittests/test_box_clip_op.py
python/paddle/fluid/tests/unittests/test_box_clip_op.py
+1
-1
未找到文件。
python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py
浏览文件 @
e6ca78c2
...
...
@@ -437,6 +437,7 @@ class TestMKLDNNExpOp(TestActivation):
# Check if primitives already exist in backward
class
TestMKLDNNAbsPrimitivesAlreadyExist
(
unittest
.
TestCase
):
def
setUp
(
self
):
paddle
.
enable_static
()
super
().
setUp
()
np
.
random
.
seed
(
123
)
...
...
python/paddle/fluid/tests/unittests/test_activation_op.py
浏览文件 @
e6ca78c2
此差异已折叠。
点击以展开。
python/paddle/fluid/tests/unittests/test_atan2_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid.core
as
core
...
...
@@ -44,10 +44,10 @@ class TestAtan2(OpTest):
self
.
outputs
=
{
'Out'
:
out
}
def
test_check_grad
(
self
):
self
.
check_grad
([
'X1'
,
'X2'
],
'Out'
,
check_eager
=
True
)
self
.
check_grad
([
'X1'
,
'X2'
],
'Out'
)
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
True
)
self
.
check_output
()
def
init_dtype
(
self
):
self
.
dtype
=
np
.
float64
...
...
@@ -67,7 +67,6 @@ class TestAtan2_float(TestAtan2):
self
.
inputs
[
'X2'
],
1
/
self
.
inputs
[
'X1'
].
size
,
),
check_eager
=
True
,
)
...
...
python/paddle/fluid/tests/unittests/test_attention_lstm_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
from
test_fusion_lstm_op
import
ACTIVATION
,
fc
from
test_softmax_op
import
stable_softmax
...
...
python/paddle/fluid/tests/unittests/test_auc_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -65,7 +65,7 @@ class TestAucOp(OpTest):
}
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
(
check_dygraph
=
False
)
class
TestGlobalAucOp
(
OpTest
):
...
...
@@ -105,7 +105,7 @@ class TestGlobalAucOp(OpTest):
}
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
(
check_dygraph
=
False
)
class
TestAucAPI
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_auc_single_pred_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
from
paddle.fluid
import
metrics
...
...
@@ -66,7 +66,7 @@ class TestAucSinglePredOp(OpTest):
}
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
(
check_dygraph
=
False
)
class
TestAucGlobalSinglePredOp
(
OpTest
):
...
...
@@ -109,7 +109,7 @@ class TestAucGlobalSinglePredOp(OpTest):
}
def
test_check_output
(
self
):
self
.
check_output
()
self
.
check_output
(
check_dygraph
=
False
)
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/test_batch_fc_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle.fluid.core
as
core
...
...
python/paddle/fluid/tests/unittests/test_batch_norm_op.py
浏览文件 @
e6ca78c2
...
...
@@ -16,7 +16,7 @@ import os
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
,
_set_use_system_allocator
from
eager_
op_test
import
OpTest
,
_set_use_system_allocator
import
paddle
import
paddle.fluid
as
fluid
...
...
python/paddle/fluid/tests/unittests/test_bernoulli_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
...
...
python/paddle/fluid/tests/unittests/test_bicubic_interp_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -135,8 +135,6 @@ class TestBicubicInterpOp(OpTest):
self
.
init_test_case
()
self
.
op_type
=
"bicubic_interp"
# NOTE(dev): some AsDispensible input is not used under imperative mode.
# Skip check_eager while found them in Inputs.
self
.
check_eager
=
True
input_np
=
np
.
random
.
random
(
self
.
input_shape
).
astype
(
"float64"
)
if
self
.
data_layout
==
"NCHW"
:
...
...
@@ -165,10 +163,8 @@ class TestBicubicInterpOp(OpTest):
self
.
inputs
=
{
'X'
:
input_np
}
if
self
.
out_size
is
not
None
:
self
.
inputs
[
'OutSize'
]
=
self
.
out_size
self
.
check_eager
=
False
if
self
.
actual_shape
is
not
None
:
self
.
inputs
[
'OutSize'
]
=
self
.
actual_shape
self
.
check_eager
=
False
self
.
attrs
=
{
'out_h'
:
self
.
out_h
,
...
...
@@ -181,12 +177,10 @@ class TestBicubicInterpOp(OpTest):
self
.
outputs
=
{
'Out'
:
output_np
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
self
.
check_eager
)
self
.
check_output
()
def
test_check_grad
(
self
):
self
.
check_grad
(
[
'X'
],
'Out'
,
in_place
=
True
,
check_eager
=
self
.
check_eager
)
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
)
def
init_test_case
(
self
):
self
.
interp_method
=
'bicubic'
...
...
python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -186,8 +186,6 @@ class TestBicubicInterpOp(OpTest):
self
.
init_test_case
()
self
.
op_type
=
"bicubic_interp_v2"
# NOTE(dev): some AsDispensible input is not used under imperative mode.
# Skip check_eager while found them in Inputs.
self
.
check_eager
=
True
input_np
=
np
.
random
.
random
(
self
.
input_shape
).
astype
(
"float64"
)
scale_h
=
0
scale_w
=
0
...
...
@@ -227,10 +225,8 @@ class TestBicubicInterpOp(OpTest):
self
.
inputs
=
{
'X'
:
input_np
}
if
self
.
out_size
is
not
None
:
self
.
inputs
[
'OutSize'
]
=
self
.
out_size
self
.
check_eager
=
False
if
self
.
actual_shape
is
not
None
:
self
.
inputs
[
'OutSize'
]
=
self
.
actual_shape
self
.
check_eager
=
False
self
.
attrs
=
{
'out_h'
:
self
.
out_h
,
...
...
@@ -249,12 +245,10 @@ class TestBicubicInterpOp(OpTest):
self
.
outputs
=
{
'Out'
:
output_np
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
self
.
check_eager
)
self
.
check_output
()
def
test_check_grad
(
self
):
self
.
check_grad
(
[
'X'
],
'Out'
,
in_place
=
True
,
check_eager
=
self
.
check_eager
)
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
)
def
init_test_case
(
self
):
self
.
interp_method
=
'bicubic'
...
...
python/paddle/fluid/tests/unittests/test_bilateral_slice_op.py
浏览文件 @
e6ca78c2
...
...
@@ -16,7 +16,7 @@ import math
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_op_test
import
OpTest
,
paddle_static_guard
import
paddle
...
...
@@ -192,26 +192,27 @@ class TestBilateralSliceOp1(TestBilateralSliceOp):
class
TestBilateralSliceApi
(
unittest
.
TestCase
):
def
test_api
(
self
):
x
=
paddle
.
fluid
.
data
(
name
=
'x'
,
shape
=
[
None
,
3
,
25
,
15
],
dtype
=
'float32'
)
guide
=
paddle
.
fluid
.
data
(
name
=
'guide'
,
shape
=
[
None
,
25
,
15
],
dtype
=
'float32'
)
grid
=
paddle
.
fluid
.
data
(
name
=
'grid'
,
shape
=
[
None
,
None
,
8
,
5
,
3
],
dtype
=
'float32'
)
paddle
.
fluid
.
contrib
.
layers
.
bilateral_slice
(
x
,
guide
,
grid
,
False
)
if
not
paddle
.
fluid
.
is_compiled_with_cuda
():
return
with
paddle
.
fluid
.
dygraph
.
guard
():
x1
=
paddle
.
rand
([
3
,
1
,
50
,
30
])
guide1
=
paddle
.
rand
([
3
,
50
,
30
])
grid1
=
paddle
.
rand
([
3
,
2
,
2
,
5
,
3
])
paddle
.
fluid
.
contrib
.
bilateral_slice
(
x1
,
guide1
,
grid1
,
False
)
with
paddle_static_guard
():
x
=
paddle
.
fluid
.
data
(
name
=
'x'
,
shape
=
[
None
,
3
,
25
,
15
],
dtype
=
'float32'
)
guide
=
paddle
.
fluid
.
data
(
name
=
'guide'
,
shape
=
[
None
,
25
,
15
],
dtype
=
'float32'
)
grid
=
paddle
.
fluid
.
data
(
name
=
'grid'
,
shape
=
[
None
,
None
,
8
,
5
,
3
],
dtype
=
'float32'
)
paddle
.
fluid
.
contrib
.
layers
.
bilateral_slice
(
x
,
guide
,
grid
,
False
)
if
not
paddle
.
fluid
.
is_compiled_with_cuda
():
return
with
paddle
.
fluid
.
dygraph
.
guard
():
x1
=
paddle
.
rand
([
3
,
1
,
50
,
30
])
guide1
=
paddle
.
rand
([
3
,
50
,
30
])
grid1
=
paddle
.
rand
([
3
,
2
,
2
,
5
,
3
])
paddle
.
fluid
.
contrib
.
bilateral_slice
(
x1
,
guide1
,
grid1
,
False
)
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/test_bilinear_interp_v2_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -219,10 +219,10 @@ class TestBilinearInterpOp(OpTest):
self
.
outputs
=
{
'Out'
:
output_np
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
True
)
self
.
check_output
()
def
test_check_grad
(
self
):
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
,
check_eager
=
True
)
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
)
def
init_test_case
(
self
):
self
.
interp_method
=
'bilinear'
...
...
@@ -409,9 +409,7 @@ class TestBilinearInterpOpUint8(OpTest):
self
.
outputs
=
{
'Out'
:
output_np
}
def
test_check_output
(
self
):
self
.
check_output_with_place
(
place
=
core
.
CPUPlace
(),
atol
=
1
,
check_eager
=
True
)
self
.
check_output_with_place
(
place
=
core
.
CPUPlace
(),
atol
=
1
)
def
init_test_case
(
self
):
self
.
interp_method
=
'bilinear'
...
...
@@ -585,10 +583,10 @@ class TestBilinearInterpOp_attr_tensor(OpTest):
self
.
outputs
=
{
'Out'
:
output_np
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
True
)
self
.
check_output
()
def
test_check_grad
(
self
):
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
,
check_eager
=
True
)
self
.
check_grad
([
'X'
],
'Out'
,
in_place
=
True
)
def
init_test_case
(
self
):
self
.
interp_method
=
'bilinear'
...
...
python/paddle/fluid/tests/unittests/test_bilinear_tensor_product_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_op_test
import
OpTest
,
paddle_static_guard
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -23,28 +23,29 @@ import paddle.fluid as fluid
class
TestDygraphBilinearTensorProductAPIError
(
unittest
.
TestCase
):
def
test_errors
(
self
):
with
fluid
.
program_guard
(
fluid
.
Program
(),
fluid
.
Program
()):
layer
=
paddle
.
nn
.
Bilinear
(
5
,
4
,
1000
)
# the input must be Variable.
x0
=
fluid
.
create_lod_tensor
(
np
.
array
([
-
1
,
3
,
5
,
5
]),
[[
1
,
1
,
1
,
1
]],
fluid
.
CPUPlace
()
)
self
.
assertRaises
(
TypeError
,
layer
,
x0
)
# the input dtype must be float32 or float64
x1
=
fluid
.
data
(
name
=
'x1'
,
shape
=
[
-
1
,
5
],
dtype
=
"float16"
)
x2
=
fluid
.
data
(
name
=
'x2'
,
shape
=
[
-
1
,
4
],
dtype
=
"float32"
)
self
.
assertRaises
(
TypeError
,
layer
,
x1
,
x2
)
# the dimensions of x and y must be 2
paddle
.
enable_static
()
x3
=
paddle
.
static
.
data
(
""
,
shape
=
[
0
],
dtype
=
"float32"
)
x4
=
paddle
.
static
.
data
(
""
,
shape
=
[
0
],
dtype
=
"float32"
)
self
.
assertRaises
(
ValueError
,
paddle
.
static
.
nn
.
bilinear_tensor_product
,
x3
,
x4
,
1000
,
)
with
paddle_static_guard
():
with
fluid
.
program_guard
(
fluid
.
Program
(),
fluid
.
Program
()):
layer
=
paddle
.
nn
.
Bilinear
(
5
,
4
,
1000
)
# the input must be Variable.
x0
=
fluid
.
create_lod_tensor
(
np
.
array
([
-
1
,
3
,
5
,
5
]),
[[
1
,
1
,
1
,
1
]],
fluid
.
CPUPlace
()
)
self
.
assertRaises
(
TypeError
,
layer
,
x0
)
# the input dtype must be float32 or float64
x1
=
fluid
.
data
(
name
=
'x1'
,
shape
=
[
-
1
,
5
],
dtype
=
"float16"
)
x2
=
fluid
.
data
(
name
=
'x2'
,
shape
=
[
-
1
,
4
],
dtype
=
"float32"
)
self
.
assertRaises
(
TypeError
,
layer
,
x1
,
x2
)
# the dimensions of x and y must be 2
paddle
.
enable_static
()
x3
=
paddle
.
static
.
data
(
""
,
shape
=
[
0
],
dtype
=
"float32"
)
x4
=
paddle
.
static
.
data
(
""
,
shape
=
[
0
],
dtype
=
"float32"
)
self
.
assertRaises
(
ValueError
,
paddle
.
static
.
nn
.
bilinear_tensor_product
,
x3
,
x4
,
1000
,
)
class
TestBilinearTensorProductOp
(
OpTest
):
...
...
@@ -73,10 +74,10 @@ class TestBilinearTensorProductOp(OpTest):
self
.
outputs
=
{
'Out'
:
output
+
bias
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
True
)
self
.
check_output
()
def
test_check_grad_normal
(
self
):
self
.
check_grad
([
'X'
,
'Y'
,
'Weight'
,
'Bias'
],
'Out'
,
check_eager
=
True
)
self
.
check_grad
([
'X'
,
'Y'
,
'Weight'
,
'Bias'
],
'Out'
)
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/test_bincount_op.py
浏览文件 @
e6ca78c2
...
...
@@ -17,7 +17,7 @@ import tempfile
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -150,7 +150,7 @@ class TestBincountOp(OpTest):
self
.
Out
=
np
.
bincount
(
self
.
np_input
,
minlength
=
self
.
minlength
)
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
False
)
self
.
check_output
()
class
TestCase1
(
TestBincountOp
):
...
...
python/paddle/fluid/tests/unittests/test_bipartite_match_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
def
bipartite_match
(
distance
,
match_indices
,
match_dist
):
...
...
python/paddle/fluid/tests/unittests/test_bmm_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_op_test
import
OpTest
,
paddle_static_guard
import
paddle
import
paddle.fluid
as
fluid
...
...
@@ -32,31 +32,33 @@ class TestBmmOp(OpTest):
self
.
outputs
=
{
'Out'
:
Out
}
def
test_check_output
(
self
):
self
.
check_output
(
check_eager
=
True
)
self
.
check_output
()
def
test_checkout_grad
(
self
):
self
.
check_grad
([
'X'
,
'Y'
],
'Out'
,
check_eager
=
True
)
self
.
check_grad
([
'X'
,
'Y'
],
'Out'
)
class
API_TestBmm
(
unittest
.
TestCase
):
def
test_out
(
self
):
with
fluid
.
program_guard
(
fluid
.
Program
(),
fluid
.
Program
()):
data1
=
paddle
.
static
.
data
(
'data1'
,
shape
=
[
-
1
,
3
,
4
],
dtype
=
'float64'
)
data2
=
paddle
.
static
.
data
(
'data2'
,
shape
=
[
-
1
,
4
,
5
],
dtype
=
'float64'
)
result_bmm
=
paddle
.
bmm
(
data1
,
data2
)
place
=
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
input1
=
np
.
random
.
random
([
10
,
3
,
4
]).
astype
(
'float64'
)
input2
=
np
.
random
.
random
([
10
,
4
,
5
]).
astype
(
'float64'
)
(
result
,)
=
exe
.
run
(
feed
=
{
"data1"
:
input1
,
"data2"
:
input2
},
fetch_list
=
[
result_bmm
]
)
expected_result
=
np
.
matmul
(
input1
,
input2
)
np
.
testing
.
assert_allclose
(
expected_result
,
result
,
rtol
=
1e-05
)
with
paddle_static_guard
():
with
fluid
.
program_guard
(
fluid
.
Program
(),
fluid
.
Program
()):
data1
=
paddle
.
static
.
data
(
'data1'
,
shape
=
[
-
1
,
3
,
4
],
dtype
=
'float64'
)
data2
=
paddle
.
static
.
data
(
'data2'
,
shape
=
[
-
1
,
4
,
5
],
dtype
=
'float64'
)
result_bmm
=
paddle
.
bmm
(
data1
,
data2
)
place
=
fluid
.
CPUPlace
()
exe
=
fluid
.
Executor
(
place
)
input1
=
np
.
random
.
random
([
10
,
3
,
4
]).
astype
(
'float64'
)
input2
=
np
.
random
.
random
([
10
,
4
,
5
]).
astype
(
'float64'
)
(
result
,)
=
exe
.
run
(
feed
=
{
"data1"
:
input1
,
"data2"
:
input2
},
fetch_list
=
[
result_bmm
],
)
expected_result
=
np
.
matmul
(
input1
,
input2
)
np
.
testing
.
assert_allclose
(
expected_result
,
result
,
rtol
=
1e-05
)
class
API_TestDygraphBmm
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_box_clip_op.py
浏览文件 @
e6ca78c2
...
...
@@ -15,7 +15,7 @@
import
unittest
import
numpy
as
np
from
op_test
import
OpTest
from
eager_
op_test
import
OpTest
def
box_clip
(
input_box
,
im_info
,
output_box
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录