提交 321e2fc6 authored 作者: Vikram's avatar Vikram

Documentation changes. Combpressing tuple of two identical integers

上级 dc9f87d0
...@@ -927,8 +927,11 @@ class GpuCorrMM(BaseGpuCorrMM): ...@@ -927,8 +927,11 @@ class GpuCorrMM(BaseGpuCorrMM):
``'valid'`` for ``(0, 0)`` (valid convolution, no padding), ``'full'`` ``'valid'`` for ``(0, 0)`` (valid convolution, no padding), ``'full'``
for ``(kernel_rows - 1, kernel_columns - 1)`` (full convolution), for ``(kernel_rows - 1, kernel_columns - 1)`` (full convolution),
``'half'`` for ``(kernel_rows // 2, kernel_columns // 2)`` (same ``'half'`` for ``(kernel_rows // 2, kernel_columns // 2)`` (same
convolution for odd-sized kernels). Note that the two widths are each convolution for odd-sized kernels).
applied twice, once per side (left and right, top and bottom). If it is a tuple containing 2 pairs of integers, then these specify
the padding to be applied on each side ((left, right), (top, bottom)).
Otherwise, each width is applied twice, once per side (left and right,
top and bottom).
subsample subsample
The subsample operation applied to each output image. The subsample operation applied to each output image.
Should be a tuple with 2 elements. Should be a tuple with 2 elements.
......
...@@ -1971,16 +1971,22 @@ class BaseAbstractConv(Op): ...@@ -1971,16 +1971,22 @@ class BaseAbstractConv(Op):
raise ValueError( raise ValueError(
'invalid border_mode {}, which must be a ' 'invalid border_mode {}, which must be a '
'tuple of length {}'.format(border_mode, convdim)) 'tuple of length {}'.format(border_mode, convdim))
new_border_mode = ()
for mode in border_mode: for mode in border_mode:
if isinstance(mode, tuple) and convdim != 2:
raise NotImplementedError(
'Asymmetric padding not implemented for {}D'.format(convdim))
if not((isinstance(mode, integer_types) and mode >= 0) or if not((isinstance(mode, integer_types) and mode >= 0) or
(isinstance(mode, tuple) and len(mode) == 2 and min(mode) >= 0 and (isinstance(mode, tuple) and len(mode) == 2 and min(mode) >= 0 and
all(isinstance(m, integer_types) for m in mode))): all(isinstance(m, integer_types) for m in mode))):
raise ValueError( raise ValueError(
'invalid border mode {}. The tuple can only contain integers ' 'invalid border mode {}. The tuple can only contain integers '
' or pairs of integers'.format(border_mode)) ' or pairs of integers'.format(border_mode))
if isinstance(mode, tuple):
if convdim != 2:
raise NotImplementedError(
'Asymmetric padding not implemented for {}D'.format(convdim))
if mode[0] == mode[1]:
mode = mode[0]
new_border_mode += (mode,)
border_mode = new_border_mode
elif border_mode not in ('valid', 'full', 'half'): elif border_mode not in ('valid', 'full', 'half'):
raise ValueError( raise ValueError(
'invalid border_mode {}, which must be either ' 'invalid border_mode {}, which must be either '
......
...@@ -603,8 +603,11 @@ class CorrMM(BaseCorrMM): ...@@ -603,8 +603,11 @@ class CorrMM(BaseCorrMM):
``'valid'`` for ``(0, 0)`` (valid convolution, no padding), ``'full'`` ``'valid'`` for ``(0, 0)`` (valid convolution, no padding), ``'full'``
for ``(kernel_rows - 1, kernel_columns - 1)`` (full convolution), for ``(kernel_rows - 1, kernel_columns - 1)`` (full convolution),
``'half'`` for ``(kernel_rows // 2, kernel_columns // 2)`` (same ``'half'`` for ``(kernel_rows // 2, kernel_columns // 2)`` (same
convolution for odd-sized kernels). Note that the two widths are each convolution for odd-sized kernels).
applied twice, once per side (left and right, top and bottom). If it is a tuple containing 2 pairs of integers, then these specify
the padding to be applied on each side ((left, right), (top, bottom)).
Otherwise, each width is applied twice, once per side (left and right,
top and bottom).
subsample subsample
The subsample operation applied to each output image. The subsample operation applied to each output image.
Should be a tuple with 2 elements. Should be a tuple with 2 elements.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论