提交 fdd293db authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed grad for neighbours

上级 b0f466d8
# Skip test if cuda_ndarray is not available. # Skip test if cuda_ndarray is not available.
from nose.plugins.skip import SkipTest from nose.plugins.skip import SkipTest
import numpy
import theano
import theano.sandbox.cuda as cuda_ndarray import theano.sandbox.cuda as cuda_ndarray
if cuda_ndarray.cuda_available == False: if cuda_ndarray.cuda_available == False:
......
...@@ -2,11 +2,10 @@ ...@@ -2,11 +2,10 @@
TODO: implement Images2Neibs.{perform,infer_shape}() methods TODO: implement Images2Neibs.{perform,infer_shape}() methods
""" """
import theano
from theano import Op, Apply from theano import Op, Apply
import theano.tensor as T import theano.tensor as T
from theano.gof import local_optimizer
from theano.gradient import grad_not_implemented from theano.gradient import grad_not_implemented
from theano.gradient import grad_undefined
class Images2Neibs(Op): class Images2Neibs(Op):
...@@ -91,8 +90,11 @@ class Images2Neibs(Op): ...@@ -91,8 +90,11 @@ class Images2Neibs(Op):
(hasattr(neib_shape, "equals") and (hasattr(neib_shape, "equals") and
neib_shape.equals(neib_step))): neib_shape.equals(neib_step))):
return [neibs2images(gz, neib_shape, x.shape, mode=self.mode), return [neibs2images(gz, neib_shape, x.shape, mode=self.mode),
None, None] grad_undefined(self, 1, neib_shape),
return [grad_not_implemented(self, 0, x), None, None] grad_undefined(self, 2, neib_step)]
return [grad_not_implemented(self, 0, x),
grad_undefined(self, 1, neib_shape),
grad_undefined(self, 2, neib_step)]
def c_code_cache_version(self): def c_code_cache_version(self):
return (5,) return (5,)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论