class_docstr: There are the steps how the TF2Loader loads and converts the TF2 model
  1. Get the concrete functions from the Keras model (only 1 concrete function is supported now)
  2. Get the tensorflow graphdef from the concrete function by doing
     (a) calling tensorflow's convert_variables_to_constants_v2 API to freeze variables into constants
     (b) run grappler optimizations on the graphdef ("constfold", "dependency", "debug_stripper")
  3. Extract sub graph based on "outputs"
  4. Construct tfssa IR from graphdef
  5. Run tfssa graph passes
  6. Convert tfssa to program by TF2Converter
class_docstr_tok: ["There","are","the","steps","how","the","TF2Loader","loads","and","converts","the","TF2","model","1",".","Get","the","concrete","functions","from","the","Keras","model","(","only","1","concrete","function","is","supported","now",")","2",".","Get","the","tensorflow","graphdef","from","the","concrete","function","by","doing","(","a",")","calling","tensorflow","'s","convert_variables_to_constants_v2","API","to","freeze","variables","into","constants","(","b",")","run","grappler","optimizations","on","the","graphdef","(","``","constfold","''",",","``","dependency","''",",","``","debug_stripper","''",")","3",".","Extract","sub","graph","based","on","``","outputs","''","4",".","Construct","tfssa","IR","from","graphdef","5",".","Run","tfssa","graph","passes","6",".","Convert","tfssa","to","program","by","TF2Converter"]
docstr: Populate function (sub-graph) input shapes from control flow op's inputs
  Note that the functions (sub-graphs) are not nested but the control flow
  ops are nested. The input shapes are used to extract sub-graphs from the
  parent graph (as the input of function_def_to_graph).
  
  Parameter
  ---------
  graph: tf.Graph
      TensorFlow graph.
  graph_fns: list of graph functions.
      List of TensorFlow graph functions.
  
  Returns
  -------
  sg_input_shapes: dict(str: list)
      Dictionary of function (sub-graph) name and input shape pairs.
docstr_tok: ["Populate","function","(","sub-graph",")","input","shapes","from","control","flow","op","'s","inputs","Note","that","the","functions","(","sub-graphs",")","are","not","nested","but","the","control","flow","ops","are","nested",".","The","input","shapes","are","used","to","extract","sub-graphs","from","the","parent","graph","(","as","the","input","of","function_def_to_graph",")",".","Parameter","--","--","--","--","-","graph",":","tf.Graph","TensorFlow","graph",".","graph_fns",":","list","of","graph","functions",".","List","of","TensorFlow","graph","functions",".","Returns","--","--","--","-","sg_input_shapes",":","dict","(","str",":","list",")","Dictionary","of","function","(","sub-graph",")","name","and","input","shape","pairs","."]
code: def _populate_sub_graph_input_shapes(self, graph, graph_fns):
      """
      Populate function (sub-graph) input shapes from control flow op's inputs
      Note that the functions (sub-graphs) are not nested but the control flow
      ops are nested. The input shapes are used to extract sub-graphs from the
      parent graph (as the input of function_def_to_graph).
  
      Parameter
      ---------
      graph: tf.Graph
          TensorFlow graph.
      graph_fns: list of graph functions.
          List of TensorFlow graph functions.
  
      Returns
      -------
      sg_input_shapes: dict(str: list)
          Dictionary of function (sub-graph) name and input shape pairs.
      """
      sg_input_shapes = {}
      sub_graphs = []
      for op in graph.get_operations():
          if op.type not in {
              "StatelessIf",
              "If",
              "StatelessWhile",
              "While",
          }:
              continue
  
          sg1, sg2 = None, None
          if op.type in {"StatelessIf", "If"}:
              sg1 = op.get_attr("then_branch").name
              sg2 = op.get_attr("else_branch").name
          if op.type in {"StatelessWhile", "While"}:
              sg1 = op.get_attr("cond").name
              sg2 = op.get_attr("body").name
  
          # memorize input shapes for sub-graph conversions
          op_input_shapes = [i.get_shape() for i in op.inputs]
          sg_input_shapes.update(
              {sg1: op_input_shapes, sg2: op_input_shapes}
          )
          sub_graphs += [sg1, sg2]
  
      for name in sub_graphs:
          sg = graph_fns.get(name)
          fn_def = context.get_function_def(name)
          op_input_shapes = sg_input_shapes[name]
          op_input_shapes = op_input_shapes[
              -len(fn_def.signature.input_arg) :
          ]
          fn_graph = _function_def_to_graph(
              fn_def, input_shapes=op_input_shapes
          )
          sg_input_shapes.update(
              self._populate_sub_graph_input_shapes(fn_graph, graph_fns)
          )
  
      return sg_input_shapes
  
imports: import os.path
  from distutils.version import StrictVersion
  import tensorflow
  from tensorflow.lite.python.util import get_grappler_config
  from tensorflow.lite.python.util import run_graph_optimizations
  from tensorflow.python.eager import context
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework.convert_to_constants import convert_variables_to_constants_v2
  from tensorflow.python.framework.function_def_to_graph import function_def_to_graph
  from tensorflow.python.keras.saving import saving_utils
  from tqdm import tqdm
  from coremltools import _logger
  from coremltools._deps import _get_version
  from coremltools.converters.mil.frontend.tensorflow2.tf_graph_pass import flatten_sub_graph_namespaces, rewrite_control_flow_functions
  from coremltools.converters.mil.frontend.tensorflow.basic_graph_ops import fill_outputs
  from coremltools.converters.mil.frontend.tensorflow.load import TFLoader
  from coremltools.converters.mil.frontend.tensorflow.parsed_tf_node import ParsedTFNode
  from coremltools.converters.mil.frontend.tensorflow.tf_graph_pass import constant_propagation, delete_disconnected_nodes, delete_unnecessary_constant_nodes, fuse_dilation_conv, insert_get_tuple, remove_variable_nodes, tensor_array_resource_removal
  from coremltools.converters.mil.frontend.tensorflow.tfssa import NetworkEnsemble, SSAFunction
  from coremltools.converters.mil.input_types import TensorType
  from .converter import TF2Converter
label_desc: Use image node_id 7 for calling the TF2Loader obj's underlying member method code with example usage: obj._populate_sub_graph_input_shapes(graph, graph_fns) and returns: sg_input_shapes