From be3eedcc4a33eb58603dece238f038aed27d5a9c Mon Sep 17 00:00:00 2001 From: dengkaipeng Date: Mon, 1 Apr 2019 07:58:43 +0000 Subject: [PATCH] fix out_h/out_w calc when out_shape is Variable. test=develop --- python/paddle/fluid/layers/nn.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/python/paddle/fluid/layers/nn.py b/python/paddle/fluid/layers/nn.py index 48cce439d..c9e9dfd3c 100644 --- a/python/paddle/fluid/layers/nn.py +++ b/python/paddle/fluid/layers/nn.py @@ -7144,14 +7144,16 @@ def image_resize(input, it is recommended to use actual_shape instead of \ out_shape to specify output shape dynamically.") inputs['OutSize'] = out_shape - elif not (_is_list_or_turple_(out_shape)): - raise TypeError("out_shape should be a list or tuple or Variable.") - elif len(out_shape) != 2: - raise ValueError("out_shape length should be 2.") - - out_shape = list(map(int, out_shape)) - attrs['out_h'] = out_shape[0] - attrs['out_w'] = out_shape[1] + else: + if not (_is_list_or_turple_(out_shape)): + raise TypeError("out_shape should be a list or tuple or Variable.") + if len(out_shape) != 2: + raise ValueError("out_shape length should be 2.") + + out_shape = list(map(int, out_shape)) + attrs['out_h'] = out_shape[0] + attrs['out_w'] = out_shape[1] + else: if scale <= 0: raise ValueError("scale should be greater than zero.") -- GitLab