def next_inputs(self, time, outputs, state, sample_ids, name=None):
    """Compute the next inputs and state."""
    del sample_ids  # Unused.
    with tf.name_scope(name, "ScheduledContinuousEmbeddingNextInputs",
                       [time, outputs, state]):
      # Get ground truth next inputs.
      (finished, base_next_inputs,
       state) = contrib_seq2seq.TrainingHelper.next_inputs(
           self, time, outputs, state, name=name)

      # Get generated next inputs.
      all_finished = tf.reduce_all(finished)
      generated_next_inputs = tf.cond(
          all_finished,
          # If we're finished, the next_inputs value doesn't matter
          lambda: outputs,
          lambda: outputs)

      # Sample mixing weights.
      weight_sampler = tf.distributions.Dirichlet(
          concentration=self._mixing_concentration)
      weight = weight_sampler.sample(
          sample_shape=self.batch_size, seed=self._scheduling_seed)
      alpha, beta = weight, 1 - weight

      # Mix the inputs.
      next_inputs = alpha * base_next_inputs + beta * generated_next_inputs

      return finished, next_inputs, state
Compute the next inputs and state.
language/labs/consistent_zero_shot_nmt/modules/helpers.py