class_docstr: A training helper that adds scheduled sampling directly to outputs.
  
  Returns False for sample_ids where no sampling took place; True elsewhere.
class_docstr_tok: ["A","training","helper","that","adds","scheduled","sampling","directly","to","outputs",".","Returns","False","for","sample_ids","where","no","sampling","took","place",";","True","elsewhere","."]
docstr: Initializer.
  
  Args:
    inputs: A (structure) of input tensors.
    sequence_length: An int32 vector tensor.
    sampling_probability: A 0D `float32` tensor: the probability of sampling
      from the outputs instead of reading directly from the inputs.
    time_major: Python bool.  Whether the tensors in `inputs` are time major.
      If `False` (default), they are assumed to be batch major.
    seed: The sampling seed.
    next_input_layer: (Optional) An instance of `tf.layers.Layer`, i.e.,
      `tf.layers.Dense`.  Optional layer to apply to the RNN output to create
      the next input.
    auxiliary_inputs: An optional (structure of) auxiliary input tensors with
      a shape that matches `inputs` in all but (potentially) the final
      dimension. These tensors will be concatenated to the sampled output or
      the `inputs` when not sampling for use as the next input.
    name: Name scope for any created operations.
  
  Raises:
    ValueError: if `sampling_probability` is not a scalar or vector.
docstr_tok: ["Initializer",".","Args",":","inputs",":","A","(","structure",")","of","input","tensors",".","sequence_length",":","An","int32","vector","tensor",".","sampling_probability",":","A","0D","`","float32","`","tensor",":","the","probability","of","sampling","from","the","outputs","instead","of","reading","directly","from","the","inputs",".","time_major",":","Python","bool",".","Whether","the","tensors","in","`","inputs","`","are","time","major",".","If","`","False","`","(","default",")",",","they","are","assumed","to","be","batch","major",".","seed",":","The","sampling","seed",".","next_input_layer",":","(","Optional",")","An","instance","of","`","tf.layers.Layer","`",",","i.e.",",","`","tf.layers.Dense","`",".","Optional","layer","to","apply","to","the","RNN","output","to","create","the","next","input",".","auxiliary_inputs",":","An","optional","(","structure","of",")","auxiliary","input","tensors","with","a","shape","that","matches","`","inputs","`","in","all","but","(","potentially",")","the","final","dimension",".","These","tensors","will","be","concatenated","to","the","sampled","output","or","the","`","inputs","`","when","not","sampling","for","use","as","the","next","input",".","name",":","Name","scope","for","any","created","operations",".","Raises",":","ValueError",":","if","`","sampling_probability","`","is","not","a","scalar","or","vector","."]
code: def __init__(
      self,
      inputs,
      sequence_length,
      sampling_probability,
      time_major=False,
      seed=None,
      next_input_layer=None,
      auxiliary_inputs=None,
      name=None,
  ):
      """Initializer.
  
      Args:
        inputs: A (structure) of input tensors.
        sequence_length: An int32 vector tensor.
        sampling_probability: A 0D `float32` tensor: the probability of sampling
          from the outputs instead of reading directly from the inputs.
        time_major: Python bool.  Whether the tensors in `inputs` are time major.
          If `False` (default), they are assumed to be batch major.
        seed: The sampling seed.
        next_input_layer: (Optional) An instance of `tf.layers.Layer`, i.e.,
          `tf.layers.Dense`.  Optional layer to apply to the RNN output to create
          the next input.
        auxiliary_inputs: An optional (structure of) auxiliary input tensors with
          a shape that matches `inputs` in all but (potentially) the final
          dimension. These tensors will be concatenated to the sampled output or
          the `inputs` when not sampling for use as the next input.
        name: Name scope for any created operations.
  
      Raises:
        ValueError: if `sampling_probability` is not a scalar or vector.
      """
      with ops.name_scope(
          name,
          "ScheduledOutputTrainingHelper",
          [inputs, auxiliary_inputs, sampling_probability],
      ):
          self._sampling_probability = ops.convert_to_tensor(
              sampling_probability, name="sampling_probability"
          )
          if self._sampling_probability.get_shape().ndims not in (0, 1):
              raise ValueError(
                  "sampling_probability must be either a scalar or a vector. "
                  "saw shape: %s"
                  % (self._sampling_probability.get_shape())
              )
  
          if auxiliary_inputs is None:
              maybe_concatenated_inputs = inputs
          else:
              inputs = ops.convert_to_tensor(inputs, name="inputs")
              auxiliary_inputs = ops.convert_to_tensor(
                  auxiliary_inputs, name="auxiliary_inputs"
              )
              maybe_concatenated_inputs = nest.map_structure(
                  lambda x, y: array_ops.concat((x, y), -1),
                  inputs,
                  auxiliary_inputs,
              )
              if not time_major:
                  auxiliary_inputs = nest.map_structure(
                      _transpose_batch_time, auxiliary_inputs
                  )
  
          self._auxiliary_input_tas = (
              nest.map_structure(_unstack_ta, auxiliary_inputs)
              if auxiliary_inputs is not None
              else None
          )
  
          self._seed = seed
  
          if next_input_layer is not None and not isinstance(
              next_input_layer, layers_base._Layer
          ):  # pylint: disable=protected-access
              raise TypeError(
                  "next_input_layer must be a Layer, received: %s"
                  % type(next_input_layer)
              )
          self._next_input_layer = next_input_layer
  
          super(ScheduledOutputTrainingHelper, self).__init__(
              inputs=maybe_concatenated_inputs,
              sequence_length=sequence_length,
              time_major=time_major,
              name=name,
          )
  
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 1 to create a new ScheduledOutputTrainingHelper object from inherited base classes: TrainingHelper with example: obj = ScheduledOutputTrainingHelper(inputs, sequence_length, sampling_probability, time_major, seed, next_input_layer, auxiliary_inputs, name)