提交 595018c5 authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Impose that the gradient of Conv have the same broadcast pattern as the params

It removes annoying warning messages from the buildbot's output.
上级 11b87f2d
...@@ -15,7 +15,8 @@ import logging ...@@ -15,7 +15,8 @@ import logging
import numpy import numpy
import theano import theano
from theano.tensor import get_constant_value, blas, as_tensor_variable from theano.tensor import (as_tensor_variable, blas, get_constant_value,
patternbroadcast)
from theano import Op, config from theano import Op, config
from theano.gof.apply_shape import Apply from theano.gof.apply_shape import Apply
from theano.gof.python25 import any from theano.gof.python25 import any
...@@ -840,6 +841,11 @@ class ConvOp(Op): ...@@ -840,6 +841,11 @@ class ConvOp(Op):
assert (din.owner.op.outshp is None and self.imshp is None) or \ assert (din.owner.op.outshp is None and self.imshp is None) or \
(din.owner.op.outshp is None) or \ (din.owner.op.outshp is None) or \
(din.owner.op.outshp==self.imshp[1:]).all() (din.owner.op.outshp==self.imshp[1:]).all()
# din and dw should have the same broadcasting pattern as the
# parameters they are the gradient of (resp. inputs and kerns).
din = patternbroadcast(din, inputs.broadcastable)
dw = patternbroadcast(dw, kerns.broadcastable)
return [din, dw] return [din, dw]
def c_headers(self): def c_headers(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论