prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  TestConvolution2D.test_(forward, backward)_gpu_im2col does not check use_cudnn=False case
  `TestConvolution2D.test_forward_gpu_im2col` and `TestConvolution2D.test_backward_gpu_im2col` are expected to test `Convolution2DFunction.backward_gpu` works correctly when CuDNN is disabled.
  
  To achieve this, these test fixtures set `self.use_cudnn` attribute of the instance of `Convolution2D` to `False` . But what is actually passed to `convoluton_2d` function as `use_cudnn` option is the `use_cudnn` argument of `__init__` , not the attribute `self.use_cudnn` (See [here](https://github.com/pfnet/chainer/blob/af1f11d4e50b322286a041c416eddd4e0ee63d30/chainer/links/connection/convolution_2d.py#L75)).
  
  
  </issue>
  <code>
  [start of chainer/links/connection/convolution_2d.py]
  1 import numpy
  2 
  3 from chainer.functions.connection import convolution_2d
  4 from chainer import link
  5 
  6 
  7 class Convolution2D(link.Link):
  8 
  9     """Two-dimensional convolutional layer.
  10 
  11     This link wraps the :func:`~chainer.functions.convolution_2d` function and
  12     holds the filter weight and bias vector as parameters.
  13 
  14     Args:
  15         in_channels (int): Number of channels of input arrays.
  16         out_channels (int): Number of channels of output arrays.
  17         ksize (int or (int, int)): Size of filters (a.k.a. kernels).
  18             ``ksize=k`` and ``ksize=(k, k)`` are equivalent.
  19         stride (int or (int, int)): Stride of filter applications.
  20             ``stride=s`` and ``stride=(s, s)`` are equivalent.
  21         pad (int or (int, int)): Spatial padding width for input arrays.
  22             ``pad=p`` and ``pad=(p, p)`` are equivalent.
  23         wscale (float): Scaling factor of the initial weight.
  24         bias (float): Initial bias value.
  25         nobias (bool): If True, then this link does not use the bias term.
  26         use_cudnn (bool): If True, then this link uses CuDNN if available.
  27         initialW (4-D array): Initial weight value. If ``None``, then this
  28             function uses to initialize ``wscale``.
  29         initial_bias (1-D array): Initial bias value. If ``None``, then this
  30             function uses to initialize ``bias``.
  31 
  32     .. seealso::
  33        See :func:`chainer.functions.convolution_2d` for the definition of
  34        two-dimensional convolution.
  35 
  36     Attributes:
  37         W (~chainer.Variable): Weight parameter.
  38         b (~chainer.Variable): Bias parameter.
  39 
  40     """
  41     def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,
  42                  wscale=1, bias=0, nobias=False, use_cudnn=True,
  43                  initialW=None, initial_bias=None):
  44         kh, kw = _pair(ksize)
  45         self._conv_arg = (stride, pad, use_cudnn)
  46 
  47         W_shape = (out_channels, in_channels, kh, kw)
  48         super(Convolution2D, self).__init__(W=W_shape)
  49 
  50         if initialW is not None:
  51             self.W.data[...] = initialW
  52         else:
  53             std = wscale * numpy.sqrt(1. / (kh * kw * in_channels))
  54             self.W.data[...] = numpy.random.normal(0, std, W_shape)
  55 
  56         if nobias:
  57             self.b = None
  58         else:
  59             self.add_param('b', out_channels)
  60             if initial_bias is None:
  61                 initial_bias = bias
  62             self.b.data[...] = initial_bias
  63 
  64     def __call__(self, x):
  65         """Applies the convolution layer.
  66 
  67         Args:
  68             x (~chainer.Variable): Input image.
  69 
  70         Returns:
  71             ~chainer.Variable: Output of the convolution.
  72 
  73         """
  74         return convolution_2d.convolution_2d(
  75             x, self.W, self.b, *self._conv_arg)
  76 
  77 
  78 def _pair(x):
  79     if hasattr(x, '__getitem__'):
  80         return x
  81     return (x, x)
  82
  [end of chainer/links/connection/convolution_2d.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/chainer/links/connection/convolution_2d.py b/chainer/links/connection/convolution_2d.py
  --- a/chainer/links/connection/convolution_2d.py
  +++ b/chainer/links/connection/convolution_2d.py
  @@ -42,7 +42,9 @@
                    wscale=1, bias=0, nobias=False, use_cudnn=True,
                    initialW=None, initial_bias=None):
           kh, kw = _pair(ksize)
  -        self._conv_arg = (stride, pad, use_cudnn)
  +        self.stride = _pair(stride)
  +        self.pad = _pair(pad)
  +        self.use_cudnn = use_cudnn
   
           W_shape = (out_channels, in_channels, kh, kw)
           super(Convolution2D, self).__init__(W=W_shape)
  @@ -72,7 +74,7 @@
   
           """
           return convolution_2d.convolution_2d(
  -            x, self.W, self.b, *self._conv_arg)
  +            x, self.W, self.b, self.stride, self.pad, self.use_cudnn)
   
   
   def _pair(x):
  
verification_info: {"golden_diff": "diff --git a/chainer/links/connection/convolution_2d.py b/chainer/links/connection/convolution_2d.py\n--- a/chainer/links/connection/convolution_2d.py\n+++ b/chainer/links/connection/convolution_2d.py\n@@ -42,7 +42,9 @@\n                  wscale=1, bias=0, nobias=False, use_cudnn=True,\n                  initialW=None, initial_bias=None):\n         kh, kw = _pair(ksize)\n-        self._conv_arg = (stride, pad, use_cudnn)\n+        self.stride = _pair(stride)\n+        self.pad = _pair(pad)\n+        self.use_cudnn = use_cudnn\n \n         W_shape = (out_channels, in_channels, kh, kw)\n         super(Convolution2D, self).__init__(W=W_shape)\n@@ -72,7 +74,7 @@\n \n         \"\"\"\n         return convolution_2d.convolution_2d(\n-            x, self.W, self.b, *self._conv_arg)\n+            x, self.W, self.b, self.stride, self.pad, self.use_cudnn)\n \n \n def _pair(x):\n", "issue": "TestConvolution2D.test_(forward, backward)_gpu_im2col does not check use_cudnn=False case\n`TestConvolution2D.test_forward_gpu_im2col` and `TestConvolution2D.test_backward_gpu_im2col` are expected to test `Convolution2DFunction.backward_gpu` works correctly when CuDNN is disabled.\n\nTo achieve this, these test fixtures set `self.use_cudnn` attribute of the instance of `Convolution2D` to `False` . But what is actually passed to `convoluton_2d` function as `use_cudnn` option is the `use_cudnn` argument of `__init__` , not the attribute `self.use_cudnn` (See [here](https://github.com/pfnet/chainer/blob/af1f11d4e50b322286a041c416eddd4e0ee63d30/chainer/links/connection/convolution_2d.py#L75)).\n\n", "before_files": [{"content": "import numpy\n\nfrom chainer.functions.connection import convolution_2d\nfrom chainer import link\n\n\nclass Convolution2D(link.Link):\n\n    \"\"\"Two-dimensional convolutional layer.\n\n    This link wraps the :func:`~chainer.functions.convolution_2d` function and\n    holds the filter weight and bias vector as parameters.\n\n    Args:\n        in_channels (int): Number of channels of input arrays.\n        out_channels (int): Number of channels of output arrays.\n        ksize (int or (int, int)): Size of filters (a.k.a. kernels).\n            ``ksize=k`` and ``ksize=(k, k)`` are equivalent.\n        stride (int or (int, int)): Stride of filter applications.\n            ``stride=s`` and ``stride=(s, s)`` are equivalent.\n        pad (int or (int, int)): Spatial padding width for input arrays.\n            ``pad=p`` and ``pad=(p, p)`` are equivalent.\n        wscale (float): Scaling factor of the initial weight.\n        bias (float): Initial bias value.\n        nobias (bool): If True, then this link does not use the bias term.\n        use_cudnn (bool): If True, then this link uses CuDNN if available.\n        initialW (4-D array): Initial weight value. If ``None``, then this\n            function uses to initialize ``wscale``.\n        initial_bias (1-D array): Initial bias value. If ``None``, then this\n            function uses to initialize ``bias``.\n\n    .. seealso::\n       See :func:`chainer.functions.convolution_2d` for the definition of\n       two-dimensional convolution.\n\n    Attributes:\n        W (~chainer.Variable): Weight parameter.\n        b (~chainer.Variable): Bias parameter.\n\n    \"\"\"\n    def __init__(self, in_channels, out_channels, ksize, stride=1, pad=0,\n                 wscale=1, bias=0, nobias=False, use_cudnn=True,\n                 initialW=None, initial_bias=None):\n        kh, kw = _pair(ksize)\n        self._conv_arg = (stride, pad, use_cudnn)\n\n        W_shape = (out_channels, in_channels, kh, kw)\n        super(Convolution2D, self).__init__(W=W_shape)\n\n        if initialW is not None:\n            self.W.data[...] = initialW\n        else:\n            std = wscale * numpy.sqrt(1. / (kh * kw * in_channels))\n            self.W.data[...] = numpy.random.normal(0, std, W_shape)\n\n        if nobias:\n            self.b = None\n        else:\n            self.add_param('b', out_channels)\n            if initial_bias is None:\n                initial_bias = bias\n            self.b.data[...] = initial_bias\n\n    def __call__(self, x):\n        \"\"\"Applies the convolution layer.\n\n        Args:\n            x (~chainer.Variable): Input image.\n\n        Returns:\n            ~chainer.Variable: Output of the convolution.\n\n        \"\"\"\n        return convolution_2d.convolution_2d(\n            x, self.W, self.b, *self._conv_arg)\n\n\ndef _pair(x):\n    if hasattr(x, '__getitem__'):\n        return x\n    return (x, x)\n", "path": "chainer/links/connection/convolution_2d.py"}]}