提交 26330e79 authored 作者: Frederic Bastien's avatar Frederic Bastien

white space/indentation fix.

上级 a800d64a
......@@ -380,9 +380,9 @@ class Function(object):
finder[i] = c
finder[input.variable] = c
if input.name not in finder:
finder[input.name] = c
finder[input.name] = c
else:
finder[input.name] = DUPLICATE
finder[input.name] = DUPLICATE
if input.name is None:
n_unnamed_inputs += 1
else:
......@@ -408,9 +408,9 @@ class Function(object):
finder[i] = f
finder[input] = f
if input.name not in finder:
finder[input.name] = f
finder[input.name] = f
else:
finder[input.name] = DUPLICATE
finder[input.name] = DUPLICATE
#backport
#finder[input.name] = f if input.name not in finder else DUPLICATE
#setters.append(f)
......@@ -421,9 +421,9 @@ class Function(object):
finder[sin.variable] = c
finder[sin.name] = c
if sin.name not in finder:
finder[sin.name] = c
finder[sin.name] = c
else:
finder[sin.name] = DUPLICATE
finder[sin.name] = DUPLICATE
#backport
#finder[sin.name] = c if sin.name not in finder else DUPLICATE
inv_finder[c] = input
......@@ -626,8 +626,8 @@ class Function(object):
dt_call=time.time()-t0
if hasattr(self.maker.mode,'fct_call_time'):
self.maker.mode.fct_call_time[self] += dt_call
self.maker.mode.fct_call[self] += 1
self.maker.mode.fct_call_time[self] += dt_call
self.maker.mode.fct_call[self] += 1
self.maker.mode.call_time += dt_call
self.maker.mode.fn_time += dt_fn
......@@ -732,9 +732,9 @@ class SanityCheckFunction(Function):
if not self.check_equal(c1.value, c2.value):
name = c2.name
if name:
the_name = name
the_name = name
else:
the_name = ""
the_name = ""
raise ValueError("Input #%i%s using %s and %s differs."
% (i,
#backport
......@@ -751,9 +751,9 @@ class SanityCheckFunction(Function):
if not self.check_equal(r1, r2):
name = c2.name
if name:
the_name = name
the_name = name
else:
the_name = ""
the_name = ""
raise ValueError("Variable #%i%s using %s and %s differs."
% (i,
#backport
......@@ -987,12 +987,12 @@ class FunctionMaker(object):
def _pickle_FunctionMaker(fm):
if fm.return_none:
outputs = None
outputs = None
else:
if fm.unpack_single:
outputs = fm.outputs[0]
else:
outputs = fm.outputs
if fm.unpack_single:
outputs = fm.outputs[0]
else:
outputs = fm.outputs
#backport
#outputs = None if fm.return_none else (fm.outputs[0] if fm.unpack_single else fm.outputs)
......@@ -1086,10 +1086,10 @@ def orig_function(inputs, outputs, mode=None, accept_inplace = False, name=None)
# TODO This may need to be changed to use containers as defaults.
retval = []
for default in defaults:
if isinstance(default, gof.Container):
retval +=[copy.copy(default.value)]
else:
retval +=[copy.copy(default)]
if isinstance(default, gof.Container):
retval +=[copy.copy(default.value)]
else:
retval +=[copy.copy(default)]
return retval
#backport
#return [copy.copy(default.value) if isinstance(default, gof.Container) else
......@@ -1111,9 +1111,9 @@ def orig_function(inputs, outputs, mode=None, accept_inplace = False, name=None)
fn.name = name
if hasattr(mode,'fct_call_time'):
mode.fct_call_time.setdefault(fn,0)
mode.fct_call_time.setdefault(fn,0)
if hasattr(mode,'fct_call'):
mode.fct_call.setdefault(fn,0)
mode.fct_call.setdefault(fn,0)
return fn
......@@ -1226,4 +1226,3 @@ def get_info_on_inputs(named_inputs, n_unnamed_inputs):
get_plural(n_unnamed_inputs),
get_plural(n_unnamed_inputs)))
return msg
......@@ -26,7 +26,7 @@ def check_equal(x, y):
#I put the import here to allow using theano without scipy.
import scipy.sparse as sp
x, y = x[0], y[0]
# TODO: bug in current scipy, two sparse matrices are never equal, remove when moving to 0.7
if sp.issparse(x):
x = x.todense()
......@@ -152,7 +152,7 @@ class PrintCurrentEnv(gof.Optimizer):
theano.printing.debugprint(env.outputs)
optdb = gof.SequenceDB()
optdb.register('merge1', gof.MergeOptimizer(),
optdb.register('merge1', gof.MergeOptimizer(),
0, 'fast_run', 'fast_compile')
optdb.register('canonicalize', gof.EquilibriumDB(), # rearranges elemwise expressions
1, 'fast_run', 'fast_compile')
......@@ -162,7 +162,7 @@ optdb.register('Print1.21', PrintCurrentEnv('Post-canonicalize'),
1.21,)# 'fast_run', 'fast_compile')
optdb.register('stabilize', gof.EquilibriumDB(), # replace unstable subgraphs
1.5, 'fast_run')
1.5, 'fast_run')
optdb.register('Print1.51', PrintCurrentEnv('Post-stabilize'),
1.51,) #'fast_run', 'fast_compile')
optdb.register('specialize', gof.EquilibriumDB(), # misc special cases for speed
......@@ -175,7 +175,7 @@ optdb.register('specialize_device', gof.EquilibriumDB(), # misc specia
48.6, 'fast_run')#must be after gpu stuff at 48.5
optdb.register('merge2', gof.MergeOptimizer(), # especially constant merge
49, 'fast_run')
optdb.register('add_destroy_handler', AddDestroyHandler(),
optdb.register('add_destroy_handler', AddDestroyHandler(),
49.5, 'fast_run', 'inplace')
optdb.register('merge3', gof.MergeOptimizer(), # final pass just to make sure
100, 'fast_run')
......@@ -196,7 +196,7 @@ class Mode(object):
See predefined_linkers, predefined_optimizers and also
predefined_modes.
"""
def __init__(self, linker = config.linker, optimizer = config.optimizer):
self.__setstate__((linker, optimizer))
#self.provided_optimizer - typically the `optimizer` arg. But if the `optimizer` arg is
......@@ -239,8 +239,8 @@ class Mode(object):
linker = predefined_linkers[linker]
if isinstance(optimizer, str) or optimizer is None:
optimizer = predefined_optimizers[optimizer]
return (linker, optimizer)
return (linker, optimizer)
def including(self, *tags):
link, opt = self.get_linker_optimizer(self.provided_linker, self.provided_optimizer)
#N.B. opt might be a Query instance, not sure what else it might be...
......@@ -285,7 +285,7 @@ def get_mode(orig_string):
#need to import later to break circular dependency.
from profilemode import ProfileMode,prof_mode_instance_to_print
from debugmode import DebugMode
ret = eval(string+'(linker=config.linker, optimizer=config.optimizer)')
elif not predefined_modes.has_key(string):
......@@ -318,4 +318,3 @@ def register_mode(name, mode):
if name in predefined_modes:
raise ValueError('Mode name already taken: %s' % name)
predefined_modes[name] = mode
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论