提交 0925ce7a authored 作者: Pascal Lamblin's avatar Pascal Lamblin

Auto indentation.

上级 115c38aa
...@@ -61,9 +61,9 @@ class SymbolicInput(object): ...@@ -61,9 +61,9 @@ class SymbolicInput(object):
raise TypeError("name must be a string! (got: %s)" % self.name) raise TypeError("name must be a string! (got: %s)" % self.name)
self.update = update self.update = update
if (mutable is not None): if (mutable is not None):
self.mutable = mutable self.mutable = mutable
else: else:
self.mutable = (update is not None) self.mutable = (update is not None)
self.strict = strict self.strict = strict
self.allow_downcast = allow_downcast self.allow_downcast = allow_downcast
...@@ -255,5 +255,3 @@ class SymbolicOutput(object): ...@@ -255,5 +255,3 @@ class SymbolicOutput(object):
return "Out(%s,%s)" % (self.variable, self.borrow) return "Out(%s,%s)" % (self.variable, self.borrow)
Out = SymbolicOutput Out = SymbolicOutput
...@@ -113,7 +113,7 @@ def get_home_dir(): ...@@ -113,7 +113,7 @@ def get_home_dir():
home = os.getenv('USERPROFILE') home = os.getenv('USERPROFILE')
assert home is not None assert home is not None
return home return home
AddConfigVar('home', AddConfigVar('home',
"User home directory", "User home directory",
StrParam(get_home_dir()), StrParam(get_home_dir()),
......
...@@ -7,7 +7,7 @@ class CallCache(object): ...@@ -7,7 +7,7 @@ class CallCache(object):
self.filename = filename self.filename = filename
try: try:
if filename is None: if filename is None:
raise IOError('bad filename') #just goes to except raise IOError('bad filename') #just goes to except
f = file(filename, 'r') f = file(filename, 'r')
self.cache = cPickle.load(f) self.cache = cPickle.load(f)
f.close() f.close()
...@@ -16,7 +16,7 @@ class CallCache(object): ...@@ -16,7 +16,7 @@ class CallCache(object):
def persist(self, filename=None): def persist(self, filename=None):
if filename is None: if filename is None:
filename = self.filename filename = self.filename
#backport #backport
#filename = self.filename if filename is None else filename #filename = self.filename if filename is None else filename
...@@ -26,7 +26,7 @@ class CallCache(object): ...@@ -26,7 +26,7 @@ class CallCache(object):
def call(self, fn, args=(), key=None): def call(self, fn, args=(), key=None):
if key is None: if key is None:
key = (fn, tuple(args)) key = (fn, tuple(args))
#backport #backport
#key = (fn, tuple(args)) if key is None else key #key = (fn, tuple(args)) if key is None else key
...@@ -43,4 +43,3 @@ class CallCache(object): ...@@ -43,4 +43,3 @@ class CallCache(object):
self.persist() self.persist()
except Exception, e: except Exception, e:
_logger.error('persist failed %s %s', self.filename, e) _logger.error('persist failed %s %s', self.filename, e)
...@@ -196,7 +196,7 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -196,7 +196,7 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
if verbosity <= 1: if verbosity <= 1:
no_display = True no_display = True
time.sleep(random.uniform(min_wait, max_wait)) time.sleep(random.uniform(min_wait, max_wait))
try: try:
os.mkdir(tmp_dir) os.mkdir(tmp_dir)
except OSError: except OSError:
...@@ -205,10 +205,10 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -205,10 +205,10 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
continue continue
# Safety check: the directory should be here. # Safety check: the directory should be here.
assert os.path.isdir(tmp_dir) assert os.path.isdir(tmp_dir)
# Write own id into lock file. # Write own id into lock file.
unique_id = refresh_lock(lock_file) unique_id = refresh_lock(lock_file)
# Verify we are really the lock owner (this should not be needed, # Verify we are really the lock owner (this should not be needed,
# but better be safe than sorry). # but better be safe than sorry).
owner = open(lock_file).readlines()[0].strip() owner = open(lock_file).readlines()[0].strip()
...@@ -276,4 +276,3 @@ class Unlocker(object): ...@@ -276,4 +276,3 @@ class Unlocker(object):
self.os.rmdir(self.tmp_dir) self.os.rmdir(self.tmp_dir)
except: except:
pass pass
...@@ -114,7 +114,7 @@ except Exception, e: ...@@ -114,7 +114,7 @@ except Exception, e:
set_cuda_disabled() set_cuda_disabled()
if cuda_available: if cuda_available:
# If necessary, # If necessary,
# create a symlink called libcuda_ndarray.so # create a symlink called libcuda_ndarray.so
# which nvcc_module_compile_str uses when linking # which nvcc_module_compile_str uses when linking
# any module except "cuda_ndarray" itself. # any module except "cuda_ndarray" itself.
...@@ -186,7 +186,7 @@ def use(device, ...@@ -186,7 +186,7 @@ def use(device,
"nvcc was not found. Set it in your PATH " "nvcc was not found. Set it in your PATH "
"environment variable or set the Theano " "environment variable or set the Theano "
"flags 'cuda.root' to its directory" % device) "flags 'cuda.root' to its directory" % device)
else: else:
raise EnvironmentError("You forced the use of gpu device %s, " raise EnvironmentError("You forced the use of gpu device %s, "
"but CUDA initialization failed " "but CUDA initialization failed "
"with error:\n%s" % ( "with error:\n%s" % (
......
...@@ -667,7 +667,7 @@ nd_collapse_[i]=0; ...@@ -667,7 +667,7 @@ nd_collapse_[i]=0;
l=["local_str[%(ipos)s][nd_collapse-1]==1 "%locals()for ipos in range(len(node.inputs)) if not _logical_scalar(node.inputs[ipos])] l=["local_str[%(ipos)s][nd_collapse-1]==1 "%locals()for ipos in range(len(node.inputs)) if not _logical_scalar(node.inputs[ipos])]
l+=["local_ostr[%(ipos)s][nd_collapse-1]==1 "%locals()for ipos in range(len(node.outputs)) if not _logical_scalar(node.outputs[ipos])] l+=["local_ostr[%(ipos)s][nd_collapse-1]==1 "%locals()for ipos in range(len(node.outputs)) if not _logical_scalar(node.outputs[ipos])]
if len(l)>0: if len(l)>0:
print >> sio," && "," && ".join(l) print >> sio," && "," && ".join(l)
print >> sio,"""){nd_collapse=0;} """ print >> sio,"""){nd_collapse=0;} """
if self.verbose: if self.verbose:
...@@ -956,4 +956,3 @@ nd_collapse_[i]=0; ...@@ -956,4 +956,3 @@ nd_collapse_[i]=0;
#define INTDIV_POW2(a, b) (a >> b) #define INTDIV_POW2(a, b) (a >> b)
#define INTMOD_POW2(a, b) (a & ((1<<b)-1)) #define INTMOD_POW2(a, b) (a & ((1<<b)-1))
""" """
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论