(self, inputs, sequence_length, sampling_probability,
               time_major=False, seed=None, next_inputs_fn=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_inputs_fn: (Optional) callable to apply to the RNN outputs to create
        the next input when sampling. If `None` (default), the RNN outputs will
        be used as the next inputs.
      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.
Initializer.
Initializer .
def __init__(self, inputs, sequence_length, sampling_probability,
               time_major=False, seed=None, next_inputs_fn=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_inputs_fn: (Optional) callable to apply to the RNN outputs to create
        the next input when sampling. If `None` (default), the RNN outputs will
        be used as the next inputs.
      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 tf.name_scope(name, "ScheduledOutputTrainingHelper",
                       [inputs, auxiliary_inputs, sampling_probability]):
      self._sampling_probability = tf.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 = tf.convert_to_tensor(inputs, name="inputs")
        auxiliary_inputs = tf.convert_to_tensor(
            auxiliary_inputs, name="auxiliary_inputs")
        maybe_concatenated_inputs = tf.nest.map_structure(
            lambda x, y: tf.concat((x, y), -1),
            inputs, auxiliary_inputs)
        if not time_major:
          auxiliary_inputs = tf.nest.map_structure(
              _transpose_batch_time, auxiliary_inputs)

      self._auxiliary_input_tas = (
          tf.nest.map_structure(_unstack_ta, auxiliary_inputs)
          if auxiliary_inputs is not None else None)

      self._seed = seed

      self._next_inputs_fn = next_inputs_fn

      super(ScheduledOutputTrainingHelper, self).__init__(
          inputs=maybe_concatenated_inputs,
          sequence_length=sequence_length,
          time_major=time_major,
          name=name)
def __init__ ( self , inputs , sequence_length , sampling_probability , time_major = False , seed = None , next_inputs_fn = None , auxiliary_inputs = None , name = None ) : with tf . name_scope ( name , "ScheduledOutputTrainingHelper" , [ inputs , auxiliary_inputs , sampling_probability ] ) : self . _sampling_probability = tf . 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 = tf . convert_to_tensor ( inputs , name = "inputs" ) auxiliary_inputs = tf . convert_to_tensor ( auxiliary_inputs , name = "auxiliary_inputs" ) maybe_concatenated_inputs = tf . nest . map_structure ( lambda x , y : tf . concat ( ( x , y ) , - 1 ) , inputs , auxiliary_inputs ) if not time_major : auxiliary_inputs = tf . nest . map_structure ( _transpose_batch_time , auxiliary_inputs ) self . _auxiliary_input_tas = ( tf . nest . map_structure ( _unstack_ta , auxiliary_inputs ) if auxiliary_inputs is not None else None ) self . _seed = seed self . _next_inputs_fn = next_inputs_fn super ( ScheduledOutputTrainingHelper , self ) . __init__ ( inputs = maybe_concatenated_inputs , sequence_length = sequence_length , time_major = time_major , name = name )