parameters: (self, name)
return_statement: return res
docstring: return a dict representation of the network
docstring_summary: return a dict representation of the network
docstring_tokens: return a dict representation of the network
function: def toDictionary(self, name) :
          """return a dict representation of the network"""
          def do(dct, layer, level) :
              dct[layer.name] = layer.toDictionary()
              dct[layer.name]["level"] = level
              for  lin in self.inConnections[layer] :
                  if lin.name in dct :
                      dct[layer.name]["level"] = max(dct[lin.name]["level"]+1, dct[layer.name]["level"])
               
              dct[layer.name]["abstractions"] = OrderedDict()
              for k, v in layer.abstractions.iteritems() :
                  dct[layer.name]["abstractions"][k] = OrderedDict()
                  if type(v) is list :
                      for vv in v :
                          dct[layer.name]["abstractions"][k][vv.__class__.__name__] = vv.toDictionary()
                  else :
                      dct[layer.name]["abstractions"][k][v.__class__.__name__] = v.toDictionary()
  
              for l2 in self.outConnections[layer] :
                  dct.update(do(dct, l2, level+1) )
              
              return dct
  
          res = {}
          res["layers"] = OrderedDict()
  
          levels = {}
          for layerName, layer in self.inputs.iteritems() :
              res["layers"].update(do(res["layers"], layer, 0))
  
          res["edges"] = []
          for t, f in self.edges.iterkeys() :
              res["edges"].append({"from": t, "to": f})
  
          res["name"] = name
          res["notes"] = self.notes
  
          return res
function_tokens: def toDictionary ( self , name ) : def do ( dct , layer , level ) : dct [ layer . name ] = layer . toDictionary ( ) dct [ layer . name ] [ "level" ] = level for lin in self . inConnections [ layer ] : if lin . name in dct : dct [ layer . name ] [ "level" ] = max ( dct [ lin . name ] [ "level" ] + 1 , dct [ layer . name ] [ "level" ] ) dct [ layer . name ] [ "abstractions" ] = OrderedDict ( ) for k , v in layer . abstractions . iteritems ( ) : dct [ layer . name ] [ "abstractions" ] [ k ] = OrderedDict ( ) if type ( v ) is list : for vv in v : dct [ layer . name ] [ "abstractions" ] [ k ] [ vv . __class__ . __name__ ] = vv . toDictionary ( ) else : dct [ layer . name ] [ "abstractions" ] [ k ] [ v . __class__ . __name__ ] = v . toDictionary ( ) for l2 in self . outConnections [ layer ] : dct . update ( do ( dct , l2 , level + 1 ) ) return dct res = { } res [ "layers" ] = OrderedDict ( ) levels = { } for layerName , layer in self . inputs . iteritems ( ) : res [ "layers" ] . update ( do ( res [ "layers" ] , layer , 0 ) ) res [ "edges" ] = [ ] for t , f in self . edges . iterkeys ( ) : res [ "edges" ] . append ( { "from" : t , "to" : f } ) res [ "name" ] = name res [ "notes" ] = self . notes return res