提交 35ff6f6a authored 作者: Olivier Delalleau's avatar Olivier Delalleau

Fixes related to the new usage of ShapeError instead of NotImplementedError

上级 61493b72
...@@ -4,6 +4,7 @@ This is not used currently very used. It appear in some case, but I'm not sure i ...@@ -4,6 +4,7 @@ This is not used currently very used. It appear in some case, but I'm not sure i
It could help the current system to make it detect problem earlier when contructing the graph instead of during optimization. It could help the current system to make it detect problem earlier when contructing the graph instead of during optimization.
""" """
import sys import sys
import theano
from theano import gof from theano import gof
def ishape(v): def ishape(v):
...@@ -35,7 +36,7 @@ class Apply(gof.Apply): ...@@ -35,7 +36,7 @@ class Apply(gof.Apply):
try: try:
oshapes = infer_shape(self, ishapes) oshapes = infer_shape(self, ishapes)
except NotImplementedError: except theano.tensor.opt.ShapeError:
return return
for o, oshp in zip(outputs, oshapes): for o, oshp in zip(outputs, oshapes):
......
...@@ -575,14 +575,15 @@ class ConvOp(Op): ...@@ -575,14 +575,15 @@ class ConvOp(Op):
try: try:
fmshp = ConvOp.getOutputShape(imshp[1:], kshp, (self.dx,self.dy), self.out_mode) fmshp = ConvOp.getOutputShape(imshp[1:], kshp, (self.dx,self.dy), self.out_mode)
except TypeError: except TypeError:
raise NotImplementedError() raise theano.tensor.opt.ShapeError()
outshp = (batch_size,fmo) + tuple(fmshp) outshp = (batch_size,fmo) + tuple(fmshp)
return [outshp] return [outshp]
else: else:
# Haven't implemented this case. imshp and kshp may be symbollic # Haven't implemented this case. imshp and kshp may be symbollic
# and ConvOp.getOutputShape doesn't handle this. In this case # and ConvOp.getOutputShape doesn't handle this. In this case
# we simply let the default function do its work. # we simply let the default function do its work.
raise NotImplementedError() raise theano.tensor.opt.ShapeError()
def perform(self,node, inp, out): def perform(self,node, inp, out):
""" """
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论