Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
cf799525
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
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看板
未验证
提交
cf799525
编写于
12月 07, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 08, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm autograd func dynamic eager tests (#48788)
上级
a85dedf9
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
3 addition
and
46 deletion
+3
-46
python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py
...ts/unittests/autograd/test_autograd_functional_dynamic.py
+3
-46
未找到文件。
python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py
浏览文件 @
cf799525
...
@@ -24,7 +24,6 @@ from utils import matmul, mul, nested, o2, reduce, reduce_dim
...
@@ -24,7 +24,6 @@ from utils import matmul, mul, nested, o2, reduce, reduce_dim
import
paddle
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid
as
fluid
import
paddle.nn.functional
as
F
import
paddle.nn.functional
as
F
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.incubate.autograd.utils
import
as_tensors
from
paddle.incubate.autograd.utils
import
as_tensors
...
@@ -201,14 +200,6 @@ class TestVJP(TestAutogradFunctional):
...
@@ -201,14 +200,6 @@ class TestVJP(TestAutogradFunctional):
self
.
check_results
(
ref_result
,
aliased_result
)
self
.
check_results
(
ref_result
,
aliased_result
)
def
test_all_cases
(
self
):
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
func_vjp_i1o1
()
self
.
func_vjp_i2o1
()
self
.
func_vjp_i2o2
()
self
.
func_vjp_i2o2_omitting_v
()
self
.
func_vjp_nested
()
self
.
func_vjp_aliased_input
()
self
.
func_vjp_i1o1
()
self
.
func_vjp_i1o1
()
self
.
func_vjp_i2o1
()
self
.
func_vjp_i2o1
()
self
.
func_vjp_i2o2
()
self
.
func_vjp_i2o2
()
...
@@ -237,17 +228,12 @@ class TestVJP(TestAutogradFunctional):
...
@@ -237,17 +228,12 @@ class TestVJP(TestAutogradFunctional):
),
),
)
)
class
TestVJPException
(
unittest
.
TestCase
):
class
TestVJPException
(
unittest
.
TestCase
):
def
func
_vjp
(
self
):
def
test
_vjp
(
self
):
with
self
.
assertRaises
(
self
.
expected_exception
):
with
self
.
assertRaises
(
self
.
expected_exception
):
paddle
.
incubate
.
autograd
.
vjp
(
paddle
.
incubate
.
autograd
.
vjp
(
self
.
fun
,
paddle
.
to_tensor
(
self
.
xs
),
paddle
.
to_tensor
(
self
.
v
)
self
.
fun
,
paddle
.
to_tensor
(
self
.
xs
),
paddle
.
to_tensor
(
self
.
v
)
)
)
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
func_vjp
()
self
.
func_vjp
()
def
jac
(
grad_fn
,
f
,
inputs
):
def
jac
(
grad_fn
,
f
,
inputs
):
assert
grad_fn
in
[
assert
grad_fn
in
[
...
@@ -324,11 +310,6 @@ class TestJVP(TestAutogradFunctional):
...
@@ -324,11 +310,6 @@ class TestJVP(TestAutogradFunctional):
self
.
check_results
(
results_omitting_v
,
results_with_v
)
self
.
check_results
(
results_omitting_v
,
results_with_v
)
def
test_all_cases
(
self
):
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
func_jvp_i1o1
()
self
.
func_jvp_i2o1
()
self
.
func_jvp_i2o2
()
self
.
func_jvp_i2o2_omitting_v
()
self
.
func_jvp_i1o1
()
self
.
func_jvp_i1o1
()
self
.
func_jvp_i2o1
()
self
.
func_jvp_i2o1
()
self
.
func_jvp_i2o2
()
self
.
func_jvp_i2o2
()
...
@@ -372,7 +353,7 @@ class TestJacobianNoBatch(unittest.TestCase):
...
@@ -372,7 +353,7 @@ class TestJacobianNoBatch(unittest.TestCase):
.
get
(
"atol"
)
.
get
(
"atol"
)
)
)
def
func
_jacobian
(
self
):
def
test
_jacobian
(
self
):
xs
=
(
xs
=
(
[
paddle
.
to_tensor
(
x
)
for
x
in
self
.
xs
]
[
paddle
.
to_tensor
(
x
)
for
x
in
self
.
xs
]
if
isinstance
(
self
.
xs
,
typing
.
Sequence
)
if
isinstance
(
self
.
xs
,
typing
.
Sequence
)
...
@@ -409,11 +390,6 @@ class TestJacobianNoBatch(unittest.TestCase):
...
@@ -409,11 +390,6 @@ class TestJacobianNoBatch(unittest.TestCase):
)
)
return
utils
.
_np_concat_matrix_sequence
(
jac
,
utils
.
MatrixFormat
.
NM
)
return
utils
.
_np_concat_matrix_sequence
(
jac
,
utils
.
MatrixFormat
.
NM
)
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
func_jacobian
()
self
.
func_jacobian
()
@
utils
.
place
(
config
.
DEVICES
)
@
utils
.
place
(
config
.
DEVICES
)
@
utils
.
parameterize
(
@
utils
.
parameterize
(
...
@@ -451,7 +427,7 @@ class TestJacobianBatchFirst(unittest.TestCase):
...
@@ -451,7 +427,7 @@ class TestJacobianBatchFirst(unittest.TestCase):
.
get
(
"atol"
)
.
get
(
"atol"
)
)
)
def
func
_jacobian
(
self
):
def
test
_jacobian
(
self
):
xs
=
(
xs
=
(
[
paddle
.
to_tensor
(
x
)
for
x
in
self
.
xs
]
[
paddle
.
to_tensor
(
x
)
for
x
in
self
.
xs
]
if
isinstance
(
self
.
xs
,
typing
.
Sequence
)
if
isinstance
(
self
.
xs
,
typing
.
Sequence
)
...
@@ -505,11 +481,6 @@ class TestJacobianBatchFirst(unittest.TestCase):
...
@@ -505,11 +481,6 @@ class TestJacobianBatchFirst(unittest.TestCase):
jac
,
utils
.
MatrixFormat
.
NBM
,
utils
.
MatrixFormat
.
BNM
jac
,
utils
.
MatrixFormat
.
NBM
,
utils
.
MatrixFormat
.
BNM
)
)
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
func_jacobian
()
self
.
func_jacobian
()
class
TestHessianNoBatch
(
unittest
.
TestCase
):
class
TestHessianNoBatch
(
unittest
.
TestCase
):
@
classmethod
@
classmethod
...
@@ -607,13 +578,6 @@ class TestHessianNoBatch(unittest.TestCase):
...
@@ -607,13 +578,6 @@ class TestHessianNoBatch(unittest.TestCase):
paddle
.
incubate
.
autograd
.
Hessian
(
func
,
paddle
.
ones
([
3
]))
paddle
.
incubate
.
autograd
.
Hessian
(
func
,
paddle
.
ones
([
3
]))
def
test_all_cases
(
self
):
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
setUpClass
()
self
.
func_single_input
()
self
.
func_multi_input
()
self
.
func_allow_unused_true
()
self
.
func_create_graph_true
()
self
.
func_out_not_single
()
self
.
setUpClass
()
self
.
setUpClass
()
self
.
func_single_input
()
self
.
func_single_input
()
self
.
func_multi_input
()
self
.
func_multi_input
()
...
@@ -744,13 +708,6 @@ class TestHessianBatchFirst(unittest.TestCase):
...
@@ -744,13 +708,6 @@ class TestHessianBatchFirst(unittest.TestCase):
)
)
def
test_all_cases
(
self
):
def
test_all_cases
(
self
):
with
_test_eager_guard
():
self
.
setUpClass
()
self
.
func_single_input
()
self
.
func_multi_input
()
self
.
func_allow_unused
()
self
.
func_stop_gradient
()
self
.
func_out_not_single
()
self
.
setUpClass
()
self
.
setUpClass
()
self
.
func_single_input
()
self
.
func_single_input
()
self
.
func_multi_input
()
self
.
func_multi_input
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录