def filter_inputs_and_outputs(self):
        """
        Eliminate invalid input/output nodes in the given list. Should only be
        invoked if the self.inputs and self.outputs are both provided and we
        want to respect those when adding SSAFunctions. Only needed for TF2 for
        now because of the needs to parse multiple functions in graph. TF1 only
        has one "main" function.
        """
        filtered_inputs = []
        filtered_outputs = []
        for k in self.inputs:
            if k not in self.graph.keys():
                continue
            v = self.graph[k]
            if len(v.inputs) == 0 and v.op not in {"Const", "get_global", "NoOp"}:
                filtered_inputs.append(k)
                self.input_types.append(v.datatype)
            elif len(v.inputs) != 0 and v.op == "Placeholder":
                assert len(v.inputs) == 1, "This is not a PlaceholderWithDefault!"
                filtered_inputs.append(k)
                self.input_types.append(v.datatype)
        for k in self.outputs:
            if k not in self.graph.keys():
                continue
            v = self.graph[k]
            filtered_outputs.append(k)
            self.output_types.append(v.datatype)
        self.inputs, self.outputs = filtered_inputs, filtered_outputs

        Eliminate invalid input/output nodes in the given list. Should only be
        invoked if the self.inputs and self.outputs are both provided and we
        want to respect those when adding SSAFunctions. Only needed for TF2 for
        now because of the needs to parse multiple functions in graph. TF1 only
        has one "main" function.
        
coremltools/converters/mil/frontend/tensorflow/tfssa.py