Skip to content

Commit

Permalink
Fix style and import
Browse files Browse the repository at this point in the history
  • Loading branch information
beam2d committed Aug 23, 2017
1 parent 647672b commit 184423a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 2 additions & 1 deletion chainer/functions/connection/convolution_2d.py
Expand Up @@ -411,4 +411,5 @@ def convolution_2d(x, W, b=None, stride=1, pad=0, cover_all=False, **kwargs):
args = x, W
else:
args = x, W, b
return fnode.apply(args)[0]
y, = fnode.apply(args)
return y
16 changes: 9 additions & 7 deletions chainer/functions/connection/deconvolution_2d.py
Expand Up @@ -4,7 +4,7 @@
from chainer import configuration
from chainer import cuda
from chainer import function_node
from chainer import functions as F
import chainer.functions
from chainer.functions.connection import convolution_2d
from chainer.utils import argument
from chainer.utils import conv
Expand Down Expand Up @@ -216,7 +216,7 @@ def backward(self, indexes, grad_outputs):
if 0 in indexes:
if self.cover_all is None:
self._set_cover_all(x, W)
gx = F.convolution_2d(
gx = chainer.functions.convolution_2d(
gy, W, stride=(self.sy, self.sx), pad=(self.ph, self.pw),
cover_all=self.cover_all)
ret.append(gx)
Expand All @@ -226,7 +226,7 @@ def backward(self, indexes, grad_outputs):
gW, = convolution_2d.Convolution2DGradW(self).apply((gy, x))
ret.append(gW)
if 2 in indexes:
gb = F.sum(gy, axis=(0, 2, 3))
gb = chainer.functions.sum(gy, axis=(0, 2, 3))
ret.append(gb)

return ret
Expand Down Expand Up @@ -347,7 +347,9 @@ def deconvolution_2d(x, W, b=None, stride=1, pad=0, outsize=None, **kwargs):
argument.assert_kwargs_empty(kwargs)

func = Deconvolution2DFunction(stride, pad, outsize)
args = x, W
if b is not None:
args += b,
return func.apply(args)[0]
if b is None:
args = x, W
else:
args = x, W, b
y, = func.apply(args)
return y

0 comments on commit 184423a

Please sign in to comment.