def dump_graph(root_name, out_name='cg.dot', variable_style=None, function_style=None):
 def trigger(trainer):
  return (trainer.updater.iteration == 1)
 if (variable_style is None):
  variable_style = _var_style
 if (function_style is None):
  function_style = _func_style
 @extension.make_extension(trigger=trigger)
 def dump_graph(trainer):
  var = trainer.observation[root_name]
  if (not isinstance(var, variable.Variable)):
   raise TypeError('root value is not a Variable')
  cg = computational_graph.build_computational_graph([var], variable_style=variable_style, function_style=function_style).dump()
  out_path = os.path.join(trainer.out, out_name)
  with open(out_path, 'w') as f:
   f.write(cg)
 return dump_graph

def dump_graph ( root_name , out_name = 'cg.dot' , variable_style = None , function_style = None ) : def trigger ( trainer ) : return ( trainer . updater . iteration == 1 ) if ( variable_style is None ) : variable_style = _var_style if ( function_style is None ) : function_style = _func_style @ extension . make_extension ( trigger = trigger ) def dump_graph ( trainer ) : var = trainer . observation [ root_name ] if ( not isinstance ( var , variable . Variable ) ) : raise TypeError ( 'root value is not a Variable' ) cg = computational_graph . build_computational_graph ( [ var ] , variable_style = variable_style , function_style = function_style ) . dump ( ) out_path = os . path . join ( trainer . out , out_name ) with open ( out_path , 'w' ) as f : f . write ( cg ) return dump_graph
returns a trainer extension to dump a computational graph .