提交 941e3a27 authored 作者: Frederic Bastien's avatar Frederic Bastien

Use the same convention in Pool.__init__

上级 e3c121c8
...@@ -170,9 +170,7 @@ class Pool(OpenMPOp): ...@@ -170,9 +170,7 @@ class Pool(OpenMPOp):
'average_exc_pad' include it) 'average_exc_pad' include it)
ndim : int ndim : int
The number of pooling dimensions N. The number of pooling dimensions N.
If this number is not specified, the default is set to the If this number is not specified, the default is set to 2.
(input.ndim - 2), assuming that the first two dimensions of the input
are non-pooling dimensions.
""" """
...@@ -206,7 +204,7 @@ class Pool(OpenMPOp): ...@@ -206,7 +204,7 @@ class Pool(OpenMPOp):
right margins. No padding is added if padding is None. right margins. No padding is added if padding is None.
ndim : int ndim : int
The number of pooling dimensions N. The number of pooling dimensions N.
If this number is not specified, the default is set 2. If this number is not specified, the default is set to 2.
Returns Returns
------- -------
...@@ -257,6 +255,8 @@ class Pool(OpenMPOp): ...@@ -257,6 +255,8 @@ class Pool(OpenMPOp):
def __init__(self, ignore_border=False, mode='max', ndim=None, openmp=None): def __init__(self, ignore_border=False, mode='max', ndim=None, openmp=None):
super(Pool, self).__init__(openmp=openmp) super(Pool, self).__init__(openmp=openmp)
if ndim is None:
ndim = 2
self.ndim = ndim self.ndim = ndim
self.ignore_border = ignore_border self.ignore_border = ignore_border
if mode not in ['max', 'average_inc_pad', 'average_exc_pad', 'sum']: if mode not in ['max', 'average_inc_pad', 'average_exc_pad', 'sum']:
...@@ -299,8 +299,6 @@ class Pool(OpenMPOp): ...@@ -299,8 +299,6 @@ class Pool(OpenMPOp):
# TODO: consider restricting the dtype? # TODO: consider restricting the dtype?
x = tensor.as_tensor_variable(x) x = tensor.as_tensor_variable(x)
nd = self.ndim nd = self.ndim
if nd is None:
nd = x.type.ndim - 2
if stride is None: if stride is None:
stride = ws stride = ws
if pad is None: if pad is None:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论