pixel_cnn_pp/linearize.py
def memsorted(nodes):
  """Sort nodes by estimated memory usage."""

  def node_memory(unused_node, default_memory=1):
    return default_memory
  def node_name(node):
    return node.name

  def subtree_memory(node):
    return (node_memory(node) + sum(node_memory(parent) for
                                    parent in parents(node)))

  # sort by estimated memory, break ties in reverse alphabetical order
  # this gives regular alphabetic order when used with linearize
  nodes = sorted(nodes, key=node_name, reverse=True)
  nodes = sorted(nodes, key=subtree_memory)
  return nodes
Sort nodes by estimated memory usage.
Sort nodes by estimated memory usage.
Sort nodes by estimated memory usage .
def memsorted(nodes):
  def node_memory(unused_node, default_memory=1):
    return default_memory
  def node_name(node):
    return node.name
  def subtree_memory(node):
    return (node_memory(node) + sum(node_memory(parent) for
                                    parent in parents(node)))
  nodes = sorted(nodes, key=node_name, reverse=True)
  nodes = sorted(nodes, key=subtree_memory)
  return nodes
def memsorted ( nodes ) : def node_memory ( unused_node , default_memory = 1 ) : return default_memory def node_name ( node ) : return node . name def subtree_memory ( node ) : return ( node_memory ( node ) + sum ( node_memory ( parent ) for parent in parents ( node ) ) ) nodes = sorted ( nodes , key = node_name , reverse = True ) nodes = sorted ( nodes , key = subtree_memory ) return nodes
Sort nodes by estimated memory usage.
Sort nodes by estimated memory usage .
"""Sort nodes by estimated memory usage.""" # sort by estimated memory, break ties in reverse alphabetical order # this gives regular alphabetic order when used with linearize
nodes