Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rm dygraph_to_static eager guard tests part2 minst2ptb_lm #48793

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
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

Expand Down Expand Up @@ -168,17 +167,6 @@ def test_mnist_to_static(self):
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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,4 @@ def train(self, to_static=False):


if __name__ == '__main__':
with paddle.fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,4 @@ def train(self, to_static=False):


if __name__ == '__main__':
with paddle.fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -726,5 +726,4 @@ def verify_predict(self):


if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import unittest

import paddle
import paddle.fluid as fluid


class MyLayer(paddle.nn.Layer):
Expand Down Expand Up @@ -63,5 +62,4 @@ def test_order_1(self):


if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -439,5 +439,4 @@ def test_remove_comment(self):


if __name__ == '__main__':
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,4 @@ def test_check_result(self):


if __name__ == '__main__':
# switch into new eager mode
with fluid.framework._test_eager_guard():
unittest.main()
unittest.main()