class_docstr: Abstract class for TensorFlow model loader.
class_docstr_tok: ["Abstract","class","for","TensorFlow","model","loader","."]
docstr: Extract sub-graph based on user-provided outputs.
docstr_tok: ["Extract","sub-graph","based","on","user-provided","outputs","."]
code: def extract_sub_graph(graph_def, outputs=None):
      """Extract sub-graph based on user-provided outputs."""
      if outputs is None or len(outputs) == 0:
          return graph_def
      msg = "Extracting sub-graph based on outputs '{}' from the full model"
      logger.debug(msg.format(outputs))
      outputs = outputs if isinstance(outputs, list) else [outputs]
      outputs = [i.split(":")[0] for i in outputs]
      if _get_version(tf.__version__) < _StrictVersion("1.13.1"):
          return tf.graph_util.extract_sub_graph(graph_def, outputs)
      else:
          return tf.compat.v1.graph_util.extract_sub_graph(
              graph_def, outputs
          )
  
imports: import gc
  import os
  from distutils.version import StrictVersion
  from tempfile import mktemp
  import tensorflow
  from tqdm import tqdm
  from coremltools import _logger
  from coremltools._deps import _get_version
  from coremltools.converters._profile_utils import _profile
  from .._utils import get_output_names
  from .basic_graph_ops import fill_outputs
  from .converter import TFConverter
  from .parsed_tf_node import ParsedTFNode
  from .tf_graph_pass import cond_to_where, constant_propagation, delete_asserts, delete_disconnected_nodes, delete_unnecessary_constant_nodes, functionalize_loops, fuse_dilation_conv, insert_get_tuple, quantization_pass, remove_variable_nodes, tensor_array_resource_removal
  from .tfssa import NetworkEnsemble, SSAFunction
label_desc: Use image node_id 6 for calling the TFLoader obj's underlying member method code with example usage: obj.extract_sub_graph(graph_def, outputs) and returns: graph_def, tf, tf