Skip to content

Commit

Permalink
Merge 0a18e21 into f8ae421
Browse files Browse the repository at this point in the history
  • Loading branch information
mottodora committed Aug 21, 2017
2 parents f8ae421 + 0a18e21 commit a4c28f2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion chainer/links/model/vision/googlenet.py
Expand Up @@ -10,6 +10,7 @@
available = False
_import_error = e

import chainer
from chainer.dataset.convert import concat_examples
from chainer.dataset import download
from chainer import function
Expand Down Expand Up @@ -301,7 +302,7 @@ def predict(self, images, oversample=True):
else:
x = x[:, :, 16:240, 16:240]
# Use no_backprop_mode to reduce memory consumption
with function.no_backprop_mode():
with function.no_backprop_mode(), chainer.using_config('train', False):
x = Variable(self.xp.asarray(x))
y = self(x, layers=['prob'])['prob']
if oversample:
Expand Down
3 changes: 2 additions & 1 deletion chainer/links/model/vision/resnet.py
Expand Up @@ -10,6 +10,7 @@
available = False
_import_error = e

import chainer
from chainer.dataset.convert import concat_examples
from chainer.dataset import download
from chainer import function
Expand Down Expand Up @@ -263,7 +264,7 @@ def predict(self, images, oversample=True):
else:
x = x[:, :, 16:240, 16:240]
# Use no_backprop_mode to reduce memory consumption
with function.no_backprop_mode():
with function.no_backprop_mode(), chainer.using_config('train', False):
x = Variable(self.xp.asarray(x))
y = self(x, layers=['prob'])['prob']
if oversample:
Expand Down
3 changes: 2 additions & 1 deletion chainer/links/model/vision/vgg.py
Expand Up @@ -10,6 +10,7 @@
available = False
_import_error = e

import chainer
from chainer.dataset.convert import concat_examples
from chainer.dataset import download
from chainer import function
Expand Down Expand Up @@ -266,7 +267,7 @@ def predict(self, images, oversample=True):
else:
x = x[:, :, 16:240, 16:240]
# Use no_backprop_mode to reduce memory consumption
with function.no_backprop_mode():
with function.no_backprop_mode(), chainer.using_config('train', False):
x = Variable(self.xp.asarray(x))
y = self(x, layers=['prob'])['prob']
if oversample:
Expand Down

0 comments on commit a4c28f2

Please sign in to comment.