(self, inputs, sequence_length, time_major=False, name=None)
Initializer.

    Args:
      inputs: A (structure of) input tensors.
      sequence_length: An int32 vector tensor.
      time_major: Python bool.  Whether the tensors in `inputs` are time major.
        If `False` (default), they are assumed to be batch major.
      name: Name scope for any created operations.

    Raises:
      ValueError: if `sequence_length` is not a 1D tensor.
Initializer.
Initializer .
def __init__(self, inputs, sequence_length, time_major=False, name=None):
    """Initializer.

    Args:
      inputs: A (structure of) input tensors.
      sequence_length: An int32 vector tensor.
      time_major: Python bool.  Whether the tensors in `inputs` are time major.
        If `False` (default), they are assumed to be batch major.
      name: Name scope for any created operations.

    Raises:
      ValueError: if `sequence_length` is not a 1D tensor.
    """
    with tf.name_scope(name, "TrainingHelper", [inputs, sequence_length]):
      inputs = tf.convert_to_tensor(inputs, name="inputs")
      self._inputs = inputs
      if not time_major:
        inputs = tf.nest.map_structure(_transpose_batch_time, inputs)

      self._input_tas = tf.nest.map_structure(_unstack_ta, inputs)
      self._sequence_length = tf.convert_to_tensor(
          sequence_length, name="sequence_length")
      if self._sequence_length.get_shape().ndims != 1:
        raise ValueError(
            "Expected sequence_length to be a vector, but received shape: %s" %
            self._sequence_length.get_shape())

      self._zero_inputs = tf.nest.map_structure(
          lambda inp: tf.zeros_like(inp[0, :]), inputs)

      self._batch_size = tf.size(sequence_length)
def __init__ ( self , inputs , sequence_length , time_major = False , name = None ) : with tf . name_scope ( name , "TrainingHelper" , [ inputs , sequence_length ] ) : inputs = tf . convert_to_tensor ( inputs , name = "inputs" ) self . _inputs = inputs if not time_major : inputs = tf . nest . map_structure ( _transpose_batch_time , inputs ) self . _input_tas = tf . nest . map_structure ( _unstack_ta , inputs ) self . _sequence_length = tf . convert_to_tensor ( sequence_length , name = "sequence_length" ) if self . _sequence_length . get_shape ( ) . ndims != 1 : raise ValueError ( "Expected sequence_length to be a vector, but received shape: %s" % self . _sequence_length . get_shape ( ) ) self . _zero_inputs = tf . nest . map_structure ( lambda inp : tf . zeros_like ( inp [ 0 , : ] ) , inputs ) self . _batch_size = tf . size ( sequence_length )