We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Why `F.dropout` usually does not use CuDNN?
Currently, `F.dropout` uses cudnn only when `using_config('use_cudnn', 'always')`
https://github.com/chainer/chainer/blob/d7adbfb45d46fafa6bd0bbb9f0cebe5894489437/chainer/functions/noise/dropout.py#L46

But IMO, cudnn should be enabled when `>=auto`.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `chainer/functions/noise/dropout.py`
Content:
```
1 import numpy
2 
3 import chainer
4 from chainer.backends import cuda
5 from chainer.backends import intel64
6 from chainer import configuration
7 from chainer import function_node
8 from chainer.utils import argument
9 from chainer.utils import type_check
10 
11 if cuda.cudnn_enabled:
12     cudnn = cuda.cudnn
13 
14 
15 class Dropout(function_node.FunctionNode):
16 
17     """Dropout regularization."""
18 
19     def __init__(self, dropout_ratio, mask=None, return_mask=False):
20         if not 0.0 <= dropout_ratio < 1.0:
21             raise ValueError('dropout_ratio must be in the range [0, 1)')
22         self.dropout_ratio = dropout_ratio
23         self.mask = mask
24         self.return_mask = return_mask
25         self._use_cudnn = False
26 
27     def check_type_forward(self, in_types):
28         type_check._argname(in_types, ('x',))
29         type_check.expect(in_types[0].dtype.kind == 'f')
30 
31     def forward_cpu(self, x):
32         if (intel64.should_use_ideep('>=auto')
33                 and intel64.inputs_all_ready(x)
34                 and self.mask is None):
35             return self._forward_ideep(x)
36 
37         if self.mask is not None:
38             y = x[0] * self.mask
39         else:
40             scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))
41             flag = numpy.random.rand(*x[0].shape) >= self.dropout_ratio
42             self.mask = scale * flag
43             y = x[0] * self.mask
44         return y,
45 
46     def forward_gpu(self, x):
47         if (chainer.should_use_cudnn('==always', 5000)
48                 and x[0].flags.c_contiguous
49                 and self.mask is None
50                 and not self.return_mask):
51             self._use_cudnn = True
52 
53             if hasattr(self, 'states'):
54                 # if we already have a dropout mask,
55                 # the forward operation is equal to backward.
56                 return cuda.get_cudnn_dropout_states().backward(
57                     None, x[0], self.dropout_ratio, self.states),
58 
59             self.states, y = cuda.get_cudnn_dropout_states().forward(
60                 None, x[0], self.dropout_ratio)
61             return y,
62         else:
63             if self.mask is not None:
64                 y = x[0] * self.mask
65             else:
66                 rand = cuda.cupy.random.rand(*x[0].shape, dtype=numpy.float32)
67                 scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))
68                 self.mask, y = cuda.elementwise(
69                     'T x, R r, T scale, T ratio', 'T mask, T y',
70                     '''
71                     mask = (r >= ratio) * scale;
72                     y = x * mask;
73                     ''',
74                     'dropout_fwd',
75                 )(x[0], rand, scale, self.dropout_ratio)
76             return y,
77 
78     def _forward_ideep(self, x):
79         mask, y = intel64.ideep.dropout.Forward(
80             intel64.ideep.array(x[0]),
81             self.dropout_ratio)
82         self.mask = mask
83         return y,
84 
85     def backward(self, x, gy):
86         if chainer.should_use_cudnn('==always', 5000) and self._use_cudnn:
87             return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)
88         else:
89             return DropoutGrad(self.mask).apply(gy)
90 
91 
92 class DropoutGrad(function_node.FunctionNode):
93     """Computes the gradient of the Dropout function."""
94 
95     def __init__(self, mask):
96         self.mask = mask
97 
98     def forward(self, inputs):
99         if (intel64.should_use_ideep('>=auto')
100                 and intel64.inputs_all_ready(inputs)):
101             return self._forward_ideep(inputs)
102 
103         y = inputs[0] * self.mask
104         return y,
105 
106     def _forward_ideep(self, inputs):
107         return intel64.ideep.dropout.Backward(
108             intel64.ideep.array(self.mask),
109             intel64.ideep.array(inputs[0])),
110 
111     def backward(self, indexes, gy):
112         return DropoutGrad(self.mask).apply(gy)
113 
114 
115 class DropoutGradCuDNN(function_node.FunctionNode):
116     """Computes the gradient of the Dropout function with cuDNN support."""
117 
118     def __init__(self, states, dropout_ratio):
119         self.states = states
120         self.dropout_ratio = dropout_ratio
121 
122     def forward(self, inputs):
123         return cuda.get_cudnn_dropout_states().backward(
124             None, inputs[0], self.dropout_ratio, self.states),
125 
126     def backward(self, indexes, gy):
127         return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)
128 
129 
130 def dropout(x, ratio=.5, **kwargs):
131     """dropout(x, ratio=.5, *, mask=None, return_mask=False)
132 
133     Drops elements of input variable randomly.
134 
135     This function drops input elements randomly with probability ``ratio`` and
136     scales the remaining elements by factor ``1 / (1 - ratio)``. In testing
137     mode (i.e., ``chainer.config.train`` is set to ``False``), it does nothing
138     and just returns ``x``.
139 
140     Args:
141         x (:class:`~chainer.Variable` or :ref:`ndarray`):
142             Input variable. A :math:`(s_1, s_2, ..., s_N)` -shaped float array.
143         ratio (float):
144             Dropout ratio. The ``ratio`` must be ``0.0 <= ratio < 1.0``.
145         mask (:ref:`ndarray` or None):
146             The mask to be used for dropout.
147             You do not have to specify this value, unless you need to make
148             results deterministic.
149             If ``mask`` is not specified or set to ``None``, a mask will be
150             generated randomly according to the given ``ratio``.
151             If ``mask`` is specified, ``ratio`` will be ignored.
152             The shape and dtype must be the same as ``x`` and should be on the
153             same device.
154             Note that iDeep and cuDNN will not be used for this function if
155             mask is specified, as iDeep and cuDNN do not support it.
156         return_mask (bool):
157             If ``True``, the mask used for dropout is returned together with
158             the output variable.
159             The returned mask can later be reused by passing it to ``mask``
160             argument.
161 
162     Returns:
163         ~chainer.Variable or tuple:
164             When ``return_mask`` is ``False`` (default), returns the output
165             variable.
166             When ``True``, returns the tuple of the output variable and
167             mask (:ref:`ndarray`). The mask will be on the same device as the
168             input. The mask will become ``None`` when ``chainer.config.train``
169             is set to ``False``.
170 
171     See the paper by G. Hinton: `Improving neural networks by preventing
172     co-adaptation of feature detectors <https://arxiv.org/abs/1207.0580>`_.
173 
174     .. admonition:: Example
175 
176         >>> x = np.array([[-1, 0], [2, -3], [-2, 1]], np.float32)
177         >>> with chainer.using_config('train', True):
178         ...     y = F.dropout(x)
179         >>> y.array
180         array([[-2.,  0.],
181                [ 4., -6.],
182                [-0.,  2.]], dtype=float32)
183         >>> with chainer.using_config('train', True):
184         ...     y = F.dropout(x, ratio=0.0) \
185 # dropout returns original input if ratio=0.0
186         >>> (x == y.array).all()
187         True
188         >>> with chainer.using_config('train', False):
189         ...     y = F.dropout(x) \
190 # dropout in test mode returns original input
191         >>> (x == y.array).all()
192         True
193 
194     """
195     mask = None
196     return_mask = False
197     if kwargs:
198         mask, return_mask = argument.parse_kwargs(
199             kwargs, ('mask', mask), ('return_mask', return_mask),
200             train='train argument is not supported anymore. '
201                   'Use chainer.using_config')
202 
203     if configuration.config.train:
204         func = Dropout(ratio, mask, return_mask)
205         out, = func.apply((x,))
206         mask = func.mask
207     else:
208         out = chainer.as_variable(x)
209         mask = None
210 
211     if return_mask:
212         return out, mask
213     return out
214
```
--- 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/chainer/functions/noise/dropout.py b/chainer/functions/noise/dropout.py
--- a/chainer/functions/noise/dropout.py
+++ b/chainer/functions/noise/dropout.py
@@ -44,7 +44,7 @@
         return y,
 
     def forward_gpu(self, x):
-        if (chainer.should_use_cudnn('==always', 5000)
+        if (chainer.should_use_cudnn('>=auto', 5000)
                 and x[0].flags.c_contiguous
                 and self.mask is None
                 and not self.return_mask):
@@ -83,7 +83,7 @@
         return y,
 
     def backward(self, x, gy):
-        if chainer.should_use_cudnn('==always', 5000) and self._use_cudnn:
+        if chainer.should_use_cudnn('>=auto', 5000) and self._use_cudnn:
             return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)
         else:
             return DropoutGrad(self.mask).apply(gy)

{"golden_diff": "diff --git a/chainer/functions/noise/dropout.py b/chainer/functions/noise/dropout.py\n--- a/chainer/functions/noise/dropout.py\n+++ b/chainer/functions/noise/dropout.py\n@@ -44,7 +44,7 @@\n         return y,\n \n     def forward_gpu(self, x):\n-        if (chainer.should_use_cudnn('==always', 5000)\n+        if (chainer.should_use_cudnn('>=auto', 5000)\n                 and x[0].flags.c_contiguous\n                 and self.mask is None\n                 and not self.return_mask):\n@@ -83,7 +83,7 @@\n         return y,\n \n     def backward(self, x, gy):\n-        if chainer.should_use_cudnn('==always', 5000) and self._use_cudnn:\n+        if chainer.should_use_cudnn('>=auto', 5000) and self._use_cudnn:\n             return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)\n         else:\n             return DropoutGrad(self.mask).apply(gy)\n", "issue": "Why `F.dropout` usually does not use CuDNN?\nCurrently, `F.dropout` uses cudnn only when `using_config('use_cudnn', 'always')`\r\nhttps://github.com/chainer/chainer/blob/d7adbfb45d46fafa6bd0bbb9f0cebe5894489437/chainer/functions/noise/dropout.py#L46\r\n\r\nBut IMO, cudnn should be enabled when `>=auto`.\n", "before_files": [{"content": "import numpy\n\nimport chainer\nfrom chainer.backends import cuda\nfrom chainer.backends import intel64\nfrom chainer import configuration\nfrom chainer import function_node\nfrom chainer.utils import argument\nfrom chainer.utils import type_check\n\nif cuda.cudnn_enabled:\n    cudnn = cuda.cudnn\n\n\nclass Dropout(function_node.FunctionNode):\n\n    \"\"\"Dropout regularization.\"\"\"\n\n    def __init__(self, dropout_ratio, mask=None, return_mask=False):\n        if not 0.0 <= dropout_ratio < 1.0:\n            raise ValueError('dropout_ratio must be in the range [0, 1)')\n        self.dropout_ratio = dropout_ratio\n        self.mask = mask\n        self.return_mask = return_mask\n        self._use_cudnn = False\n\n    def check_type_forward(self, in_types):\n        type_check._argname(in_types, ('x',))\n        type_check.expect(in_types[0].dtype.kind == 'f')\n\n    def forward_cpu(self, x):\n        if (intel64.should_use_ideep('>=auto')\n                and intel64.inputs_all_ready(x)\n                and self.mask is None):\n            return self._forward_ideep(x)\n\n        if self.mask is not None:\n            y = x[0] * self.mask\n        else:\n            scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))\n            flag = numpy.random.rand(*x[0].shape) >= self.dropout_ratio\n            self.mask = scale * flag\n            y = x[0] * self.mask\n        return y,\n\n    def forward_gpu(self, x):\n        if (chainer.should_use_cudnn('==always', 5000)\n                and x[0].flags.c_contiguous\n                and self.mask is None\n                and not self.return_mask):\n            self._use_cudnn = True\n\n            if hasattr(self, 'states'):\n                # if we already have a dropout mask,\n                # the forward operation is equal to backward.\n                return cuda.get_cudnn_dropout_states().backward(\n                    None, x[0], self.dropout_ratio, self.states),\n\n            self.states, y = cuda.get_cudnn_dropout_states().forward(\n                None, x[0], self.dropout_ratio)\n            return y,\n        else:\n            if self.mask is not None:\n                y = x[0] * self.mask\n            else:\n                rand = cuda.cupy.random.rand(*x[0].shape, dtype=numpy.float32)\n                scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))\n                self.mask, y = cuda.elementwise(\n                    'T x, R r, T scale, T ratio', 'T mask, T y',\n                    '''\n                    mask = (r >= ratio) * scale;\n                    y = x * mask;\n                    ''',\n                    'dropout_fwd',\n                )(x[0], rand, scale, self.dropout_ratio)\n            return y,\n\n    def _forward_ideep(self, x):\n        mask, y = intel64.ideep.dropout.Forward(\n            intel64.ideep.array(x[0]),\n            self.dropout_ratio)\n        self.mask = mask\n        return y,\n\n    def backward(self, x, gy):\n        if chainer.should_use_cudnn('==always', 5000) and self._use_cudnn:\n            return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)\n        else:\n            return DropoutGrad(self.mask).apply(gy)\n\n\nclass DropoutGrad(function_node.FunctionNode):\n    \"\"\"Computes the gradient of the Dropout function.\"\"\"\n\n    def __init__(self, mask):\n        self.mask = mask\n\n    def forward(self, inputs):\n        if (intel64.should_use_ideep('>=auto')\n                and intel64.inputs_all_ready(inputs)):\n            return self._forward_ideep(inputs)\n\n        y = inputs[0] * self.mask\n        return y,\n\n    def _forward_ideep(self, inputs):\n        return intel64.ideep.dropout.Backward(\n            intel64.ideep.array(self.mask),\n            intel64.ideep.array(inputs[0])),\n\n    def backward(self, indexes, gy):\n        return DropoutGrad(self.mask).apply(gy)\n\n\nclass DropoutGradCuDNN(function_node.FunctionNode):\n    \"\"\"Computes the gradient of the Dropout function with cuDNN support.\"\"\"\n\n    def __init__(self, states, dropout_ratio):\n        self.states = states\n        self.dropout_ratio = dropout_ratio\n\n    def forward(self, inputs):\n        return cuda.get_cudnn_dropout_states().backward(\n            None, inputs[0], self.dropout_ratio, self.states),\n\n    def backward(self, indexes, gy):\n        return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)\n\n\ndef dropout(x, ratio=.5, **kwargs):\n    \"\"\"dropout(x, ratio=.5, *, mask=None, return_mask=False)\n\n    Drops elements of input variable randomly.\n\n    This function drops input elements randomly with probability ``ratio`` and\n    scales the remaining elements by factor ``1 / (1 - ratio)``. In testing\n    mode (i.e., ``chainer.config.train`` is set to ``False``), it does nothing\n    and just returns ``x``.\n\n    Args:\n        x (:class:`~chainer.Variable` or :ref:`ndarray`):\n            Input variable. A :math:`(s_1, s_2, ..., s_N)` -shaped float array.\n        ratio (float):\n            Dropout ratio. The ``ratio`` must be ``0.0 <= ratio < 1.0``.\n        mask (:ref:`ndarray` or None):\n            The mask to be used for dropout.\n            You do not have to specify this value, unless you need to make\n            results deterministic.\n            If ``mask`` is not specified or set to ``None``, a mask will be\n            generated randomly according to the given ``ratio``.\n            If ``mask`` is specified, ``ratio`` will be ignored.\n            The shape and dtype must be the same as ``x`` and should be on the\n            same device.\n            Note that iDeep and cuDNN will not be used for this function if\n            mask is specified, as iDeep and cuDNN do not support it.\n        return_mask (bool):\n            If ``True``, the mask used for dropout is returned together with\n            the output variable.\n            The returned mask can later be reused by passing it to ``mask``\n            argument.\n\n    Returns:\n        ~chainer.Variable or tuple:\n            When ``return_mask`` is ``False`` (default), returns the output\n            variable.\n            When ``True``, returns the tuple of the output variable and\n            mask (:ref:`ndarray`). The mask will be on the same device as the\n            input. The mask will become ``None`` when ``chainer.config.train``\n            is set to ``False``.\n\n    See the paper by G. Hinton: `Improving neural networks by preventing\n    co-adaptation of feature detectors <https://arxiv.org/abs/1207.0580>`_.\n\n    .. admonition:: Example\n\n        >>> x = np.array([[-1, 0], [2, -3], [-2, 1]], np.float32)\n        >>> with chainer.using_config('train', True):\n        ...     y = F.dropout(x)\n        >>> y.array\n        array([[-2.,  0.],\n               [ 4., -6.],\n               [-0.,  2.]], dtype=float32)\n        >>> with chainer.using_config('train', True):\n        ...     y = F.dropout(x, ratio=0.0) \\\n# dropout returns original input if ratio=0.0\n        >>> (x == y.array).all()\n        True\n        >>> with chainer.using_config('train', False):\n        ...     y = F.dropout(x) \\\n# dropout in test mode returns original input\n        >>> (x == y.array).all()\n        True\n\n    \"\"\"\n    mask = None\n    return_mask = False\n    if kwargs:\n        mask, return_mask = argument.parse_kwargs(\n            kwargs, ('mask', mask), ('return_mask', return_mask),\n            train='train argument is not supported anymore. '\n                  'Use chainer.using_config')\n\n    if configuration.config.train:\n        func = Dropout(ratio, mask, return_mask)\n        out, = func.apply((x,))\n        mask = func.mask\n    else:\n        out = chainer.as_variable(x)\n        mask = None\n\n    if return_mask:\n        return out, mask\n    return out\n", "path": "chainer/functions/noise/dropout.py"}], "after_files": [{"content": "import numpy\n\nimport chainer\nfrom chainer.backends import cuda\nfrom chainer.backends import intel64\nfrom chainer import configuration\nfrom chainer import function_node\nfrom chainer.utils import argument\nfrom chainer.utils import type_check\n\nif cuda.cudnn_enabled:\n    cudnn = cuda.cudnn\n\n\nclass Dropout(function_node.FunctionNode):\n\n    \"\"\"Dropout regularization.\"\"\"\n\n    def __init__(self, dropout_ratio, mask=None, return_mask=False):\n        if not 0.0 <= dropout_ratio < 1.0:\n            raise ValueError('dropout_ratio must be in the range [0, 1)')\n        self.dropout_ratio = dropout_ratio\n        self.mask = mask\n        self.return_mask = return_mask\n        self._use_cudnn = False\n\n    def check_type_forward(self, in_types):\n        type_check._argname(in_types, ('x',))\n        type_check.expect(in_types[0].dtype.kind == 'f')\n\n    def forward_cpu(self, x):\n        if (intel64.should_use_ideep('>=auto')\n                and intel64.inputs_all_ready(x)\n                and self.mask is None):\n            return self._forward_ideep(x)\n\n        if self.mask is not None:\n            y = x[0] * self.mask\n        else:\n            scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))\n            flag = numpy.random.rand(*x[0].shape) >= self.dropout_ratio\n            self.mask = scale * flag\n            y = x[0] * self.mask\n        return y,\n\n    def forward_gpu(self, x):\n        if (chainer.should_use_cudnn('>=auto', 5000)\n                and x[0].flags.c_contiguous\n                and self.mask is None\n                and not self.return_mask):\n            self._use_cudnn = True\n\n            if hasattr(self, 'states'):\n                # if we already have a dropout mask,\n                # the forward operation is equal to backward.\n                return cuda.get_cudnn_dropout_states().backward(\n                    None, x[0], self.dropout_ratio, self.states),\n\n            self.states, y = cuda.get_cudnn_dropout_states().forward(\n                None, x[0], self.dropout_ratio)\n            return y,\n        else:\n            if self.mask is not None:\n                y = x[0] * self.mask\n            else:\n                rand = cuda.cupy.random.rand(*x[0].shape, dtype=numpy.float32)\n                scale = x[0].dtype.type(1. / (1 - self.dropout_ratio))\n                self.mask, y = cuda.elementwise(\n                    'T x, R r, T scale, T ratio', 'T mask, T y',\n                    '''\n                    mask = (r >= ratio) * scale;\n                    y = x * mask;\n                    ''',\n                    'dropout_fwd',\n                )(x[0], rand, scale, self.dropout_ratio)\n            return y,\n\n    def _forward_ideep(self, x):\n        mask, y = intel64.ideep.dropout.Forward(\n            intel64.ideep.array(x[0]),\n            self.dropout_ratio)\n        self.mask = mask\n        return y,\n\n    def backward(self, x, gy):\n        if chainer.should_use_cudnn('>=auto', 5000) and self._use_cudnn:\n            return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)\n        else:\n            return DropoutGrad(self.mask).apply(gy)\n\n\nclass DropoutGrad(function_node.FunctionNode):\n    \"\"\"Computes the gradient of the Dropout function.\"\"\"\n\n    def __init__(self, mask):\n        self.mask = mask\n\n    def forward(self, inputs):\n        if (intel64.should_use_ideep('>=auto')\n                and intel64.inputs_all_ready(inputs)):\n            return self._forward_ideep(inputs)\n\n        y = inputs[0] * self.mask\n        return y,\n\n    def _forward_ideep(self, inputs):\n        return intel64.ideep.dropout.Backward(\n            intel64.ideep.array(self.mask),\n            intel64.ideep.array(inputs[0])),\n\n    def backward(self, indexes, gy):\n        return DropoutGrad(self.mask).apply(gy)\n\n\nclass DropoutGradCuDNN(function_node.FunctionNode):\n    \"\"\"Computes the gradient of the Dropout function with cuDNN support.\"\"\"\n\n    def __init__(self, states, dropout_ratio):\n        self.states = states\n        self.dropout_ratio = dropout_ratio\n\n    def forward(self, inputs):\n        return cuda.get_cudnn_dropout_states().backward(\n            None, inputs[0], self.dropout_ratio, self.states),\n\n    def backward(self, indexes, gy):\n        return DropoutGradCuDNN(self.states, self.dropout_ratio).apply(gy)\n\n\ndef dropout(x, ratio=.5, **kwargs):\n    \"\"\"dropout(x, ratio=.5, *, mask=None, return_mask=False)\n\n    Drops elements of input variable randomly.\n\n    This function drops input elements randomly with probability ``ratio`` and\n    scales the remaining elements by factor ``1 / (1 - ratio)``. In testing\n    mode (i.e., ``chainer.config.train`` is set to ``False``), it does nothing\n    and just returns ``x``.\n\n    Args:\n        x (:class:`~chainer.Variable` or :ref:`ndarray`):\n            Input variable. A :math:`(s_1, s_2, ..., s_N)` -shaped float array.\n        ratio (float):\n            Dropout ratio. The ``ratio`` must be ``0.0 <= ratio < 1.0``.\n        mask (:ref:`ndarray` or None):\n            The mask to be used for dropout.\n            You do not have to specify this value, unless you need to make\n            results deterministic.\n            If ``mask`` is not specified or set to ``None``, a mask will be\n            generated randomly according to the given ``ratio``.\n            If ``mask`` is specified, ``ratio`` will be ignored.\n            The shape and dtype must be the same as ``x`` and should be on the\n            same device.\n            Note that iDeep and cuDNN will not be used for this function if\n            mask is specified, as iDeep and cuDNN do not support it.\n        return_mask (bool):\n            If ``True``, the mask used for dropout is returned together with\n            the output variable.\n            The returned mask can later be reused by passing it to ``mask``\n            argument.\n\n    Returns:\n        ~chainer.Variable or tuple:\n            When ``return_mask`` is ``False`` (default), returns the output\n            variable.\n            When ``True``, returns the tuple of the output variable and\n            mask (:ref:`ndarray`). The mask will be on the same device as the\n            input. The mask will become ``None`` when ``chainer.config.train``\n            is set to ``False``.\n\n    See the paper by G. Hinton: `Improving neural networks by preventing\n    co-adaptation of feature detectors <https://arxiv.org/abs/1207.0580>`_.\n\n    .. admonition:: Example\n\n        >>> x = np.array([[-1, 0], [2, -3], [-2, 1]], np.float32)\n        >>> with chainer.using_config('train', True):\n        ...     y = F.dropout(x)\n        >>> y.array\n        array([[-2.,  0.],\n               [ 4., -6.],\n               [-0.,  2.]], dtype=float32)\n        >>> with chainer.using_config('train', True):\n        ...     y = F.dropout(x, ratio=0.0) \\\n# dropout returns original input if ratio=0.0\n        >>> (x == y.array).all()\n        True\n        >>> with chainer.using_config('train', False):\n        ...     y = F.dropout(x) \\\n# dropout in test mode returns original input\n        >>> (x == y.array).all()\n        True\n\n    \"\"\"\n    mask = None\n    return_mask = False\n    if kwargs:\n        mask, return_mask = argument.parse_kwargs(\n            kwargs, ('mask', mask), ('return_mask', return_mask),\n            train='train argument is not supported anymore. '\n                  'Use chainer.using_config')\n\n    if configuration.config.train:\n        func = Dropout(ratio, mask, return_mask)\n        out, = func.apply((x,))\n        mask = func.mask\n    else:\n        out = chainer.as_variable(x)\n        mask = None\n\n    if return_mask:\n        return out, mask\n    return out\n", "path": "chainer/functions/noise/dropout.py"}]}