From 45efc1dddae9b4a31c2a8924fb247998d6f0501b Mon Sep 17 00:00:00 2001 From: gongweibao Date: Fri, 21 Sep 2018 07:39:17 +0000 Subject: [PATCH] fix --- python/paddle/fluid/layers/nn.py | 8 ++++---- python/paddle/fluid/tests/unittests/test_layers.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 7842ab355a8..6e8a38ce202 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -6357,7 +6357,7 @@ def sum(x, use_mkldnn=False): """ helper = LayerHelper('sum', **locals()) - out = helper.create_tmp_variable(dtype=helper.input_dtype('X')) + out = helper.create_tmp_variable(dtype=helper.input_dtype('x')) helper.append_op( type='sum', inputs={'X': x}, @@ -6414,7 +6414,7 @@ def slice(input, axes, starts, ends): """ helper = LayerHelper('slice', **locals()) - out = helper.create_tmp_variable(dtype=helper.input_dtype('Input')) + out = helper.create_tmp_variable(dtype=helper.input_dtype('input')) helper.append_op( type='slice', inputs={'Input': input}, @@ -6440,8 +6440,8 @@ def shape(input): """ helper = LayerHelper('shape', **locals()) - out = helper.create_tmp_variable(dtype=helper.input_dtype('Input')) + out = helper.create_tmp_variable(dtype=helper.input_dtype('input')) helper.append_op( - type='shape', inputs={'Input': input}, outputs={'Out': out}, attrs={}) + type='shape', inputs={'Input': input}, outputs={'Out': out}) return out diff --git a/python/paddle/fluid/tests/unittests/test_layers.py b/python/paddle/fluid/tests/unittests/test_layers.py index 5803a15fccf..40780a81b6b 100644 --- a/python/paddle/fluid/tests/unittests/test_layers.py +++ b/python/paddle/fluid/tests/unittests/test_layers.py @@ -602,12 +602,14 @@ class TestBook(unittest.TestCase): input = layers.data(name="input", shape=[13, 11], dtype='float32') out = layers.uniform_random_batch_size_like(input, [-1, 11]) self.assertIsNotNone(out) + print(str(program)) def test_gaussian_random(self): program = Program() with program_guard(program): out = layers.gaussian_random(shape=[20, 30]) self.assertIsNotNone(out) + print(str(program)) def test_sampling_id(self): program = Program() @@ -616,6 +618,7 @@ class TestBook(unittest.TestCase): out = layers.sampling_id(x) self.assertIsNotNone(out) + print(str(program)) def test_gaussian_random_batch_size_like(self): program = Program() @@ -625,6 +628,7 @@ class TestBook(unittest.TestCase): out = layers.gaussian_random_batch_size_like( input, shape=[-1, 11], mean=1.0, std=2.0) self.assertIsNotNone(out) + print(str(program)) def test_sum(self): program = Program() @@ -633,6 +637,7 @@ class TestBook(unittest.TestCase): out = layers.sum(input) self.assertIsNotNone(out) + print(str(program)) def test_slice(self): starts = [1, 0, 2] @@ -646,6 +651,7 @@ class TestBook(unittest.TestCase): out = layers.slice(input, axes=axes, starts=starts, ends=ends) self.assertIsNotNone(out) + print(str(program)) if __name__ == '__main__': -- GitLab