diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 7f7086641ac53cd55403d550f8b213d2854db48f..63ff5f07e7be656bd94a403dca286998c2315517 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -9341,8 +9341,8 @@ def shuffle_channel(x, group=1, name=None): with multiple group convolutional layers. Args: - x: The input tensor variable.. - group: The num of group + x(Variable): The input tensor variable. + group(Integer): The num of group. Returns: Variable: channels shuffled tensor variable. @@ -9358,8 +9358,7 @@ def shuffle_channel(x, group=1, name=None): """ helper = LayerHelper("shuffle_channel", **locals()) - out = helper.create_variable_for_type_inference( - dtype=helper.input_dtype('X')) + out = helper.create_variable_for_type_inference(dtype=x.dtype) if not isinstance(group, int): raise TypeError("group must be int type") diff --git a/python/paddle/fluid/tests/unittests/test_layers.py b/python/paddle/fluid/tests/unittests/test_layers.py index daf4a9c824aa8c148880e345846c63c022f27e21..9e392fa8e0d0f2b54ecb46599ebc2d001b05327d 100644 --- a/python/paddle/fluid/tests/unittests/test_layers.py +++ b/python/paddle/fluid/tests/unittests/test_layers.py @@ -1018,8 +1018,8 @@ class TestBook(unittest.TestCase): def test_shuffle_channel(self): program = Program() with program_guard(program): - x = layers.data(name="X", shape=[10, 16, 4, 4], dtype="float32") - out = layers.shuffle_channel(x, group=2) + x = layers.data(name="X", shape=[16, 4, 4], dtype="float32") + out = layers.shuffle_channel(x, group=4) self.assertIsNotNone(out) print(str(program))