code: def convert_constant_nodes_to_const_ops(tfssa):
      """
      Convert nodes with known constant value to Const nodes
      """
      for fn_key in list(tfssa.functions.keys()):
          f = tfssa.functions[fn_key]
          for k in list(f.graph.keys()):
              v = f.graph.get(k, None)
              if v is None:
                  continue
              if v.value is not None:
                  v.op = "Const"
                  # delete all upstream edges now that this is constant
                  inv = v.inputs[:]
                  for i in inv:
                      curnode = i
                      nextnode = v.name
                      disconnect_edge(f.graph, curnode, nextnode)
  
                      # keep deleting upwards as long as it is a chain
                      while curnode is not None:
                          prevnode = None
                          if len(f.graph[curnode].outputs) == 0:
                              if len(f.graph[curnode].inputs) == 1:
                                  prevnode = f.graph[curnode].inputs[0]
                              delete_node(f.graph, curnode)
                          curnode = prevnode
  
imports: from coremltools import _logger
  from ..basic_graph_ops import check_connections, delete_node, disconnect_edge
label_desc: Use image node_id 1 for calling a global function with example usage: convert_constant_nodes_to_const_ops(tfssa) without return types