Skip to content

Commit cf79952

Browse files
authored
rm autograd func dynamic eager tests (#48788)
1 parent a85dedf commit cf79952

File tree

1 file changed

+3
-46
lines changed

1 file changed

+3
-46
lines changed

python/paddle/fluid/tests/unittests/autograd/test_autograd_functional_dynamic.py

Lines changed: 3 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import paddle
2525
import paddle.fluid as fluid
2626
import paddle.nn.functional as F
27-
from paddle.fluid.framework import _test_eager_guard
2827
from paddle.incubate.autograd.utils import as_tensors
2928

3029

@@ -201,14 +200,6 @@ def func_vjp_aliased_input(self):
201200
self.check_results(ref_result, aliased_result)
202201

203202
def test_all_cases(self):
204-
with _test_eager_guard():
205-
self.func_vjp_i1o1()
206-
self.func_vjp_i2o1()
207-
self.func_vjp_i2o2()
208-
self.func_vjp_i2o2_omitting_v()
209-
self.func_vjp_nested()
210-
self.func_vjp_aliased_input()
211-
212203
self.func_vjp_i1o1()
213204
self.func_vjp_i2o1()
214205
self.func_vjp_i2o2()
@@ -237,17 +228,12 @@ def test_input_single_tensor(self):
237228
),
238229
)
239230
class TestVJPException(unittest.TestCase):
240-
def func_vjp(self):
231+
def test_vjp(self):
241232
with self.assertRaises(self.expected_exception):
242233
paddle.incubate.autograd.vjp(
243234
self.fun, paddle.to_tensor(self.xs), paddle.to_tensor(self.v)
244235
)
245236

246-
def test_all_cases(self):
247-
with _test_eager_guard():
248-
self.func_vjp()
249-
self.func_vjp()
250-
251237

252238
def jac(grad_fn, f, inputs):
253239
assert grad_fn in [
@@ -324,11 +310,6 @@ def func_jvp_i2o2_omitting_v(self):
324310
self.check_results(results_omitting_v, results_with_v)
325311

326312
def test_all_cases(self):
327-
with _test_eager_guard():
328-
self.func_jvp_i1o1()
329-
self.func_jvp_i2o1()
330-
self.func_jvp_i2o2()
331-
self.func_jvp_i2o2_omitting_v()
332313
self.func_jvp_i1o1()
333314
self.func_jvp_i2o1()
334315
self.func_jvp_i2o2()
@@ -372,7 +353,7 @@ def setUp(self):
372353
.get("atol")
373354
)
374355

375-
def func_jacobian(self):
356+
def test_jacobian(self):
376357
xs = (
377358
[paddle.to_tensor(x) for x in self.xs]
378359
if isinstance(self.xs, typing.Sequence)
@@ -409,11 +390,6 @@ def _get_expected(self):
409390
)
410391
return utils._np_concat_matrix_sequence(jac, utils.MatrixFormat.NM)
411392

412-
def test_all_cases(self):
413-
with _test_eager_guard():
414-
self.func_jacobian()
415-
self.func_jacobian()
416-
417393

418394
@utils.place(config.DEVICES)
419395
@utils.parameterize(
@@ -451,7 +427,7 @@ def setUp(self):
451427
.get("atol")
452428
)
453429

454-
def func_jacobian(self):
430+
def test_jacobian(self):
455431
xs = (
456432
[paddle.to_tensor(x) for x in self.xs]
457433
if isinstance(self.xs, typing.Sequence)
@@ -505,11 +481,6 @@ def _get_expected(self):
505481
jac, utils.MatrixFormat.NBM, utils.MatrixFormat.BNM
506482
)
507483

508-
def test_all_cases(self):
509-
with _test_eager_guard():
510-
self.func_jacobian()
511-
self.func_jacobian()
512-
513484

514485
class TestHessianNoBatch(unittest.TestCase):
515486
@classmethod
@@ -607,13 +578,6 @@ def func(x):
607578
paddle.incubate.autograd.Hessian(func, paddle.ones([3]))
608579

609580
def test_all_cases(self):
610-
with _test_eager_guard():
611-
self.setUpClass()
612-
self.func_single_input()
613-
self.func_multi_input()
614-
self.func_allow_unused_true()
615-
self.func_create_graph_true()
616-
self.func_out_not_single()
617581
self.setUpClass()
618582
self.func_single_input()
619583
self.func_multi_input()
@@ -744,13 +708,6 @@ def func(x):
744708
)
745709

746710
def test_all_cases(self):
747-
with _test_eager_guard():
748-
self.setUpClass()
749-
self.func_single_input()
750-
self.func_multi_input()
751-
self.func_allow_unused()
752-
self.func_stop_gradient()
753-
self.func_out_not_single()
754711
self.setUpClass()
755712
self.func_single_input()
756713
self.func_multi_input()

0 commit comments

Comments
 (0)