docstr: Convert a Merge's Switch nodes to Identity ops and the Merge to iff.
docstr_tok: ["Convert","a","Merge","'s","Switch","nodes","to","Identity","ops","and","the","Merge","to","iff","."]
code: def _fix_found_cond(g, merge, switches):
      """
      Convert a Merge's Switch nodes to Identity ops and the Merge to iff.
      """
      if g[switches[0]].op == "Switch":
          condition_input = g[switches[0]].inputs[1]
      else:
          condition_input = g[switches[0]].attr["was_switch"]
  
      # convert the merge to a select
      # TensorFlow seems to ensure the condition that the first
      # merge input is the True branch and the second merge input
      # is the false branch.
  
      # we convert switches to identity, detaching to switch condition
      for s in switches:
          if g[s].op == "Switch":
              g[s].op = "Identity"
              g[s].attr["was_switch"] = g[s].inputs[1]
              # detach input 1: the switch condition
              if g[s].inputs[0] == g[s].inputs[1]:
                  g[s].inputs.pop()
                  g[g[s].inputs[0]].outputs.pop()
              else:
                  disconnect_edge(g, g[s].inputs[1], s)
  
      # build the final select
      g[merge].op = "iff"
      if not _HAS_TF_2:
          # swap true branch with false branch to get the right semantics for IFF
          g[merge].inputs[0], g[merge].inputs[1] = (
              g[merge].inputs[1],
              g[merge].inputs[0],
          )
  
      g[merge].inputs = [condition_input] + g[merge].inputs
      g[condition_input].outputs.append(merge)
  
file_path: turicreate/src/external/coremltools_wrap/coremltools/coremltools/converters/mil/frontend/tensorflow/tf_graph_pass/cond_to_where.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  from ..basic_graph_ops import delete_node, disconnect_edge
  from .visitors import FindAllUpstreamTerminals
  import logging
  from coremltools._deps import _HAS_TF_2
label_desc: Use image node_id 2 for calling the CondToWhere obj's underlying member method code with example usage: obj._fix_found_cond(g, merge, switches) without return types