We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Add `conv2d_transpose` method to `theano.tensor.nnet.abstract_conv`
... and make it available in `theano.tensor.nnet`.
The semantics and name of the parameters was discussed IRL with @vdumoulin and @fvisin .

This is a follow-up to #3681 and #3872.


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `theano/tensor/nnet/__init__.py`
Content:
```
1 from __future__ import absolute_import, print_function, division
2 from .nnet import (
3     CrossentropyCategorical1Hot, CrossentropyCategorical1HotGrad,
4     CrossentropySoftmax1HotWithBiasDx, CrossentropySoftmaxArgmax1HotWithBias,
5     LogSoftmax, Prepend_scalar_constant_to_each_row,
6     Prepend_scalar_to_each_row, Softmax,
7     SoftmaxGrad, SoftmaxWithBias, binary_crossentropy,
8     categorical_crossentropy, crossentropy_categorical_1hot,
9     crossentropy_categorical_1hot_grad, crossentropy_softmax_1hot,
10     crossentropy_softmax_1hot_with_bias,
11     crossentropy_softmax_1hot_with_bias_dx,
12     crossentropy_softmax_argmax_1hot_with_bias,
13     crossentropy_softmax_max_and_argmax_1hot,
14     crossentropy_softmax_max_and_argmax_1hot_with_bias,
15     crossentropy_to_crossentropy_with_softmax,
16     crossentropy_to_crossentropy_with_softmax_with_bias,
17     graph_merge_softmax_with_crossentropy_softmax, h_softmax,
18     logsoftmax, logsoftmax_op, prepend_0_to_each_row, prepend_1_to_each_row,
19     prepend_scalar_to_each_row, relu, softmax, softmax_grad, softmax_graph,
20     softmax_op, softmax_simplifier, softmax_with_bias, elu,
21     confusion_matrix)
22 from . import opt
23 from .conv import ConvOp
24 from .Conv3D import *
25 from .ConvGrad3D import *
26 from .ConvTransp3D import *
27 from .sigm import (softplus, sigmoid, sigmoid_inplace,
28                    scalar_sigmoid, ultra_fast_sigmoid,
29                    hard_sigmoid)
30 from .bn import batch_normalization
31 
32 
33 import warnings
34 from .abstract_conv import conv2d as abstract_conv2d
35 from .abstract_conv import conv3d
36 
37 
38 def conv2d(input, filters, input_shape=None, filter_shape=None,
39            border_mode='valid', subsample=(1, 1), filter_flip=True,
40            image_shape=None, filter_dilation=(1, 1), **kwargs):
41     """
42     This function will build the symbolic graph for convolving a mini-batch of a
43     stack of 2D inputs with a set of 2D filters. The implementation is modelled
44     after Convolutional Neural Networks (CNN).
45 
46 
47     Parameters
48     ----------
49     input: symbolic 4D tensor
50         Mini-batch of feature map stacks, of shape
51         (batch size, input channels, input rows, input columns).
52         See the optional parameter ``input_shape``.
53 
54     filters: symbolic 4D tensor
55         Set of filters used in CNN layer of shape
56         (output channels, input channels, filter rows, filter columns).
57         See the optional parameter ``filter_shape``.
58 
59     input_shape: None, tuple/list of len 4 of int or Constant variable
60         The shape of the input parameter.
61         Optional, possibly used to choose an optimal implementation.
62         You can give ``None`` for any element of the list to specify that this
63         element is not known at compile time.
64 
65     filter_shape: None, tuple/list of len 4 of int or Constant variable
66         The shape of the filters parameter.
67         Optional, possibly used to choose an optimal implementation.
68         You can give ``None`` for any element of the list to specify that this
69         element is not known at compile time.
70 
71     border_mode: str, int or tuple of two int
72         Either of the following:
73 
74         ``'valid'``: apply filter wherever it completely overlaps with the
75             input. Generates output of shape: input shape - filter shape + 1
76         ``'full'``: apply filter wherever it partly overlaps with the input.
77             Generates output of shape: input shape + filter shape - 1
78         ``'half'``: pad input with a symmetric border of ``filter rows // 2``
79             rows and ``filter columns // 2`` columns, then perform a valid
80             convolution. For filters with an odd number of rows and columns, this
81             leads to the output shape being equal to the input shape.
82         ``int``: pad input with a symmetric border of zeros of the given
83             width, then perform a valid convolution.
84         ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows
85             and ``int2`` columns, then perform a valid convolution.
86 
87     subsample: tuple of len 2
88         Factor by which to subsample the output.
89         Also called strides elsewhere.
90 
91     filter_flip: bool
92         If ``True``, will flip the filter rows and columns
93         before sliding them over the input. This operation is normally referred
94         to as a convolution, and this is the default. If ``False``, the filters
95         are not flipped and the operation is referred to as a cross-correlation.
96 
97     image_shape: None, tuple/list of len 4 of int or Constant variable
98         Deprecated alias for input_shape.
99 
100     filter_dilation: tuple of len 2
101         Factor by which to subsample (stride) the input.
102         Also called dilation elsewhere.
103 
104     kwargs: Any other keyword arguments are accepted for backwards
105             compatibility, but will be ignored.
106 
107     Returns
108     -------
109     Symbolic 4D tensor
110         Set of feature maps generated by convolutional layer. Tensor is
111         of shape (batch size, output channels, output rows, output columns)
112 
113     Notes
114     -----
115         If cuDNN is available, it will be used on the
116         GPU. Otherwise, it is the *CorrMM* convolution that will be used
117         "caffe style convolution".
118 
119         This is only supported in Theano 0.8 or the development
120         version until it is released.
121 
122         The parameter filter_dilation is an implementation of `dilated
123         convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.
124 
125     """
126 
127     if 'imshp_logical' in kwargs or 'kshp_logical' in kwargs:
128         raise ValueError(
129             "Keyword arguments 'imshp_logical' and 'kshp_logical' for conv2d "
130             "are not supported anymore (and have not been a reliable way to "
131             "perform upsampling). That feature is still available by calling "
132             "theano.tensor.nnet.conv.conv2d() for the time being.")
133     if len(kwargs.keys()) > 0:
134         warnings.warn(str(kwargs.keys()) +
135                       " are now deprecated in "
136                       "`tensor.nnet.abstract_conv.conv2d` interface"
137                       " and will be ignored.",
138                       stacklevel=2)
139 
140     if image_shape is not None:
141         warnings.warn("The `image_shape` keyword argument to "
142                       "`tensor.nnet.conv2d` is deprecated, it has been "
143                       "renamed to `input_shape`.",
144                       stacklevel=2)
145         if input_shape is None:
146             input_shape = image_shape
147         else:
148             raise ValueError("input_shape and image_shape should not"
149                              " be provided at the same time.")
150 
151     return abstract_conv2d(input, filters, input_shape, filter_shape,
152                            border_mode, subsample, filter_flip,
153                            filter_dilation)
154
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/theano/tensor/nnet/__init__.py b/theano/tensor/nnet/__init__.py
--- a/theano/tensor/nnet/__init__.py
+++ b/theano/tensor/nnet/__init__.py
@@ -32,6 +32,7 @@
 
 import warnings
 from .abstract_conv import conv2d as abstract_conv2d
+from .abstract_conv import conv2d_grad_wrt_inputs
 from .abstract_conv import conv3d
 
 
@@ -151,3 +152,86 @@
     return abstract_conv2d(input, filters, input_shape, filter_shape,
                            border_mode, subsample, filter_flip,
                            filter_dilation)
+
+
+def conv2d_transpose(input, filters, output_shape, filter_shape=None,
+                     border_mode='valid', input_dilation=(1, 1),
+                     filter_flip=True, filter_dilation=(1, 1)):
+    """
+    This function will build the symbolic graph for applying a transposed
+    convolution over a mini-batch of a stack of 2D inputs with a set of 2D
+    filters.
+
+
+    Parameters
+    ----------
+    input: symbolic 4D tensor
+        Mini-batch of feature map stacks, of shape
+        (batch size, input channels, input rows, input columns).
+        See the optional parameter ``input_shape``.
+
+    filters: symbolic 4D tensor
+        Set of filters used in CNN layer of shape
+        (input channels, output channels, filter rows, filter columns).
+        See the optional parameter ``filter_shape``. **Note: the order for
+        ``output_channels`` and ``input_channels`` is reversed with respect to
+        ``conv2d``.**
+
+    output_shape: tuple/list of len 4 of int or Constant variable
+        The shape of the output of ``conv2d_transpose``. The last two elements
+        are allowed to be ``tensor.scalar`` variables.
+
+    filter_shape: None, tuple/list of len 4 of int or Constant variable
+        The shape of the filters parameter.
+        Optional, possibly used to choose an optimal implementation.
+        You can give ``None`` for any element of the list to specify that this
+        element is not known at compile time.
+
+    border_mode: str, int or tuple of two int
+        Refers to the ``border_mode`` argument of the corresponding forward
+        (non-transposed) convolution. See the argument description in
+        ``conv2d``.  What was ``padding`` for the forward convolution means
+        ``cropping`` the output of the transposed one. ``valid`` corresponds to
+        no cropping, ``full`` to maximal cropping.
+
+    input_dilation: tuple of len 2
+        Corresponds to ``subsample`` (also called strides elsewhere) in the
+        non-transposed convolution.
+
+    filter_flip: bool
+        If ``True``, will flip the filter rows and columns
+        before sliding them over the input. This operation is normally referred
+        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.
+
+    filter_dilation: tuple of len 2
+        Factor by which to subsample (stride) the input.
+        Also called dilation elsewhere.
+
+    Returns
+    -------
+    Symbolic 4D tensor
+        Set of feature maps generated by the transposed convolution. Tensor is
+        of shape (batch size, output channels, output rows, output columns)
+
+    Notes
+    -----
+        If cuDNN is available, it will be used on the
+        GPU. Otherwise, it is the *CorrMM* convolution that will be used
+        "caffe style convolution".
+
+        This operation is also sometimes called "deconvolution".
+
+        The parameter filter_dilation is an implementation of `dilated
+        convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.
+
+    """
+
+    return conv2d_grad_wrt_inputs(output_grad=input,
+                                  filters=filters,
+                                  input_shape=output_shape,
+                                  filter_shape=filter_shape,
+                                  border_mode=border_mode,
+                                  subsample=input_dilation,
+                                  filter_flip=filter_flip,
+                                  filter_dilation=filter_dilation)

{"golden_diff": "diff --git a/theano/tensor/nnet/__init__.py b/theano/tensor/nnet/__init__.py\n--- a/theano/tensor/nnet/__init__.py\n+++ b/theano/tensor/nnet/__init__.py\n@@ -32,6 +32,7 @@\n \n import warnings\n from .abstract_conv import conv2d as abstract_conv2d\n+from .abstract_conv import conv2d_grad_wrt_inputs\n from .abstract_conv import conv3d\n \n \n@@ -151,3 +152,86 @@\n     return abstract_conv2d(input, filters, input_shape, filter_shape,\n                            border_mode, subsample, filter_flip,\n                            filter_dilation)\n+\n+\n+def conv2d_transpose(input, filters, output_shape, filter_shape=None,\n+                     border_mode='valid', input_dilation=(1, 1),\n+                     filter_flip=True, filter_dilation=(1, 1)):\n+    \"\"\"\n+    This function will build the symbolic graph for applying a transposed\n+    convolution over a mini-batch of a stack of 2D inputs with a set of 2D\n+    filters.\n+\n+\n+    Parameters\n+    ----------\n+    input: symbolic 4D tensor\n+        Mini-batch of feature map stacks, of shape\n+        (batch size, input channels, input rows, input columns).\n+        See the optional parameter ``input_shape``.\n+\n+    filters: symbolic 4D tensor\n+        Set of filters used in CNN layer of shape\n+        (input channels, output channels, filter rows, filter columns).\n+        See the optional parameter ``filter_shape``. **Note: the order for\n+        ``output_channels`` and ``input_channels`` is reversed with respect to\n+        ``conv2d``.**\n+\n+    output_shape: tuple/list of len 4 of int or Constant variable\n+        The shape of the output of ``conv2d_transpose``. The last two elements\n+        are allowed to be ``tensor.scalar`` variables.\n+\n+    filter_shape: None, tuple/list of len 4 of int or Constant variable\n+        The shape of the filters parameter.\n+        Optional, possibly used to choose an optimal implementation.\n+        You can give ``None`` for any element of the list to specify that this\n+        element is not known at compile time.\n+\n+    border_mode: str, int or tuple of two int\n+        Refers to the ``border_mode`` argument of the corresponding forward\n+        (non-transposed) convolution. See the argument description in\n+        ``conv2d``.  What was ``padding`` for the forward convolution means\n+        ``cropping`` the output of the transposed one. ``valid`` corresponds to\n+        no cropping, ``full`` to maximal cropping.\n+\n+    input_dilation: tuple of len 2\n+        Corresponds to ``subsample`` (also called strides elsewhere) in the\n+        non-transposed convolution.\n+\n+    filter_flip: bool\n+        If ``True``, will flip the filter rows and columns\n+        before sliding them over the input. This operation is normally referred\n+        to as a convolution, and this is the default. If ``False``, the filters\n+        are not flipped and the operation is referred to as a cross-correlation.\n+\n+    filter_dilation: tuple of len 2\n+        Factor by which to subsample (stride) the input.\n+        Also called dilation elsewhere.\n+\n+    Returns\n+    -------\n+    Symbolic 4D tensor\n+        Set of feature maps generated by the transposed convolution. Tensor is\n+        of shape (batch size, output channels, output rows, output columns)\n+\n+    Notes\n+    -----\n+        If cuDNN is available, it will be used on the\n+        GPU. Otherwise, it is the *CorrMM* convolution that will be used\n+        \"caffe style convolution\".\n+\n+        This operation is also sometimes called \"deconvolution\".\n+\n+        The parameter filter_dilation is an implementation of `dilated\n+        convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.\n+\n+    \"\"\"\n+\n+    return conv2d_grad_wrt_inputs(output_grad=input,\n+                                  filters=filters,\n+                                  input_shape=output_shape,\n+                                  filter_shape=filter_shape,\n+                                  border_mode=border_mode,\n+                                  subsample=input_dilation,\n+                                  filter_flip=filter_flip,\n+                                  filter_dilation=filter_dilation)\n", "issue": "Add `conv2d_transpose` method to `theano.tensor.nnet.abstract_conv`\n... and make it available in `theano.tensor.nnet`.\nThe semantics and name of the parameters was discussed IRL with @vdumoulin and @fvisin .\n\nThis is a follow-up to #3681 and #3872.\n\n", "before_files": [{"content": "from __future__ import absolute_import, print_function, division\nfrom .nnet import (\n    CrossentropyCategorical1Hot, CrossentropyCategorical1HotGrad,\n    CrossentropySoftmax1HotWithBiasDx, CrossentropySoftmaxArgmax1HotWithBias,\n    LogSoftmax, Prepend_scalar_constant_to_each_row,\n    Prepend_scalar_to_each_row, Softmax,\n    SoftmaxGrad, SoftmaxWithBias, binary_crossentropy,\n    categorical_crossentropy, crossentropy_categorical_1hot,\n    crossentropy_categorical_1hot_grad, crossentropy_softmax_1hot,\n    crossentropy_softmax_1hot_with_bias,\n    crossentropy_softmax_1hot_with_bias_dx,\n    crossentropy_softmax_argmax_1hot_with_bias,\n    crossentropy_softmax_max_and_argmax_1hot,\n    crossentropy_softmax_max_and_argmax_1hot_with_bias,\n    crossentropy_to_crossentropy_with_softmax,\n    crossentropy_to_crossentropy_with_softmax_with_bias,\n    graph_merge_softmax_with_crossentropy_softmax, h_softmax,\n    logsoftmax, logsoftmax_op, prepend_0_to_each_row, prepend_1_to_each_row,\n    prepend_scalar_to_each_row, relu, softmax, softmax_grad, softmax_graph,\n    softmax_op, softmax_simplifier, softmax_with_bias, elu,\n    confusion_matrix)\nfrom . import opt\nfrom .conv import ConvOp\nfrom .Conv3D import *\nfrom .ConvGrad3D import *\nfrom .ConvTransp3D import *\nfrom .sigm import (softplus, sigmoid, sigmoid_inplace,\n                   scalar_sigmoid, ultra_fast_sigmoid,\n                   hard_sigmoid)\nfrom .bn import batch_normalization\n\n\nimport warnings\nfrom .abstract_conv import conv2d as abstract_conv2d\nfrom .abstract_conv import conv3d\n\n\ndef conv2d(input, filters, input_shape=None, filter_shape=None,\n           border_mode='valid', subsample=(1, 1), filter_flip=True,\n           image_shape=None, filter_dilation=(1, 1), **kwargs):\n    \"\"\"\n    This function will build the symbolic graph for convolving a mini-batch of a\n    stack of 2D inputs with a set of 2D filters. The implementation is modelled\n    after Convolutional Neural Networks (CNN).\n\n\n    Parameters\n    ----------\n    input: symbolic 4D tensor\n        Mini-batch of feature map stacks, of shape\n        (batch size, input channels, input rows, input columns).\n        See the optional parameter ``input_shape``.\n\n    filters: symbolic 4D tensor\n        Set of filters used in CNN layer of shape\n        (output channels, input channels, filter rows, filter columns).\n        See the optional parameter ``filter_shape``.\n\n    input_shape: None, tuple/list of len 4 of int or Constant variable\n        The shape of the input parameter.\n        Optional, possibly used to choose an optimal implementation.\n        You can give ``None`` for any element of the list to specify that this\n        element is not known at compile time.\n\n    filter_shape: None, tuple/list of len 4 of int or Constant variable\n        The shape of the filters parameter.\n        Optional, possibly used to choose an optimal implementation.\n        You can give ``None`` for any element of the list to specify that this\n        element is not known at compile time.\n\n    border_mode: str, int or tuple of two int\n        Either of the following:\n\n        ``'valid'``: apply filter wherever it completely overlaps with the\n            input. Generates output of shape: input shape - filter shape + 1\n        ``'full'``: apply filter wherever it partly overlaps with the input.\n            Generates output of shape: input shape + filter shape - 1\n        ``'half'``: pad input with a symmetric border of ``filter rows // 2``\n            rows and ``filter columns // 2`` columns, then perform a valid\n            convolution. For filters with an odd number of rows and columns, this\n            leads to the output shape being equal to the input shape.\n        ``int``: pad input with a symmetric border of zeros of the given\n            width, then perform a valid convolution.\n        ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows\n            and ``int2`` columns, then perform a valid convolution.\n\n    subsample: tuple of len 2\n        Factor by which to subsample the output.\n        Also called strides elsewhere.\n\n    filter_flip: bool\n        If ``True``, will flip the filter rows and columns\n        before sliding them over the input. This operation is normally referred\n        to as a convolution, and this is the default. If ``False``, the filters\n        are not flipped and the operation is referred to as a cross-correlation.\n\n    image_shape: None, tuple/list of len 4 of int or Constant variable\n        Deprecated alias for input_shape.\n\n    filter_dilation: tuple of len 2\n        Factor by which to subsample (stride) the input.\n        Also called dilation elsewhere.\n\n    kwargs: Any other keyword arguments are accepted for backwards\n            compatibility, but will be ignored.\n\n    Returns\n    -------\n    Symbolic 4D tensor\n        Set of feature maps generated by convolutional layer. Tensor is\n        of shape (batch size, output channels, output rows, output columns)\n\n    Notes\n    -----\n        If cuDNN is available, it will be used on the\n        GPU. Otherwise, it is the *CorrMM* convolution that will be used\n        \"caffe style convolution\".\n\n        This is only supported in Theano 0.8 or the development\n        version until it is released.\n\n        The parameter filter_dilation is an implementation of `dilated\n        convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.\n\n    \"\"\"\n\n    if 'imshp_logical' in kwargs or 'kshp_logical' in kwargs:\n        raise ValueError(\n            \"Keyword arguments 'imshp_logical' and 'kshp_logical' for conv2d \"\n            \"are not supported anymore (and have not been a reliable way to \"\n            \"perform upsampling). That feature is still available by calling \"\n            \"theano.tensor.nnet.conv.conv2d() for the time being.\")\n    if len(kwargs.keys()) > 0:\n        warnings.warn(str(kwargs.keys()) +\n                      \" are now deprecated in \"\n                      \"`tensor.nnet.abstract_conv.conv2d` interface\"\n                      \" and will be ignored.\",\n                      stacklevel=2)\n\n    if image_shape is not None:\n        warnings.warn(\"The `image_shape` keyword argument to \"\n                      \"`tensor.nnet.conv2d` is deprecated, it has been \"\n                      \"renamed to `input_shape`.\",\n                      stacklevel=2)\n        if input_shape is None:\n            input_shape = image_shape\n        else:\n            raise ValueError(\"input_shape and image_shape should not\"\n                             \" be provided at the same time.\")\n\n    return abstract_conv2d(input, filters, input_shape, filter_shape,\n                           border_mode, subsample, filter_flip,\n                           filter_dilation)\n", "path": "theano/tensor/nnet/__init__.py"}], "after_files": [{"content": "from __future__ import absolute_import, print_function, division\nfrom .nnet import (\n    CrossentropyCategorical1Hot, CrossentropyCategorical1HotGrad,\n    CrossentropySoftmax1HotWithBiasDx, CrossentropySoftmaxArgmax1HotWithBias,\n    LogSoftmax, Prepend_scalar_constant_to_each_row,\n    Prepend_scalar_to_each_row, Softmax,\n    SoftmaxGrad, SoftmaxWithBias, binary_crossentropy,\n    categorical_crossentropy, crossentropy_categorical_1hot,\n    crossentropy_categorical_1hot_grad, crossentropy_softmax_1hot,\n    crossentropy_softmax_1hot_with_bias,\n    crossentropy_softmax_1hot_with_bias_dx,\n    crossentropy_softmax_argmax_1hot_with_bias,\n    crossentropy_softmax_max_and_argmax_1hot,\n    crossentropy_softmax_max_and_argmax_1hot_with_bias,\n    crossentropy_to_crossentropy_with_softmax,\n    crossentropy_to_crossentropy_with_softmax_with_bias,\n    graph_merge_softmax_with_crossentropy_softmax, h_softmax,\n    logsoftmax, logsoftmax_op, prepend_0_to_each_row, prepend_1_to_each_row,\n    prepend_scalar_to_each_row, relu, softmax, softmax_grad, softmax_graph,\n    softmax_op, softmax_simplifier, softmax_with_bias, elu,\n    confusion_matrix)\nfrom . import opt\nfrom .conv import ConvOp\nfrom .Conv3D import *\nfrom .ConvGrad3D import *\nfrom .ConvTransp3D import *\nfrom .sigm import (softplus, sigmoid, sigmoid_inplace,\n                   scalar_sigmoid, ultra_fast_sigmoid,\n                   hard_sigmoid)\nfrom .bn import batch_normalization\n\n\nimport warnings\nfrom .abstract_conv import conv2d as abstract_conv2d\nfrom .abstract_conv import conv2d_grad_wrt_inputs\nfrom .abstract_conv import conv3d\n\n\ndef conv2d(input, filters, input_shape=None, filter_shape=None,\n           border_mode='valid', subsample=(1, 1), filter_flip=True,\n           image_shape=None, filter_dilation=(1, 1), **kwargs):\n    \"\"\"\n    This function will build the symbolic graph for convolving a mini-batch of a\n    stack of 2D inputs with a set of 2D filters. The implementation is modelled\n    after Convolutional Neural Networks (CNN).\n\n\n    Parameters\n    ----------\n    input: symbolic 4D tensor\n        Mini-batch of feature map stacks, of shape\n        (batch size, input channels, input rows, input columns).\n        See the optional parameter ``input_shape``.\n\n    filters: symbolic 4D tensor\n        Set of filters used in CNN layer of shape\n        (output channels, input channels, filter rows, filter columns).\n        See the optional parameter ``filter_shape``.\n\n    input_shape: None, tuple/list of len 4 of int or Constant variable\n        The shape of the input parameter.\n        Optional, possibly used to choose an optimal implementation.\n        You can give ``None`` for any element of the list to specify that this\n        element is not known at compile time.\n\n    filter_shape: None, tuple/list of len 4 of int or Constant variable\n        The shape of the filters parameter.\n        Optional, possibly used to choose an optimal implementation.\n        You can give ``None`` for any element of the list to specify that this\n        element is not known at compile time.\n\n    border_mode: str, int or tuple of two int\n        Either of the following:\n\n        ``'valid'``: apply filter wherever it completely overlaps with the\n            input. Generates output of shape: input shape - filter shape + 1\n        ``'full'``: apply filter wherever it partly overlaps with the input.\n            Generates output of shape: input shape + filter shape - 1\n        ``'half'``: pad input with a symmetric border of ``filter rows // 2``\n            rows and ``filter columns // 2`` columns, then perform a valid\n            convolution. For filters with an odd number of rows and columns, this\n            leads to the output shape being equal to the input shape.\n        ``int``: pad input with a symmetric border of zeros of the given\n            width, then perform a valid convolution.\n        ``(int1, int2)``: pad input with a symmetric border of ``int1`` rows\n            and ``int2`` columns, then perform a valid convolution.\n\n    subsample: tuple of len 2\n        Factor by which to subsample the output.\n        Also called strides elsewhere.\n\n    filter_flip: bool\n        If ``True``, will flip the filter rows and columns\n        before sliding them over the input. This operation is normally referred\n        to as a convolution, and this is the default. If ``False``, the filters\n        are not flipped and the operation is referred to as a cross-correlation.\n\n    image_shape: None, tuple/list of len 4 of int or Constant variable\n        Deprecated alias for input_shape.\n\n    filter_dilation: tuple of len 2\n        Factor by which to subsample (stride) the input.\n        Also called dilation elsewhere.\n\n    kwargs: Any other keyword arguments are accepted for backwards\n            compatibility, but will be ignored.\n\n    Returns\n    -------\n    Symbolic 4D tensor\n        Set of feature maps generated by convolutional layer. Tensor is\n        of shape (batch size, output channels, output rows, output columns)\n\n    Notes\n    -----\n        If cuDNN is available, it will be used on the\n        GPU. Otherwise, it is the *CorrMM* convolution that will be used\n        \"caffe style convolution\".\n\n        This is only supported in Theano 0.8 or the development\n        version until it is released.\n\n        The parameter filter_dilation is an implementation of `dilated\n        convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.\n\n    \"\"\"\n\n    if 'imshp_logical' in kwargs or 'kshp_logical' in kwargs:\n        raise ValueError(\n            \"Keyword arguments 'imshp_logical' and 'kshp_logical' for conv2d \"\n            \"are not supported anymore (and have not been a reliable way to \"\n            \"perform upsampling). That feature is still available by calling \"\n            \"theano.tensor.nnet.conv.conv2d() for the time being.\")\n    if len(kwargs.keys()) > 0:\n        warnings.warn(str(kwargs.keys()) +\n                      \" are now deprecated in \"\n                      \"`tensor.nnet.abstract_conv.conv2d` interface\"\n                      \" and will be ignored.\",\n                      stacklevel=2)\n\n    if image_shape is not None:\n        warnings.warn(\"The `image_shape` keyword argument to \"\n                      \"`tensor.nnet.conv2d` is deprecated, it has been \"\n                      \"renamed to `input_shape`.\",\n                      stacklevel=2)\n        if input_shape is None:\n            input_shape = image_shape\n        else:\n            raise ValueError(\"input_shape and image_shape should not\"\n                             \" be provided at the same time.\")\n\n    return abstract_conv2d(input, filters, input_shape, filter_shape,\n                           border_mode, subsample, filter_flip,\n                           filter_dilation)\n\n\ndef conv2d_transpose(input, filters, output_shape, filter_shape=None,\n                     border_mode='valid', input_dilation=(1, 1),\n                     filter_flip=True, filter_dilation=(1, 1)):\n    \"\"\"\n    This function will build the symbolic graph for applying a transposed\n    convolution over a mini-batch of a stack of 2D inputs with a set of 2D\n    filters.\n\n\n    Parameters\n    ----------\n    input: symbolic 4D tensor\n        Mini-batch of feature map stacks, of shape\n        (batch size, input channels, input rows, input columns).\n        See the optional parameter ``input_shape``.\n\n    filters: symbolic 4D tensor\n        Set of filters used in CNN layer of shape\n        (input channels, output channels, filter rows, filter columns).\n        See the optional parameter ``filter_shape``. **Note: the order for\n        ``output_channels`` and ``input_channels`` is reversed with respect to\n        ``conv2d``.**\n\n    output_shape: tuple/list of len 4 of int or Constant variable\n        The shape of the output of ``conv2d_transpose``. The last two elements\n        are allowed to be ``tensor.scalar`` variables.\n\n    filter_shape: None, tuple/list of len 4 of int or Constant variable\n        The shape of the filters parameter.\n        Optional, possibly used to choose an optimal implementation.\n        You can give ``None`` for any element of the list to specify that this\n        element is not known at compile time.\n\n    border_mode: str, int or tuple of two int\n        Refers to the ``border_mode`` argument of the corresponding forward\n        (non-transposed) convolution. See the argument description in\n        ``conv2d``.  What was ``padding`` for the forward convolution means\n        ``cropping`` the output of the transposed one. ``valid`` corresponds to\n        no cropping, ``full`` to maximal cropping.\n\n    input_dilation: tuple of len 2\n        Corresponds to ``subsample`` (also called strides elsewhere) in the\n        non-transposed convolution.\n\n    filter_flip: bool\n        If ``True``, will flip the filter rows and columns\n        before sliding them over the input. This operation is normally referred\n        to as a convolution, and this is the default. If ``False``, the filters\n        are not flipped and the operation is referred to as a cross-correlation.\n\n    filter_dilation: tuple of len 2\n        Factor by which to subsample (stride) the input.\n        Also called dilation elsewhere.\n\n    Returns\n    -------\n    Symbolic 4D tensor\n        Set of feature maps generated by the transposed convolution. Tensor is\n        of shape (batch size, output channels, output rows, output columns)\n\n    Notes\n    -----\n        If cuDNN is available, it will be used on the\n        GPU. Otherwise, it is the *CorrMM* convolution that will be used\n        \"caffe style convolution\".\n\n        This operation is also sometimes called \"deconvolution\".\n\n        The parameter filter_dilation is an implementation of `dilated\n        convolution <https://arxiv.org/pdf/1511.07122v3.pdf>`_.\n\n    \"\"\"\n\n    return conv2d_grad_wrt_inputs(output_grad=input,\n                                  filters=filters,\n                                  input_shape=output_shape,\n                                  filter_shape=filter_shape,\n                                  border_mode=border_mode,\n                                  subsample=input_dilation,\n                                  filter_flip=filter_flip,\n                                  filter_dilation=filter_dilation)\n", "path": "theano/tensor/nnet/__init__.py"}]}