parameters: (gd, assume_variable_nodes=None)
return_statement: return ret
docstring: Given a graph, extract all nodes that only depends on const nodes.
  
      # TODO: extract nodes that depends on the "const part" of placeholders.
docstring_summary: Given a graph, extract all nodes that only depends on const nodes.
docstring_tokens: Given a graph extract all nodes that only depends on const nodes .
function: def const_determined_nodes(gd, assume_variable_nodes=None):
      """
      Given a graph, extract all nodes that only depends on const nodes.
  
      # TODO: extract nodes that depends on the "const part" of placeholders.
      """
      if assume_variable_nodes is None:
          assume_variable_nodes = []
      vis = {}
  
      def visit(node):
          # make sure node is a ParsedNode
          if isinstance(node, six.string_types):
              node = gd[node]
          if node.name in vis:
              return
  
          if "Const" in node.op:
              vis[node.name] = True
          elif "Variable" in node.op:
              vis[node.name] = False
          elif "Placeholder" in node.op:
              vis[node.name] = False
          # TF1 uses TensorArray* while TF2 uses TensorList* ops
          elif "TensorArray" in node.op or "TensorList" in node.op:
              vis[node.name] = False
          elif "function" in node.op:
              vis[node.name] = False
          elif "global" in node.op:
              vis[node.name] = False
          elif node.name in assume_variable_nodes:
              vis[node.name] = False
          else:
              ret = True
              vis[node.name] = False
              for innode in node.inputs:
                  if isinstance(innode, six.string_types):
                      inname = innode
                  else:
                      inname = innode.name
                  if inname not in vis:
                      visit(innode)
                  if not vis[inname]:
                      ret = False
                      break
              vis[node.name] = ret
  
      for k, v in gd.items():
          if k in vis:
              continue
          visit(k)
  
      ret = []
      for k, v in vis.items():
          if v:
              ret.append(k)
      return ret
function_tokens: def const_determined_nodes ( gd , assume_variable_nodes = None ) : if assume_variable_nodes is None : assume_variable_nodes = [ ] vis = { } def visit ( node ) : # make sure node is a ParsedNode if isinstance ( node , six . string_types ) : node = gd [ node ] if node . name in vis : return if "Const" in node . op : vis [ node . name ] = True elif "Variable" in node . op : vis [ node . name ] = False elif "Placeholder" in node . op : vis [ node . name ] = False # TF1 uses TensorArray* while TF2 uses TensorList* ops elif "TensorArray" in node . op or "TensorList" in node . op : vis [ node . name ] = False elif "function" in node . op : vis [ node . name ] = False elif "global" in node . op : vis [ node . name ] = False elif node . name in assume_variable_nodes : vis [ node . name ] = False else : ret = True vis [ node . name ] = False for innode in node . inputs : if isinstance ( innode , six . string_types ) : inname = innode else : inname = innode . name if inname not in vis : visit ( innode ) if not vis [ inname ] : ret = False break vis [ node . name ] = ret for k , v in gd . items ( ) : if k in vis : continue visit ( k ) ret = [ ] for k , v in vis . items ( ) : if v : ret . append ( k ) return ret