From b28157ee06ecce6aabab29dd9b82956e3d8a7092 Mon Sep 17 00:00:00 2001 From: BrilliantYuKaimin <91609464+BrilliantYuKaimin@users.noreply.github.com> Date: Sat, 19 Mar 2022 17:39:38 +0800 Subject: [PATCH] Update test_pixel_unshuffle.py --- .../tests/unittests/test_pixel_unshuffle.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/python/paddle/fluid/tests/unittests/test_pixel_unshuffle.py b/python/paddle/fluid/tests/unittests/test_pixel_unshuffle.py index dd1ba296f3300..928754151578e 100644 --- a/python/paddle/fluid/tests/unittests/test_pixel_unshuffle.py +++ b/python/paddle/fluid/tests/unittests/test_pixel_unshuffle.py @@ -23,26 +23,27 @@ import paddle.fluid.core as core import paddle.fluid as fluid +paddle.enable_static() def pixel_unshuffle_np(x, down_factor, data_format="NCHW"): if data_format == "NCHW": n, c, h, w = x.shape - new_shape = (n, c, h / down_factor, down_factor, - w / down_factor, down_factor) + new_shape = (n, c, h // down_factor, down_factor, + w // down_factor, down_factor) npresult = np.reshape(x, new_shape) npresult = npresult.transpose(0, 1, 3, 5, 2, 4) - oshape = [n, c * down_factor * down_factor, h / down_factor, - w / down_factor] + oshape = [n, c * down_factor * down_factor, h // down_factor, + w // down_factor] npresult = np.reshape(npresult, oshape) return npresult else: n, h, w, c = x.shape - new_shape = (n, h / down_factor, down_factor, - w / down_factor, down_factor, c) + new_shape = (n, h // down_factor, down_factor, + w // down_factor, down_factor, c) npresult = np.reshape(x, new_shape) npresult = npresult.transpose(0, 1, 3, 5, 2, 4) - oshape = [n, h / down_factor, - w / down_factor, c * down_factor * down_factor] + oshape = [n, h // down_factor, + w // down_factor, c * down_factor * down_factor] npresult = np.reshape(npresult, oshape) return npresult