From ff07dc315ec5351c84754de8b4e8f944e44628db Mon Sep 17 00:00:00 2001 From: JiabinYang Date: Tue, 23 Oct 2018 06:43:46 +0000 Subject: [PATCH] test=develop --- paddle/fluid/operators/reorg_op.cc | 4 ++-- python/paddle/fluid/layers/nn.py | 4 ++-- python/paddle/fluid/tests/unittests/test_layers.py | 2 +- python/paddle/fluid/tests/unittests/test_reorg_op.py | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/operators/reorg_op.cc b/paddle/fluid/operators/reorg_op.cc index 1f9da1f7977..757761ab51f 100644 --- a/paddle/fluid/operators/reorg_op.cc +++ b/paddle/fluid/operators/reorg_op.cc @@ -91,8 +91,8 @@ class ReorgOpMaker : public framework::OpProtoAndCheckerMaker { Examples: - 1. Given a 3-D tensor Input(X) with a shape [2048, 26, 26], and the stride is 2, the reorg operator will transform Input(X) - into a 3-D tensor with shape [2048, 13, 13] and leaving Input(X)'s data unchanged. + 1. Given a 4-D tensor Input(X) with a shape [128, 2048, 26, 26], and the stride is 2, the reorg operator will transform Input(X) + into a 4-D tensor with shape [128, 2048, 13, 13] and leaving Input(X)'s data unchanged. )DOC"); } diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index f04b2686260..d112793c711 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -7470,8 +7470,8 @@ def reorg(x, stride, name=None): x=data, stride=2) """ - if not (isinstance(stride, long)): - raise ValueError("stride must be a python long") + if not (isinstance(stride, int)): + raise ValueError("stride must be a python Int") helper = LayerHelper("reorg", **locals()) if name is None: diff --git a/python/paddle/fluid/tests/unittests/test_layers.py b/python/paddle/fluid/tests/unittests/test_layers.py index cc354c90050..e59f56b4550 100644 --- a/python/paddle/fluid/tests/unittests/test_layers.py +++ b/python/paddle/fluid/tests/unittests/test_layers.py @@ -256,7 +256,7 @@ class TestBook(unittest.TestCase): shape=[32, 9, 6, 6], append_batch_size=False, dtype='float32') - self.assertIsNotNone(layers.reorg(data, long(3))) + self.assertIsNotNone(layers.reorg(data, 3)) print(str(program)) def test_sequence_unsqueeze(self): diff --git a/python/paddle/fluid/tests/unittests/test_reorg_op.py b/python/paddle/fluid/tests/unittests/test_reorg_op.py index 9d4fa4d0ff7..b773606fe31 100644 --- a/python/paddle/fluid/tests/unittests/test_reorg_op.py +++ b/python/paddle/fluid/tests/unittests/test_reorg_op.py @@ -22,16 +22,16 @@ from op_test import OpTest class TestReorgOp(OpTest): @staticmethod def helper(in_, width, height, channel, batch, stride, forward, out_): - channel_out = channel / (stride * stride) + channel_out = channel // (stride * stride) for b in range(batch): for k in range(channel): for j in range(height): for i in range(width): in_index = i + width * (j + height * (k + channel * b)) channel2 = k % channel_out - offset = k / channel_out + offset = k // channel_out width2 = i * stride + offset % stride - height2 = j * stride + offset / stride + height2 = j * stride + offset // stride out_index = width2 + width * stride * ( height2 + height * stride * (channel2 + channel_out * b)) -- GitLab