From e41d581304597d8ebd9e2ce30bcd80b5fd6ff909 Mon Sep 17 00:00:00 2001 From: Jiabin Yang Date: Thu, 28 Mar 2019 01:24:27 +0800 Subject: [PATCH] test=develop, fix space_to_depth_doc (#16293) * test=develop, fix space_to_depth_doc * test=develop, refine indent * test=develop, refine code * test=develop, add api spec --- paddle/fluid/API.spec | 2 +- python/paddle/fluid/layers/nn.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/API.spec b/paddle/fluid/API.spec index 7d3f49a7e..851308a0f 100644 --- a/paddle/fluid/API.spec +++ b/paddle/fluid/API.spec @@ -211,7 +211,7 @@ paddle.fluid.layers.mean (ArgSpec(args=['x', 'name'], varargs=None, keywords=Non paddle.fluid.layers.mul (ArgSpec(args=['x', 'y', 'x_num_col_dims', 'y_num_col_dims', 'name'], varargs=None, keywords=None, defaults=(1, 1, None)), ('document', 'ccd37fa6b53f074adbfb732d738c4c2d')) paddle.fluid.layers.sigmoid_cross_entropy_with_logits (ArgSpec(args=['x', 'label', 'ignore_index', 'name', 'normalize'], varargs=None, keywords=None, defaults=(-100, None, False)), ('document', '180c284317ea45ef89a460d8d79c0b72')) paddle.fluid.layers.maxout (ArgSpec(args=['x', 'groups', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '891870d069a6aea746d34cc53b61690c')) -paddle.fluid.layers.space_to_depth (ArgSpec(args=['x', 'blocksize', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '5f207ae10589ebe38a63575ef6ff8e1e')) +paddle.fluid.layers.space_to_depth (ArgSpec(args=['x', 'blocksize', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', 'a9221eaef53884a00654e028551b78e2')) paddle.fluid.layers.affine_grid (ArgSpec(args=['theta', 'out_shape', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '51def402b8910e163cbace9d0c0526ed')) paddle.fluid.layers.sequence_reverse (ArgSpec(args=['x', 'name'], varargs=None, keywords=None, defaults=(None,)), ('document', '77a6d80aa5551ca70324fc975c44507f')) paddle.fluid.layers.affine_channel (ArgSpec(args=['x', 'scale', 'bias', 'data_layout', 'name', 'act'], varargs=None, keywords=None, defaults=(None, None, 'NCHW', None, None)), ('document', 'ab84fdc6dc60f3ad9aa397e6007e3bf9')) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 713aedb81..f2413f603 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -9674,9 +9674,15 @@ def space_to_depth(x, blocksize, name=None): .. code-block:: python data = fluid.layers.data( - name='data', shape=[1, 4, 2, 2], dtype='float32') + name='data', shape=[1, 4, 2, 2], dtype='float32', append_batch_size=False) space_to_depthed = fluid.layers.space_to_depth( x=data, blocksize=2) + + exe = fluid.Executor(fluid.CUDAPlace(0)) + data_np = np.arange(0,16).reshape((1,4,2,2)).astype('float32') + out_main = exe.run(fluid.default_main_program(), + feed={'data': data_np}, + fetch_list=[space_to_depthed]) """ helper = LayerHelper("space_to_depth", **locals()) -- GitLab