docstr: tfssa: TensorFlow IR.
  inputs: list of TensorType or ImageType, optional, defaults to None.
  outputs: list of str or str, optional, defaults to None.
      A list of names of the output nodes or a str for single output name.
      If None, the converter will try to extract the output information from
      TensorFlow model.
docstr_tok: ["tfssa",":","TensorFlow","IR",".","inputs",":","list","of","TensorType","or","ImageType",",","optional",",","defaults","to","None",".","outputs",":","list","of","str","or","str",",","optional",",","defaults","to","None",".","A","list","of","names","of","the","output","nodes","or","a","str","for","single","output","name",".","If","None",",","the","converter","will","try","to","extract","the","output","information","from","TensorFlow","model","."]
code: def __init__(self, tfssa, inputs=None, outputs=None, **kwargs):
      """
      tfssa: TensorFlow IR.
      inputs: list of TensorType or ImageType, optional, defaults to None.
      outputs: list of str or str, optional, defaults to None.
          A list of names of the output nodes or a str for single output name.
          If None, the converter will try to extract the output information from
          TensorFlow model.
      """
      self.tfssa = tfssa
      self.global_type = {}
      self.inputs = None
  
      main_func = tfssa.functions["main"]
      graph = main_func.graph
  
      # Filter the inputs to only Placeholder names
      tf_placeholder_names = [
          n for n in graph if graph[n].op == "Placeholder"
      ]
      placeholder_names = []
      if inputs is not None:
          # Check inputs format
          if not isinstance(inputs, (list, tuple)):
              raise ValueError(
                  "Type of inputs should be list or tuple, got {} instead.".format(
                      type(inputs)
                  )
              )
          if not all([isinstance(i, InputType) for i in inputs]):
              raise ValueError(
                  "Type of inputs should be list or tuple of TensorType or ImageType, got {} instead.".format(
                      [type(i) for i in inputs]
                  )
              )
  
          # Special case: if there's only 1 input and 1 placeholder, we match them.
          if len(tf_placeholder_names) == 1 and len(inputs) == 1:
              if inputs[0].name is None:
                  inputs[0].name = tf_placeholder_names[0]
  
          # filter out those inputs which is not in tf_placeholder_names
          inputs = [x for x in inputs if x.name in tf_placeholder_names]
  
          # We fill in shapes for user-specified input that doesn't have shape
          for inp in inputs:
              # Check inputs existence
              if inp.name is None:
                  raise ValueError(
                      "Unable to infer input's name or input name was not provided"
                  )
              if inp.name not in tf_placeholder_names:
                  raise ValueError(
                      "Input ({}) provided is not found in given tensorflow graph. Placeholders in graph are: {}".format(
                          inp.name, tf_placeholder_names
                      )
                  )
              if inp.shape is None:
                  if (
                      graph[inp.name].attr.get("_output_shapes", None)
                      is not None
                  ):
                      shape = graph[inp.name].attr["_output_shapes"][0]
                      if shape is None:
                          # Scalar is given as None
                          shape = []
                  elif (
                      graph[inp.name].attr.get("shape", None)
                      is not None
                  ):
                      shape = graph[inp.name].attr["shape"]
                  else:
                      raise ValueError(
                          "Can't extract shape from attribute of ({})".format(
                              inp.name
                          )
                      )
                  inp.shape = _get_shaping_class(shape)
  
          # Extract placeholders that users didn't specify.
          user_input_names = [inp.name for inp in inputs]
          for name in tf_placeholder_names:
              if name not in user_input_names:
                  placeholder_names.append(name)
      else:
          inputs = []
          placeholder_names = tf_placeholder_names
  
      placeholder_inputs = {}
      for inp in main_func.inputs:
          if inp not in placeholder_names:
              continue
          if graph[inp].attr.get("_output_shapes", None) is not None:
              placeholder_inputs.update(
                  {inp: graph[inp].attr["_output_shapes"][0]}
              )
          elif graph[inp].attr.get("shape", None) is not None:
              placeholder_inputs.update({inp: graph[inp].attr["shape"]})
          else:
              raise ValueError(
                  "Can't find input shape for ({})".format(inp)
              )
  
      if len(placeholder_inputs) > 0:
          logging.info(
              "Adding Input not specified by users: '{}'".format(
                  placeholder_inputs
              )
          )
  
      for k, v in placeholder_inputs.items():
          inputs.append(TensorType(name=k, shape=v))
      for idx, inp in enumerate(inputs):
          # We set the default image format in TF as NHWC, since NHWC is used
          # for TF unless GPU is specified as device.
          if (
              isinstance(inp, ImageType)
              and inputs[idx].channel_first is None
          ):
              inputs[idx].channel_first = False
      self.inputs = tuple(inputs)
  
      for inputtype in self.inputs:
          if not isinstance(inputtype.shape, InputShape):
              continue
          if any(
              [isinstance(s, RangeDim) for s in inputtype.shape.shape]
          ):
              continue
          node = graph[inputtype.name]
          shape = [
              -1 if is_symbolic(s) else s for s in inputtype.shape.shape
          ]
          node.attr["_output_shapes"] = [shape]  # list of length 1
  
      # infer outputs if not provided
      self._validate_outputs(tfssa, outputs)
      outputs = main_func.outputs if outputs is None else outputs
      outputs = (
          outputs if isinstance(outputs, (tuple, list)) else [outputs]
      )
      outputs = [
          x if isinstance(x, six.string_types) else x.name
          for x in outputs
      ]
      self.outputs = outputs
  
      # We would like a stack so that we run conversion sequentially.
      self.graph_stack = self._get_stack(tfssa, root="main")
      self.context = TranscriptionContext()
      self.tensorflow_passes = tensorflow_passes
  
imports: import six
  import logging
  from coremltools.converters.mil.input_types import InputType, TensorType, ImageType, RangeDim, _get_shaping_class
  from coremltools.converters.mil.input_types import Shape
  from coremltools.converters.mil.mil.var import Var
  from coremltools.converters.mil.mil import get_new_symbol
  from coremltools.converters.mil.mil.types.symbolic import is_symbolic
  from coremltools.converters.mil.mil import types
  from .basic_graph_ops import topsort, simple_topsort
  from .convert_utils import convert_graph
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Program
  from coremltools.converters.mil.mil import Function
  from .ssa_passes.tf_passes import tensorflow_passes
  from coremltools.converters._profile_utils import _profile
label_desc: Use image node_id 1 to create a new TFConverter object  with example: obj = TFConverter(tfssa, inputs, outputs)