Skip to content

Commit

Permalink
Merge pull request #7185 from crcrpar/use-cudnn-dropout
Browse files Browse the repository at this point in the history
Change `F.dropout` to use cuDNN by default
  • Loading branch information
niboshi committed Jul 22, 2019
2 parents 457a27a + ee67bb2 commit 3b03f9a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chainer/functions/noise/dropout.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def forward_cpu(self, x):
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):
Expand Down Expand Up @@ -83,7 +83,7 @@ def _forward_ideep(self, x):
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from chainer import gradient_check
from chainer import testing
from chainer.testing import attr
from chainer.testing import backend


@testing.parameterize(
Expand All @@ -17,7 +16,7 @@
{'dtype': numpy.float64, 'ratio': 0.5},
{'dtype': numpy.float64, 'ratio': 0.0},
)
@backend.inject_backend_tests(
@testing.inject_backend_tests(
['test_forward', 'test_backward', 'test_double_backward',
'test_immutable'],
# CPU tests
Expand Down

0 comments on commit 3b03f9a

Please sign in to comment.