class_docstr: A training helper that adds scheduled sampling.
  
  Returns -1s for sample_ids where no sampling took place; valid sample id
  values elsewhere.
class_docstr_tok: ["A","training","helper","that","adds","scheduled","sampling",".","Returns","-1s","for","sample_ids","where","no","sampling","took","place",";","valid","sample","id","values","elsewhere","."]
code: def next_inputs(self, time, outputs, state, sample_ids, name=None):
      with ops.name_scope(
          name,
          "ScheduledEmbeddingTrainingHelperSample",
          [time, outputs, state, sample_ids],
      ):
          (finished, base_next_inputs, state) = super(
              ScheduledEmbeddingTrainingHelper, self
          ).next_inputs(
              time=time,
              outputs=outputs,
              state=state,
              sample_ids=sample_ids,
              name=name,
          )
  
          def maybe_sample():
              """Perform scheduled sampling."""
              where_sampling = math_ops.cast(
                  array_ops.where(sample_ids > -1), dtypes.int32
              )
              where_not_sampling = math_ops.cast(
                  array_ops.where(sample_ids <= -1), dtypes.int32
              )
              where_sampling_flat = array_ops.reshape(
                  where_sampling, [-1]
              )
              where_not_sampling_flat = array_ops.reshape(
                  where_not_sampling, [-1]
              )
              sample_ids_sampling = array_ops.gather(
                  sample_ids, where_sampling_flat
              )
              inputs_not_sampling = array_ops.gather(
                  base_next_inputs, where_not_sampling_flat
              )
              sampled_next_inputs = self._embedding_fn(
                  sample_ids_sampling
              )
              base_shape = array_ops.shape(base_next_inputs)
              return array_ops.scatter_nd(
                  indices=where_sampling,
                  updates=sampled_next_inputs,
                  shape=base_shape,
              ) + array_ops.scatter_nd(
                  indices=where_not_sampling,
                  updates=inputs_not_sampling,
                  shape=base_shape,
              )
  
          all_finished = math_ops.reduce_all(finished)
          next_inputs = control_flow_ops.cond(
              all_finished, lambda: base_next_inputs, maybe_sample
          )
          return (finished, next_inputs, state)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import abc
  import six
  from tensorflow.contrib.distributions.python.ops import bernoulli
  from tensorflow.contrib.distributions.python.ops import categorical
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import ops
  from tensorflow.python.layers import base
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import embedding_ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import random_ops
  from tensorflow.python.ops import tensor_array_ops
  from tensorflow.python.util import nest
  from seq2seq.contrib.seq2seq import decoder
label_desc: Use image node_id 4 for calling the ScheduledEmbeddingTrainingHelper obj's underlying member method code with example usage: obj.next_inputs(time, outputs, state, sample_ids, name) and returns: finished,  next_inputs,  state, unknown