diff --git a/paddle/fluid/operators/reorg_op.cc b/paddle/fluid/operators/reorg_op.cc index 1f9da1f7977e7d21d24086df81bc5b8dfb0c6445..757761ab51fbef6471faed85c548355bfe2e83ad 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 f04b2686260837ffa708f01724f99b8747c7baf0..d112793c711f7a21dcf6f8ee79a04a95badd1fd6 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 cc354c90050c5d863b570360df1d5b6bd6b74715..e59f56b455095293bb20ceb95e40d74c5c192cba 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 9d4fa4d0ff72d5535da417c2d303b34ff581d855..b773606fe312ab9a976fe24752e7434d3ed78e78 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))