提交 49ca2e00 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Merge pull request #3729 from f0k/fix-conv2d-interface

Fix errors in conv2d() -> abstract_conv.conv2d() wrapper
...@@ -35,9 +35,9 @@ from .bn import batch_normalization ...@@ -35,9 +35,9 @@ from .bn import batch_normalization
import warnings import warnings
from .abstract_conv import conv2d as abstract_conv2d from .abstract_conv import conv2d as abstract_conv2d
def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None, def conv2d(input, filters, input_shape=None, filter_shape=None,
border_mode='valid', subsample=(1, 1), filter_flip=True, border_mode='valid', subsample=(1, 1), filter_flip=True,
**kargs): image_shape=None, **kwargs):
""" """
This function will build the symbolic graph for convolving a mini-batch of a This function will build the symbolic graph for convolving a mini-batch of a
stack of 2D inputs with a set of 2D filters. The implementation is modelled stack of 2D inputs with a set of 2D filters. The implementation is modelled
...@@ -53,9 +53,6 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None ...@@ -53,9 +53,6 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None
(output channels, input channels, filter rows, filter columns). (output channels, input channels, filter rows, filter columns).
See the optional parameter ``filter_shape``. See the optional parameter ``filter_shape``.
:type image_shape: None, tuple/list of len 4 of int or Constant variable
:param image_shape Deprecated, use input_shape instead
:type input_shape: None, tuple/list of len 4 of int or Constant variable :type input_shape: None, tuple/list of len 4 of int or Constant variable
:param input_shape: The shape of the input parameter. :param input_shape: The shape of the input parameter.
Optional, possibly used to choose an optimal implementation. Optional, possibly used to choose an optimal implementation.
...@@ -93,21 +90,27 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None ...@@ -93,21 +90,27 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None
to as a convolution, and this is the default. If ``False``, the filters to as a convolution, and this is the default. If ``False``, the filters
are not flipped and the operation is referred to as a cross-correlation. are not flipped and the operation is referred to as a cross-correlation.
:type image_shape: None, tuple/list of len 4 of int or Constant variable
:param image_shape Deprecated alias for `input_shape`
:param **kwargs Any other keyword arguments are accepted for backwards
compatibility, but will be ignored.
:rtype: symbolic 4D tensor :rtype: symbolic 4D tensor
:return: set of feature maps generated by convolutional layer. Tensor is :return: set of feature maps generated by convolutional layer. Tensor is
of shape (batch size, output channels, output rows, output columns) of shape (batch size, output channels, output rows, output columns)
""" """
if len(kargs.keys()) > 0: if len(kwargs.keys()) > 0:
warnings.warn(str(kargs.keys()) + warnings.warn(str(kwargs.keys()) +
" are now deprecated in " " are now deprecated in "
"`tensor.nnet.abstract_conv.conv2d` interface" "`tensor.nnet.abstract_conv.conv2d` interface"
" and will be ignored.") " and will be ignored.")
if image_shape is not None: if image_shape is not None:
warnings.warn("image_shape is no longer supported in " warnings.warn("The `image_shape` keyword argument to "
"`tensor.nnet.abstract_conv.conv2d` interface" "`tensor.nnet.conv2d` is deprecated, it has been "
" use input_shape instead.") "renamed to `input_shape`.")
if input_shape is None: if input_shape is None:
input_shape = image_shape input_shape = image_shape
else: else:
...@@ -115,6 +118,6 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None ...@@ -115,6 +118,6 @@ def conv2d(input, filters, input_shape=None, image_shape=None, filter_shape=None
" be provided at the same time.") " be provided at the same time.")
return abstract_conv2d(input, filters, input_shape, filter_shape, return abstract_conv2d(input, filters, input_shape, filter_shape,
border_mode, subsample=(1, 1)) border_mode, subsample, filter_flip)
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论