Skip to content

Commit

Permalink
changes to throw exception if st!=ds
Browse files Browse the repository at this point in the history
  • Loading branch information
Sina Honari committed Dec 16, 2014
1 parent 6991637 commit 70ef7bf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion theano/tensor/signal/downsample.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,8 @@ def grad(self, inp, grads):
x, = inp
gz, = grads
maxout = self(x)
if self.st != self.ds:
return theano.gradient.grad_not_implemented
return [DownsampleFactorMaxGrad(self.ds,
ignore_border=self.ignore_border,
st=self.st)(
Expand Down Expand Up @@ -380,12 +382,14 @@ def infer_shape(self, node, in_shapes):
def grad(self, inp, grads):
x, maxout, gz = inp
ggx, = grads
if self.st != self.ds:
return theano.gradient.grad_not_implemented
return [theano.tensor.zeros_like(x),
theano.tensor.zeros_like(maxout),
DownsampleFactorMaxGradGrad(
self.ds, ignore_border=self.ignore_border, st=self.st)(x, maxout, ggx)]

def c_code_tmp(self, node, name, inp, out, sub):
def c_code(self, node, name, inp, out, sub):
x, z, gz = inp
gx, = out
fail = sub['fail']
Expand Down

0 comments on commit 70ef7bf

Please sign in to comment.