提交 1b01e2f5 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Additional pep8 fixes

上级 bd5dc5a8
......@@ -4,7 +4,7 @@ Planned:
DownsampleFactorMax, DownsampleAvg, DownsampleSoftmax.
"""
#This file should move along with conv.py
# This file should move along with conv.py
import __builtin__
import numpy
......@@ -196,7 +196,8 @@ class DownsampleFactorMax(Op):
'padding_h and padding_w must be smaller than strides')
def __str__(self):
return '%s{%s, %s, %s, %s}' % (self.__class__.__name__,
return '%s{%s, %s, %s, %s}' % (
self.__class__.__name__,
self.ds, self.st, self.ignore_border, self.padding)
def make_node(self, x):
......@@ -216,13 +217,14 @@ class DownsampleFactorMax(Op):
z_shape = self.out_shape(x.shape, self.ds, self.ignore_border, self.st,
self.padding)
if (z[0] is None) or (z[0].shape != z_shape):
z[0] = numpy.empty(self.out_shape(x.shape, self.ds,
self.ignore_border, self.st, self.padding),
z[0] = numpy.empty(
self.out_shape(x.shape, self.ds, self.ignore_border,
self.st, self.padding),
dtype=x.dtype)
zz = z[0]
#number of pooling output rows
# number of pooling output rows
pr = zz.shape[-2]
#number of pooling output cols
# number of pooling output cols
pc = zz.shape[-1]
ds0, ds1 = self.ds
st0, st1 = self.st
......@@ -356,7 +358,8 @@ class DownsampleFactorMaxGrad(Op):
self.padding = tuple(padding)
def __str__(self):
return '%s{%s, %s, %s, %s}' % (self.__class__.__name__,
return '%s{%s, %s, %s, %s}' % (
self.__class__.__name__,
self.ds, self.st, self.ignore_border, self.padding)
def make_node(self, x, maxout, gz):
......@@ -371,9 +374,9 @@ class DownsampleFactorMaxGrad(Op):
def perform(self, node, inp, out):
x, maxout, gz = inp
gx_stg, = out
#number of pooling output rows
# number of pooling output rows
pr = maxout.shape[-2]
#number of pooling output cols
# number of pooling output cols
pc = maxout.shape[-1]
ds0, ds1 = self.ds
st0, st1 = self.st
......@@ -635,9 +638,9 @@ class DownsampleFactorMaxGradGrad(Op):
dtype=x.dtype)
ggz = z[0]
#number of pooling output rows
# number of pooling output rows
pr = ggz.shape[-2]
#number of pooling output cols
# number of pooling output cols
pc = ggz.shape[-1]
ds0, ds1 = self.ds
st0, st1 = self.st
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论