提交 5b150c63 authored 作者: Frederic's avatar Frederic

Don't catch interrupt.

上级 e6e229ef
...@@ -443,7 +443,7 @@ class Env(utils.object2): ...@@ -443,7 +443,7 @@ class Env(utils.object2):
""" """
try: try:
self._features.remove(feature) self._features.remove(feature)
except: except Exception:
return return
detach = getattr(feature, 'on_detach', None) detach = getattr(feature, 'on_detach', None)
if detach is not None: if detach is not None:
......
...@@ -23,7 +23,7 @@ class Test_DB(TestCase): ...@@ -23,7 +23,7 @@ class Test_DB(TestCase):
pass pass
else: else:
raise raise
except: except Exception:
self.fail() self.fail()
try: try:
...@@ -34,7 +34,7 @@ class Test_DB(TestCase): ...@@ -34,7 +34,7 @@ class Test_DB(TestCase):
pass pass
else: else:
raise raise
except: except Exception:
self.fail() self.fail()
try: try:
...@@ -45,7 +45,7 @@ class Test_DB(TestCase): ...@@ -45,7 +45,7 @@ class Test_DB(TestCase):
pass pass
else: else:
raise raise
except: except Exception:
self.fail() self.fail()
...@@ -299,13 +299,13 @@ class TestScan(unittest.TestCase): ...@@ -299,13 +299,13 @@ class TestScan(unittest.TestCase):
for th_out, num_out in zip(theano_outs, numpy_outs): for th_out, num_out in zip(theano_outs, numpy_outs):
try: try:
assert numpy.allclose(th_out, num_out) assert numpy.allclose(th_out, num_out)
except: except Exception:
#import ipdb; ipdb.set_trace() #import ipdb; ipdb.set_trace()
raise raise
for th_out, num_out in zip(shared_vars, numpy_shared): for th_out, num_out in zip(shared_vars, numpy_shared):
try: try:
assert numpy.allclose(th_out.get_value(), num_out) assert numpy.allclose(th_out.get_value(), num_out)
except: except Exception:
#import ipdb; ipdb.set_trace() #import ipdb; ipdb.set_trace()
raise raise
# Scenario 2 : Loose fit (sequences longer then required) # Scenario 2 : Loose fit (sequences longer then required)
......
...@@ -496,7 +496,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -496,7 +496,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(f.maker.env.toposort()) == 4 assert len(f.maker.env.toposort()) == 4
f(x_val, y_val) f(x_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -507,7 +507,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -507,7 +507,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(g.maker.env.toposort()) == 4 assert len(g.maker.env.toposort()) == 4
g(x_val, y_val) g(x_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -525,7 +525,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -525,7 +525,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(f.maker.env.toposort()) == 2 # [big_op, sum] assert len(f.maker.env.toposort()) == 2 # [big_op, sum]
f(x_val, b_val, y_val) f(x_val, b_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -535,7 +535,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -535,7 +535,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(g.maker.env.toposort()) == 4 assert len(g.maker.env.toposort()) == 4
g(x_val, b_val, y_val) g(x_val, b_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -553,7 +553,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -553,7 +553,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(f.maker.env.toposort()) == 6 assert len(f.maker.env.toposort()) == 6
f(x_val, y_val) f(x_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -564,7 +564,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -564,7 +564,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert len(g.maker.env.toposort()) in (6,7) #there's an extra dimshuffle in there assert len(g.maker.env.toposort()) in (6,7) #there's an extra dimshuffle in there
# but I can't think of a good rule to get rid of it # but I can't think of a good rule to get rid of it
g(x_val, y_val) g(x_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -580,7 +580,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -580,7 +580,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
theano.printing.debugprint(f) theano.printing.debugprint(f)
try: try:
assert len(f.maker.env.toposort()) == 4 assert len(f.maker.env.toposort()) == 4
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -590,7 +590,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -590,7 +590,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(g.maker.env.toposort()) in (6,7) assert len(g.maker.env.toposort()) in (6,7)
g(x_val, b_val, y_val) g(x_val, b_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -624,7 +624,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -624,7 +624,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(f.maker.env.toposort()) == 5 assert len(f.maker.env.toposort()) == 5
f(x_val, y_val) f(x_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -635,7 +635,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -635,7 +635,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
try: try:
assert len(g.maker.env.toposort()) == 5 assert len(g.maker.env.toposort()) == 5
g(x_val, y_val) g(x_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -671,7 +671,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -671,7 +671,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
prev, last = f.maker.env.toposort()[-2:] prev, last = f.maker.env.toposort()[-2:]
assert len(f.maker.env.toposort()) == 5 assert len(f.maker.env.toposort()) == 5
f(x_val, y_val) f(x_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -684,7 +684,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -684,7 +684,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert softmax in ops assert softmax in ops
assert softmax_grad not in ops assert softmax_grad not in ops
g(x_val, y_val) g(x_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -723,7 +723,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -723,7 +723,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
prev, last = f.maker.env.toposort()[-2:] prev, last = f.maker.env.toposort()[-2:]
assert len(f.maker.env.toposort()) == 3 # [big_op, sum, dim_shuffle] assert len(f.maker.env.toposort()) == 3 # [big_op, sum, dim_shuffle]
f(x_val, b_val, y_val) f(x_val, b_val, y_val)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -742,7 +742,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -742,7 +742,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert softmax_with_bias in ops assert softmax_with_bias in ops
assert softmax_grad not in ops assert softmax_grad not in ops
g(x_val, b_val, y_val) g(x_val, b_val, y_val)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -831,7 +831,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -831,7 +831,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert 5 <= len(f.maker.env.toposort()) <= 10 assert 5 <= len(f.maker.env.toposort()) <= 10
validate_fn_graph(f) validate_fn_graph(f)
f(x_val, y_val, 0.1) f(x_val, y_val, 0.1)
except: except Exception:
theano.printing.debugprint(f) theano.printing.debugprint(f)
raise raise
...@@ -841,7 +841,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -841,7 +841,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert 5 <= len(g.maker.env.toposort()) <= 12 assert 5 <= len(g.maker.env.toposort()) <= 12
validate_grad_graph(g) validate_grad_graph(g)
g(x_val, y_val, 0.1) g(x_val, y_val, 0.1)
except: except Exception:
theano.printing.debugprint(g) theano.printing.debugprint(g)
raise raise
...@@ -851,7 +851,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase): ...@@ -851,7 +851,7 @@ class T_CrossentropyCategorical1Hot(unittest.TestCase):
assert 8 <= len(h.maker.env.toposort()) <= 17 assert 8 <= len(h.maker.env.toposort()) <= 17
validate_grad_graph(h) validate_grad_graph(h)
h(x_val, y_val, 0.1) h(x_val, y_val, 0.1)
except: except Exception:
theano.printing.debugprint(h) theano.printing.debugprint(h)
raise raise
......
...@@ -61,7 +61,7 @@ def scalar_constructor(value, name=None, strict=False, allow_downcast=None): ...@@ -61,7 +61,7 @@ def scalar_constructor(value, name=None, strict=False, allow_downcast=None):
raise TypeError() raise TypeError()
try: try:
dtype=value.dtype dtype=value.dtype
except: except Exception:
dtype=numpy.asarray(value).dtype dtype=numpy.asarray(value).dtype
dtype=str(dtype) dtype=str(dtype)
...@@ -75,6 +75,6 @@ def scalar_constructor(value, name=None, strict=False, allow_downcast=None): ...@@ -75,6 +75,6 @@ def scalar_constructor(value, name=None, strict=False, allow_downcast=None):
value=numpy.array(value, copy=True), value=numpy.array(value, copy=True),
name=name, strict=strict, allow_downcast=allow_downcast) name=name, strict=strict, allow_downcast=allow_downcast)
return rval return rval
except: except Exception:
traceback.print_exc() traceback.print_exc()
raise raise
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论