未验证 提交 33fa2684 编写于 作者: 姜永久 提交者: GitHub

rm dygraph_to_static eager guard tests part2 minst2ptb_lm (#48793)

* rm dygraph_to_static eager guard tests part2 minst2ptb_lm
上级 b8c66889
......@@ -25,7 +25,6 @@ import paddle.fluid as fluid
from paddle.fluid.dygraph import to_variable
from paddle.fluid.dygraph.base import switch_to_static_graph
from paddle.fluid.dygraph.io import INFER_MODEL_SUFFIX, INFER_PARAMS_SUFFIX
from paddle.fluid.framework import _test_eager_guard
from paddle.fluid.optimizer import AdamOptimizer
from paddle.nn import Linear
......@@ -168,17 +167,6 @@ class TestMNISTWithToStatic(TestMNIST):
dygraph_loss, static_loss
),
)
with _test_eager_guard():
dygraph_loss = self.train_dygraph()
static_loss = self.train_static()
np.testing.assert_allclose(
dygraph_loss,
static_loss,
rtol=1e-05,
err_msg='dygraph is {}\n static_res is \n{}'.format(
dygraph_loss, static_loss
),
)
def test_mnist_declarative_cpu_vs_mkldnn(self):
dygraph_loss_cpu = self.train_dygraph()
......
......@@ -106,5 +106,4 @@ class TestAMP(TestMNIST):
if __name__ == '__main__':
with paddle.fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
......@@ -120,5 +120,4 @@ class TestPureFP16(TestMNIST):
if __name__ == '__main__':
with paddle.fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
......@@ -726,5 +726,4 @@ class TestMobileNet(unittest.TestCase):
if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
......@@ -15,7 +15,6 @@
import unittest
import paddle
import paddle.fluid as fluid
class MyLayer(paddle.nn.Layer):
......@@ -63,5 +62,4 @@ class TestBackward(unittest.TestCase):
if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
......@@ -439,5 +439,4 @@ class TestRemoveCommentInDy2St(unittest.TestCase):
if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
......@@ -347,6 +347,4 @@ class TestPtb(unittest.TestCase):
if __name__ == '__main__':
# switch into new eager mode
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册