Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
675b3486
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
675b3486
编写于
12月 21, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 21, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm unittests eager guard tests part22 tril2warpctc (#48893)
上级
fb8f2de6
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
65 addition
and
364 deletion
+65
-364
python/paddle/fluid/tests/unittests/test_tril_indices_op.py
python/paddle/fluid/tests/unittests/test_tril_indices_op.py
+0
-5
python/paddle/fluid/tests/unittests/test_triu_indices_op.py
python/paddle/fluid/tests/unittests/test_triu_indices_op.py
+0
-5
python/paddle/fluid/tests/unittests/test_trunc_op.py
python/paddle/fluid/tests/unittests/test_trunc_op.py
+0
-15
python/paddle/fluid/tests/unittests/test_truncated_gaussian_random_op.py
...luid/tests/unittests/test_truncated_gaussian_random_op.py
+10
-12
python/paddle/fluid/tests/unittests/test_unbind_op.py
python/paddle/fluid/tests/unittests/test_unbind_op.py
+0
-5
python/paddle/fluid/tests/unittests/test_uniform_random_op.py
...on/paddle/fluid/tests/unittests/test_uniform_random_op.py
+1
-7
python/paddle/fluid/tests/unittests/test_unique.py
python/paddle/fluid/tests/unittests/test_unique.py
+0
-7
python/paddle/fluid/tests/unittests/test_var_base.py
python/paddle/fluid/tests/unittests/test_var_base.py
+51
-286
python/paddle/fluid/tests/unittests/test_view_op_reuse_allocation.py
...le/fluid/tests/unittests/test_view_op_reuse_allocation.py
+3
-19
python/paddle/fluid/tests/unittests/test_warpctc_op.py
python/paddle/fluid/tests/unittests/test_warpctc_op.py
+0
-3
未找到文件。
python/paddle/fluid/tests/unittests/test_tril_indices_op.py
浏览文件 @
675b3486
...
...
@@ -19,7 +19,6 @@ from op_test import OpTest
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
class
TestTrilIndicesOp
(
OpTest
):
...
...
@@ -89,10 +88,6 @@ class TestTrilIndicesAPICaseDygraph(unittest.TestCase):
expected_result1
=
np
.
tril_indices
(
4
,
2
,
4
)
self
.
assertEqual
((
out1
.
numpy
()
==
expected_result1
).
all
(),
True
)
def
test_dygraph_eager
(
self
):
with
_test_eager_guard
():
self
.
test_dygraph
()
class
TestTrilIndicesAPICaseError
(
unittest
.
TestCase
):
def
test_case_error
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_triu_indices_op.py
浏览文件 @
675b3486
...
...
@@ -19,7 +19,6 @@ from op_test import OpTest
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
class
TestTriuIndicesOp
(
OpTest
):
...
...
@@ -84,10 +83,6 @@ class TestTriuIndicesAPICaseDygraph(unittest.TestCase):
expected_result
=
np
.
triu_indices
(
4
,
2
,
4
)
np
.
testing
.
assert_array_equal
(
out
,
expected_result
)
def
test_dygraph_eager
(
self
):
with
_test_eager_guard
():
self
.
test_dygraph
()
class
TestTriuIndicesAPICaseError
(
unittest
.
TestCase
):
def
test_case_error
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_trunc_op.py
浏览文件 @
675b3486
...
...
@@ -18,7 +18,6 @@ import numpy as np
from
op_test
import
OpTest
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
paddle
.
enable_static
()
...
...
@@ -85,20 +84,6 @@ class TestTruncAPI(unittest.TestCase):
np
.
testing
.
assert_allclose
(
out
.
numpy
(),
out_ref
,
rtol
=
1e-08
)
paddle
.
enable_static
()
def
test_api_eager
(
self
):
paddle
.
disable_static
(
self
.
place
)
with
_test_eager_guard
():
x_tensor
=
paddle
.
to_tensor
(
self
.
x
)
out
=
paddle
.
trunc
(
x_tensor
)
out_ref
=
np
.
trunc
(
self
.
x
)
np
.
testing
.
assert_allclose
(
out
.
numpy
(),
out_ref
,
rtol
=
1e-08
)
paddle
.
enable_static
()
def
test_api_eager_dygraph
(
self
):
with
_test_eager_guard
():
self
.
test_api_dygraph
()
def
test_errors
(
self
):
with
paddle
.
static
.
program_guard
(
paddle
.
static
.
Program
()):
x
=
paddle
.
fluid
.
data
(
'X'
,
[
20
,
20
],
'bool'
)
...
...
python/paddle/fluid/tests/unittests/test_truncated_gaussian_random_op.py
浏览文件 @
675b3486
...
...
@@ -20,7 +20,6 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.executor
import
Executor
from
paddle.fluid.framework
import
_test_eager_guard
class
TestTrunctedGaussianRandomOp
(
unittest
.
TestCase
):
...
...
@@ -70,17 +69,16 @@ class TestTrunctedGaussianRandomOp(unittest.TestCase):
# directly
def
gaussian_random_test_eager
(
self
,
place
):
with
fluid
.
dygraph
.
guard
(
place
):
with
_test_eager_guard
():
out
=
paddle
.
_C_ops
.
truncated_gaussian_random
(
self
.
attrs
[
"shape"
],
self
.
attrs
[
"mean"
],
self
.
attrs
[
"std"
],
self
.
attrs
[
"seed"
],
core
.
VarDesc
.
VarType
.
FP32
,
place
,
)
self
.
assertAlmostEqual
(
numpy
.
mean
(
out
.
numpy
()),
0.0
,
delta
=
0.1
)
self
.
assertAlmostEqual
(
numpy
.
var
(
out
.
numpy
()),
0.773
,
delta
=
0.1
)
out
=
paddle
.
_C_ops
.
truncated_gaussian_random
(
self
.
attrs
[
"shape"
],
self
.
attrs
[
"mean"
],
self
.
attrs
[
"std"
],
self
.
attrs
[
"seed"
],
core
.
VarDesc
.
VarType
.
FP32
,
place
,
)
self
.
assertAlmostEqual
(
numpy
.
mean
(
out
.
numpy
()),
0.0
,
delta
=
0.1
)
self
.
assertAlmostEqual
(
numpy
.
var
(
out
.
numpy
()),
0.773
,
delta
=
0.1
)
if
__name__
==
"__main__"
:
...
...
python/paddle/fluid/tests/unittests/test_unbind_op.py
浏览文件 @
675b3486
...
...
@@ -21,7 +21,6 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.tensor
as
tensor
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
class
TestUnbind
(
unittest
.
TestCase
):
...
...
@@ -57,10 +56,6 @@ class TestUnbind(unittest.TestCase):
out
.
backward
()
np
.
testing
.
assert_array_equal
(
x
.
grad
.
numpy
(),
np_grad
)
def
test_unbind_dygraph_final_state
(
self
):
with
_test_eager_guard
():
self
.
test_unbind_dygraph
()
class
TestLayersUnbind
(
unittest
.
TestCase
):
def
test_layers_unbind
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_uniform_random_op.py
浏览文件 @
675b3486
...
...
@@ -23,7 +23,6 @@ import paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.op
import
Operator
from
paddle.tensor
import
random
...
...
@@ -171,7 +170,7 @@ class TestUniformRandomOp(OpTest):
hist
,
prob
=
self
.
output_hist
(
np
.
array
(
outs
[
0
]))
np
.
testing
.
assert_allclose
(
hist
,
prob
,
rtol
=
0
,
atol
=
0.01
)
def
func_
test_check_api
(
self
):
def
test_check_api
(
self
):
places
=
self
.
_get_places
()
for
place
in
places
:
with
fluid
.
dygraph
.
base
.
guard
(
place
=
place
):
...
...
@@ -183,11 +182,6 @@ class TestUniformRandomOp(OpTest):
self
.
attrs
[
'seed'
],
)
def
test_check_api_eager
(
self
):
with
_test_eager_guard
():
self
.
func_test_check_api
()
self
.
func_test_check_api
()
class
TestUniformRandomOpError
(
unittest
.
TestCase
):
def
test_errors
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_unique.py
浏览文件 @
675b3486
...
...
@@ -20,7 +20,6 @@ from op_test import OpTest
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.framework
import
_test_eager_guard
class
TestUniqueOp
(
OpTest
):
...
...
@@ -262,12 +261,6 @@ class TestUniqueAPI(unittest.TestCase):
self
.
assertTrue
((
counts
.
numpy
()
==
np_counts
).
all
(),
True
)
paddle
.
enable_static
()
def
test_dygraph_api
(
self
):
with
_test_eager_guard
():
self
.
test_dygraph_api_out
()
self
.
test_dygraph_api_attr
()
self
.
test_dygraph_attr_dtype
()
def
test_static_graph
(
self
):
with
paddle
.
static
.
program_guard
(
paddle
.
static
.
Program
(),
paddle
.
static
.
Program
()
...
...
python/paddle/fluid/tests/unittests/test_var_base.py
浏览文件 @
675b3486
此差异已折叠。
点击以展开。
python/paddle/fluid/tests/unittests/test_view_op_reuse_allocation.py
浏览文件 @
675b3486
...
...
@@ -17,7 +17,6 @@ import unittest
import
numpy
as
np
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
# NOTE(pangyoki): Tensor View Strategy.
...
...
@@ -36,7 +35,7 @@ class TestDygraphViewReuseAllocation(unittest.TestCase):
def
view_api_processing
(
self
,
var
):
return
paddle
.
squeeze
(
var
)
def
func_
test_view_api
(
self
):
def
test_view_api
(
self
):
var
=
paddle
.
rand
(
self
.
input_shape
)
view_var
=
self
.
view_api_processing
(
var
)
view_var
[
0
]
=
2.0
...
...
@@ -47,12 +46,7 @@ class TestDygraphViewReuseAllocation(unittest.TestCase):
view_var_numpy
=
view_var
.
numpy
()
np
.
testing
.
assert_array_equal
(
var_numpy
,
view_var_numpy
)
def
test_view_api
(
self
):
with
_test_eager_guard
():
self
.
func_test_view_api
()
self
.
func_test_view_api
()
def
func_test_forward_version
(
self
):
def
test_forward_version
(
self
):
var
=
paddle
.
rand
(
self
.
input_shape
)
self
.
assertEqual
(
var
.
inplace_version
,
0
)
view_var
=
self
.
view_api_processing
(
var
)
...
...
@@ -69,12 +63,7 @@ class TestDygraphViewReuseAllocation(unittest.TestCase):
self
.
assertEqual
(
view_var
.
inplace_version
,
2
)
self
.
assertEqual
(
view_var_2
.
inplace_version
,
2
)
def
test_forward_version
(
self
):
with
_test_eager_guard
():
self
.
func_test_forward_version
()
self
.
func_test_forward_version
()
def
func_test_backward_error
(
self
):
def
test_backward_error
(
self
):
# It raises an error because the inplace operator will result
# in incorrect gradient computation.
with
paddle
.
fluid
.
dygraph
.
guard
():
...
...
@@ -97,11 +86,6 @@ class TestDygraphViewReuseAllocation(unittest.TestCase):
):
loss
.
backward
()
def
test_backward_error
(
self
):
with
_test_eager_guard
():
self
.
func_test_backward_error
()
self
.
func_test_backward_error
()
class
TestUnsqueezeDygraphViewReuseAllocation
(
TestDygraphViewReuseAllocation
):
def
init_shape
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_warpctc_op.py
浏览文件 @
675b3486
...
...
@@ -23,7 +23,6 @@ import paddle
import
paddle.fluid.core
as
core
import
paddle.nn.functional
as
F
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
paddle
.
enable_static
()
...
...
@@ -718,8 +717,6 @@ class TestCTCLossAPICase(unittest.TestCase):
loss_pd_sum
,
loss_np_sum
,
rtol
=
1e-05
,
atol
=
1
)
with
_test_eager_guard
():
test_functinal_api
()
test_functinal_api
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录