提交 ff07dc31 编写于 作者: J JiabinYang

test=develop

上级 39d39775
......@@ -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");
}
......
......@@ -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:
......
......@@ -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):
......
......@@ -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))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册