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__) < Version("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)
Extract sub-graph based on user-provided outputs.
coremltools/converters/mil/frontend/tensorflow/load.py