              The full model structure with unused inbound nodes and layers removed
  
          Returns
          -------
          set
              The layers from the saved model that are required to build the inference model
          """
          retval = set()
          for idx, (name, inbound) in enumerate(reversed(filtered_structure.items())):
              if idx == 0:
                  logger.debug("Adding output layer: '%s'", name)
 
</s> remove         retval = set()
        for idx, (name, inbound) in enumerate(reversed(filtered_structure.items())):
            if idx == 0:
                logger.debug("Adding output layer: '%s'", name)
                retval.add(name)
            if idx != 0 and name not in retval:
                logger.debug("Skipping unused layer: '%s'", name)
                continue
            logger.debug("Adding inbound layers: %s", inbound)
            retval.update(inbound)
        logger.debug("Required layers: %s", retval)
 </s> add         input_split = len(inputs) // 2
        start_idx = input_split * self._input_idx
        retval = inputs[start_idx: start_idx + input_split]
        logger.debug("model inputs: %s, input_split: %s, start_idx: %s, inference_inputs: %s",
                     inputs, input_split, start_idx, retval) </s> remove         filtered_structure: :class:`OrderedDict`
            The full model structure with unused inbound nodes and layers removed
 </s> add         inputs: list
            The full list of input tensors to the saved faceswap training model </s> remove         Input layers to the full model are not returned in the structure.
 </s> add         This parses the model config (in reverse) to obtain the required layers for an inference
        model. </s> remove     @classmethod
    def _get_required_layers(cls, filtered_structure):
        """ Parse through the filtered model structure in reverse order to get the required layers
        from the faceswap model for creating an inference model.
 </s> add             if not inbound:
                break

            inbound_info = self._get_nodes(inbound)

            if any(inb[0] == drop_input for inb in inbound_info):  # Switch inputs
                inbound_info = [(switch_input if inb[0] == drop_input else inb[0], inb[1])
                                for inb in inbound_info]
            struct[layer_info[0]] = inbound_info
            next_layers.extend(inbound_info)

            if not current_layers:
                current_layers = next_layers
                next_layers = []

        struct[switch_input] = []  # Add the input layer
        logger.debug("Model structure: %s", struct)
        return struct

    def _get_inputs(self, inputs):
        """ Obtain the inputs for the requested swap direction. </s> remove         """ Obtain the structure of the full model, filtering out inbound nodes and
        layers that are not required for the requested swap destination.
 </s> add         """ Obtain the structure of the inference model.
        list
            List of input tensors to feed the model for the requested swap direction
              The full model structure with unused inbound nodes and layers removed
  
          Returns
          -------
        list
            List of input tensors to feed the model for the requested swap direction
        list
            List of input tensors to feed the model for the requested swap direction
          """
          retval = set()
          for idx, (name, inbound) in enumerate(reversed(filtered_structure.items())):
              if idx == 0:
                  logger.debug("Adding output layer: '%s'", name)
keep keep keep keep replace replace keep keep keep keep keep
 plugins.train.model.base - More robust inference model generation 
plugins/train/model/_base.py