def _connect_control_inputs(self, info):
        """Connect the previously copied ops."""
        for op in info.sgv.ops:
            logging.debug("Connecting control inputs of op: %s", op.name)
            op_ = info.transformed_ops[op]

            # Finalize original op.
            # TODO(fkp): Stop worrying about _original_op and remove this code?
            # pylint: disable=protected-access
            if op._original_op:
                original_op = self.transform_original_op_handler(
                    info, op._original_op)
                if original_op is None:
                    logging.debug("Could not find original op for: %s",
                                  op_.name)
                else:
                    op_._original_op = original_op
            # pylint: enable=protected-access

            # Finalize control inputs:
            control_inputs_ = [
                self.transform_control_input_handler(info, ci)
                for ci in op.control_inputs
            ]
            control_inputs_ = [ci for ci in control_inputs_ if ci is not None]
            reroute.add_control_inputs(op_, control_inputs_)
Example #2
0
    def _connect_ops(self, info):
        """Connect the previously copied ops."""
        for op in info.sgv.ops:
            logging.debug("Finalizing op: %s", op.name)
            op_ = info.transformed_ops[op]

            # pylint: disable=protected-access
            if op_.inputs:
                raise ValueError("The newly transformed op should not have "
                                 "any inputs yet: {}".format(op_.name))
            inputs_ = [self._transformed_t(info, t) for t in op.inputs]
            for t in inputs_:
                op_._add_input(t)

            # Finalize original op.
            if op._original_op:
                original_op = info.transform_original_op_handler(
                    info, op._original_op)
                if original_op is None:
                    logging.debug("Could not find original op for: %s",
                                  op_.name)
                else:
                    op_._original_op = original_op

            # Finalize control inputs:
            control_inputs_ = [
                self.transform_control_input_handler(info, ci)
                for ci in op.control_inputs
            ]
            control_inputs_ = [ci for ci in control_inputs_ if ci is not None]
            reroute.add_control_inputs(op_, control_inputs_)
Example #3
0
  def _connect_ops(self, info):
    """Connect the previously copied ops."""
    for op in info.sgv.ops:
      logging.debug("Finalizing op: %s", op.name)
      op_ = info.transformed_ops[op]

      # pylint: disable=protected-access
      if op_.inputs:
        raise ValueError("The newly transformed op should not have "
                         "any inputs yet: {}".format(op_.name))
      inputs_ = [self._transformed_t(info, t) for t in op.inputs]
      for t in inputs_:
        op_._add_input(t)

      # Finalize original op.
      if op._original_op:
        original_op = info.transform_original_op_handler(info, op._original_op)
        if original_op is None:
          logging.debug("Could not find original op for: %s", op_.name)
        else:
          op_._original_op = original_op

      # Finalize control inputs:
      control_inputs_ = [self.transform_control_input_handler(info, ci)
                         for ci in op.control_inputs]
      control_inputs_ = [ci for ci in control_inputs_ if ci is not None]
      reroute.add_control_inputs(op_, control_inputs_)
Example #4
0
  def _connect_control_inputs(self, info):
    """Connect the previously copied ops."""
    for op in info.sgv.ops:
      logging.debug("Connecting control inputs of op: %s", op.name)
      op_ = info.transformed_ops[op]

      # Finalize original op.
      # TODO(fkp): Stop worrying about _original_op and remove this code?
      # pylint: disable=protected-access
      if op._original_op:
        original_op = self.transform_original_op_handler(info, op._original_op)
        if original_op is None:
          logging.debug("Could not find original op for: %s", op_.name)
        else:
          op_._original_op = original_op
      # pylint: enable=protected-access

      # Finalize control inputs:
      control_inputs_ = [self.transform_control_input_handler(info, ci)
                         for ci in op.control_inputs]
      control_inputs_ = [ci for ci in control_inputs_ if ci is not None]
      reroute.add_control_inputs(op_, control_inputs_)