提交 470d6717 编写于 作者: C chengduoZH

follow comment

上级 46bc0fec
...@@ -1431,8 +1431,8 @@ def sequence_last_step(input): ...@@ -1431,8 +1431,8 @@ def sequence_last_step(input):
def pool2d(input, def pool2d(input,
pool_size, pool_size=-1,
pool_type, pool_type="max",
pool_stride=1, pool_stride=1,
pool_padding=0, pool_padding=0,
global_pooling=False, global_pooling=False,
...@@ -1447,6 +1447,11 @@ def pool2d(input, ...@@ -1447,6 +1447,11 @@ def pool2d(input,
"Unknown pool_type: '%s'. It can only be 'max' or 'avg'.", "Unknown pool_type: '%s'. It can only be 'max' or 'avg'.",
str(pool_type)) str(pool_type))
if global_pooling is False and pool_size == -1:
raise ValueError(
"When the global_pooling is False, pool_size must be passed "
"and be a valid value. Received pool_size: " + str(pool_size))
pool_size = utils.convert_to_list(pool_size, 2, 'pool_size') pool_size = utils.convert_to_list(pool_size, 2, 'pool_size')
pool_padding = utils.convert_to_list(pool_padding, 2, 'pool_padding') pool_padding = utils.convert_to_list(pool_padding, 2, 'pool_padding')
pool_stride = utils.convert_to_list(pool_stride, 2, 'pool_stride') pool_stride = utils.convert_to_list(pool_stride, 2, 'pool_stride')
......
...@@ -47,7 +47,7 @@ def convert_to_list(value, n, name): ...@@ -47,7 +47,7 @@ def convert_to_list(value, n, name):
int(single_value) int(single_value)
except (ValueError, TypeError): except (ValueError, TypeError):
raise ValueError( raise ValueError(
"The " + name + "'s must be a list or tuple of " + str( "The " + name + "'s type must be a list or tuple of " + str(
n) + " integers. Received: " + str(value) + " " n) + " integers. Received: " + str(value) + " "
"including element " + str(single_value) + " of type" + " " "including element " + str(single_value) + " of type" + " "
+ str(type(single_value))) + str(type(single_value)))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册