提交 4a0f0342 authored 作者: Frederic Bastien's avatar Frederic Bastien

Don't catch interupt and remove import not used.

上级 f9813f0f
...@@ -702,7 +702,7 @@ def pydotprint_variables(vars, ...@@ -702,7 +702,7 @@ def pydotprint_variables(vars,
config.device + '.' + format) config.device + '.' + format)
try: try:
import pydot as pd import pydot as pd
except: except ImportError:
print "failed to import pydot. Yous must install pydot for this function to work." print "failed to import pydot. Yous must install pydot for this function to work."
return return
g=pd.Dot() g=pd.Dot()
......
...@@ -264,7 +264,7 @@ def nvcc_module_compile_str( ...@@ -264,7 +264,7 @@ def nvcc_module_compile_str(
continue continue
if l[l.index(':'):].startswith(': warning: label'): if l[l.index(':'):].startswith(': warning: label'):
continue continue
except: except Exception:
pass pass
print >> sys.stderr, l print >> sys.stderr, l
print >> sys.stderr, '===============================' print >> sys.stderr, '==============================='
......
import sys, time import sys, time
from theano.compile.sharedvalue import shared
from theano.compile.pfunc import pfunc from theano.compile.pfunc import pfunc
from theano import tensor from theano import tensor
import numpy import numpy
import theano.sandbox.cuda as tcn import theano.sandbox.cuda as tcn
from theano.sandbox.cuda.basic_ops import host_from_gpu, gpu_from_host
def compare_fns(fns, input, reps=10): def compare_fns(fns, input, reps=10):
times = {} times = {}
...@@ -15,7 +13,7 @@ def compare_fns(fns, input, reps=10): ...@@ -15,7 +13,7 @@ def compare_fns(fns, input, reps=10):
print 'TOPOSORT', implname print 'TOPOSORT', implname
for i, n in enumerate(impl.maker.env.toposort()): for i, n in enumerate(impl.maker.env.toposort()):
print i, n print i, n
except: except Exception:
pass pass
t0 = time.time() t0 = time.time()
for i in xrange(reps): for i in xrange(reps):
......
...@@ -12,7 +12,7 @@ from theano.gof.opt import Optimizer ...@@ -12,7 +12,7 @@ from theano.gof.opt import Optimizer
try: try:
import scipy.linalg import scipy.linalg
except: except ImportError:
pass # some ops (e.g. Cholesky) won't work pass # some ops (e.g. Cholesky) won't work
class Hint(Op): class Hint(Op):
......
...@@ -61,7 +61,7 @@ class SymbolicModule(object): ...@@ -61,7 +61,7 @@ class SymbolicModule(object):
def issymbolicmodule(thing): def issymbolicmodule(thing):
try: try:
return issubclass(thing, SymbolicModule) return issubclass(thing, SymbolicModule)
except: except Exception:
return False return False
def issymbolicmethod(thing): def issymbolicmethod(thing):
......
...@@ -1104,7 +1104,7 @@ class Scan(PureOp): ...@@ -1104,7 +1104,7 @@ class Scan(PureOp):
# states) it is more of a safety check ( all random # states) it is more of a safety check ( all random
# states should be after n_outs_not_shared ... # states should be after n_outs_not_shared ...
g_outs[i] = tensor.zeros_like(scan_outputs[i]) g_outs[i] = tensor.zeros_like(scan_outputs[i])
except: except Exception:
g_outs[i] = theano.tensor.constant( g_outs[i] = theano.tensor.constant(
numpy.array(0, theano.config.floatX)) numpy.array(0, theano.config.floatX))
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论