From 0d8545f818cd1fb64b164007fde5c042c04e3c76 Mon Sep 17 00:00:00 2001 From: Huihuang Zheng Date: Fri, 17 Jul 2020 10:09:34 +0800 Subject: [PATCH] Enable MNIST Multiple 'return' as Unit Test (#25556) Enable multiple "return" statement in MNIST as Unit test in dy2stat. --- .../tests/unittests/dygraph_to_static/test_mnist.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py index 0541c37fc71..09be10e6c8a 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_mnist.py @@ -108,12 +108,9 @@ class MNIST(fluid.dygraph.Layer): loss = fluid.layers.cross_entropy(x, label) avg_loss = fluid.layers.mean(loss) - # TODO: Uncomment code after "return" statement can be transformed correctly. - - # return x, acc, avg_loss - # else: - # return x - return x, acc, avg_loss + return x, acc, avg_loss + else: + return x def inference(self, inputs): x = self._simple_img_conv_pool_1(inputs) -- GitLab