Example #1
0
  def _remove_unused_ops(self, control_inputs=True):
    """Remove unused ops in place.

    Args:
      control_inputs: if True, control inputs are used to detect used ops.
    Returns:
      A new subgraph view which only contains used operations.
    """
    ops = select.get_walks_union_ops(self.connected_inputs,
                                     self.connected_outputs,
                                     within_ops=self._ops,
                                     control_inputs=control_inputs)
    self._ops = [op for op in self._ops if op in ops]
Example #2
0
    def _remove_unused_ops(self, control_inputs=True):
        """Remove unused ops in place.

    Args:
      control_inputs: if True, control inputs are used to detect used ops.
    Returns:
      A new subgraph view which only contains used operations.
    """
        ops = select.get_walks_union_ops(self.connected_inputs,
                                         self.connected_outputs,
                                         within_ops=self._ops,
                                         control_inputs=control_inputs)
        self._ops = [op for op in self._ops if op in ops]