提交 692aa8be authored 作者: Frederic Bastien's avatar Frederic Bastien

white space/indentation fix.

上级 32367dec
...@@ -71,16 +71,16 @@ def _print_fn(op, xin): ...@@ -71,16 +71,16 @@ def _print_fn(op, xin):
for attr in op.attrs: for attr in op.attrs:
temp = getattr(xin, attr) temp = getattr(xin, attr)
if callable(temp): if callable(temp):
pmsg = temp() pmsg = temp()
else: else:
pmsg = temp pmsg = temp
print op.message, attr,'=', pmsg print op.message, attr,'=', pmsg
class Print(Op): class Print(Op):
"""This identity-like Op has the side effect of printing a message followed by its inputs """This identity-like Op has the side effect of printing a message followed by its inputs
when it runs. Default behaviour is to print the __str__ representation. Optionally, one when it runs. Default behaviour is to print the __str__ representation. Optionally, one
can pass a list of the input member functions to execute, or attributes to print. can pass a list of the input member functions to execute, or attributes to print.
@type message: String @type message: String
@param message: string to prepend to the output @param message: string to prepend to the output
@type attrs: list of Strings @type attrs: list of Strings
...@@ -122,7 +122,7 @@ class Print(Op): ...@@ -122,7 +122,7 @@ class Print(Op):
return (1,) return (1,)
class PrinterState(gof.utils.scratchpad): class PrinterState(gof.utils.scratchpad):
def __init__(self, props = {}, **more_props): def __init__(self, props = {}, **more_props):
if isinstance(props, gof.utils.scratchpad): if isinstance(props, gof.utils.scratchpad):
self.__update__(props) self.__update__(props)
...@@ -311,9 +311,9 @@ class PPrinter: ...@@ -311,9 +311,9 @@ class PPrinter:
i += 1 i += 1
if output.name is not None or output in outputs: if output.name is not None or output in outputs:
if output.name is None: if output.name is None:
name = 'out[%i]' % outputs.index(output) name = 'out[%i]' % outputs.index(output)
else: else:
name = output.name name = output.name
#backport #backport
#name = 'out[%i]' % outputs.index(output) if output.name is None else output.name #name = 'out[%i]' % outputs.index(output) if output.name is None else output.name
current = output current = output
...@@ -401,14 +401,14 @@ def pydotprint(fct, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn ...@@ -401,14 +401,14 @@ def pydotprint(fct, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn
except: except:
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()
var_str={} var_str={}
all_strings = set() all_strings = set()
def var_name(var): def var_name(var):
if var in var_str: if var in var_str:
return var_str[var] return var_str[var]
if var.name is not None: if var.name is not None:
varstr = 'name='+var.name+" "+str(var.type) varstr = 'name='+var.name+" "+str(var.type)
elif isinstance(var,gof.Constant): elif isinstance(var,gof.Constant):
...@@ -483,8 +483,8 @@ def pydotprint(fct, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn ...@@ -483,8 +483,8 @@ def pydotprint(fct, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn
else: else:
#no name, so we don't make a var ellipse #no name, so we don't make a var ellipse
g.add_edge(pd.Edge(apply_name(var.owner),astr, label=label)) g.add_edge(pd.Edge(apply_name(var.owner),astr, label=label))
for id,var in enumerate(node.outputs): for id,var in enumerate(node.outputs):
varstr=var_name(var) varstr=var_name(var)
out = any([x[0]=='output' for x in var.clients]) out = any([x[0]=='output' for x in var.clients])
...@@ -589,8 +589,3 @@ def pydot_var(vars, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn ...@@ -589,8 +589,3 @@ def pydot_var(vars, outfile=os.path.join(config.compiledir,'theano.pydotprint.pn
g.write_png(outfile, prog='dot') g.write_png(outfile, prog='dot')
print 'The output file is available at',outfile print 'The output file is available at',outfile
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论