提交 d1bfd2b0 authored 作者: Frederic Bastien's avatar Frederic Bastien

Convert border_mode=(0,0) to valid.

上级 0414f66e
...@@ -1145,6 +1145,8 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1), ...@@ -1145,6 +1145,8 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
:attr:`config.dnn.conv.precision`. :attr:`config.dnn.conv.precision`.
""" """
if border_mode == (0, 0):
border_mode = 'valid'
# Establish dtype in which to perform the computation of the convolution # Establish dtype in which to perform the computation of the convolution
if precision is None: if precision is None:
...@@ -1255,6 +1257,8 @@ def dnn_conv3d(img, kerns, border_mode='valid', subsample=(1, 1, 1), ...@@ -1255,6 +1257,8 @@ def dnn_conv3d(img, kerns, border_mode='valid', subsample=(1, 1, 1),
:warning: dnn_conv3d only works with cuDNN library 3.0 :warning: dnn_conv3d only works with cuDNN library 3.0
""" """
if border_mode == (0, 0):
border_mode = 'valid'
# Establish dtype in which to perform the computation of the convolution # Establish dtype in which to perform the computation of the convolution
if precision is None: if precision is None:
......
...@@ -370,6 +370,8 @@ class BaseAbstractConv2d(Op): ...@@ -370,6 +370,8 @@ class BaseAbstractConv2d(Op):
if isinstance(border_mode, tuple): if isinstance(border_mode, tuple):
pad_h, pad_w = map(int, border_mode) pad_h, pad_w = map(int, border_mode)
border_mode = (pad_h, pad_w) border_mode = (pad_h, pad_w)
if border_mode == (0, 0):
border_mode = 'valid'
if not ((isinstance(border_mode, tuple) and min(border_mode) >= 0) or if not ((isinstance(border_mode, tuple) and min(border_mode) >= 0) or
border_mode in ('valid', 'full', 'half')): border_mode in ('valid', 'full', 'half')):
raise ValueError( raise ValueError(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论