Fixed bug in "grad" function of ConvOp when dealing with rectangular images or

kernels. Modified the list of kernel and image shapes to test in test_conv.py so that test_ConvOpGrad runs under 2 mins.
上级 925eca70
...@@ -144,12 +144,12 @@ class ConvOp(Op): ...@@ -144,12 +144,12 @@ class ConvOp(Op):
(img, filters) = (newin, newgz) (img, filters) = (newin, newgz)
(bsize, nkern) = (self.imshp[0], self.nkern) (bsize, nkern) = (self.imshp[0], self.nkern)
imshp = N.hstack((self.bsize, self.imshp[1:])) imshp = N.hstack((self.bsize, self.imshp[1:]))
kshp = self.outshp[::-1] kshp = self.outshp
elif self.out_mode == 'full': elif self.out_mode == 'full':
(img, filters) = (newgz, newin) (img, filters) = (newgz, newin)
(bsize, nkern) = (self.nkern, self.imshp[0]) (bsize, nkern) = (self.nkern, self.imshp[0])
imshp = N.hstack((self.bsize, self.outshp)) imshp = N.hstack((self.bsize, self.outshp))
kshp = self.imshp[1:][::-1] kshp = self.imshp[1:]
else: else:
raise NotImplementedError('Only [full,valid] modes are currently supported.') raise NotImplementedError('Only [full,valid] modes are currently supported.')
......
...@@ -426,8 +426,8 @@ class TestConvOp(unittest.TestCase): ...@@ -426,8 +426,8 @@ class TestConvOp(unittest.TestCase):
nkern = 4 nkern = 4
bsize = 3 bsize = 3
types = ["float32", "float64"] types = ["float32", "float64"]
kshps = [(3,3),(5,5)]# TODO: (6,7)show a bug that is not fixed!! kshps = [(5,5), (6,7)]
imshps = [(1,5,5),(2,8,8)]#,(2,12,12)] #TODO bugged (2,12,10), (3,12,11): imshps = [(1,5,5), (2,8,8), (3,8,7)]
modes = ['valid', 'full'] modes = ['valid', 'full']
unroll_batch=[0,1,3] unroll_batch=[0,1,3]
unroll_kern=[0,1,4] unroll_kern=[0,1,4]
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论