'Construct VatxtInput.
Args:
batch: NextQueuedSequenceBatch.
state_name: str, name of state to fetch and save.
tokens: int Tensor, tokens. Defaults to batch\'s F_TOKEN_ID sequence.
num_states: int The number of states to store.
eos_id: int Id of end of Sequence.'

def __init__(self, batch, state_name=None, tokens=None, num_states=0, eos_id=None):

    self._batch = batch
    self._state_name = state_name
    self._tokens = (tokens if (tokens is not None) else batch.sequences[data_utils.SequenceWrapper.F_TOKEN_ID])
    self._num_states = num_states
    w = batch.sequences[data_utils.SequenceWrapper.F_WEIGHT]
    w = tf.transpose(w, [1, 0])
    w = tf.reshape(w, [(-1)])
    self._weights = w
    l = batch.sequences[data_utils.SequenceWrapper.F_LABEL]
    l = tf.transpose(l, [1, 0])
    l = tf.reshape(l, [(-1)])
    self._labels = l
    self._eos_weights = None
    if eos_id:
        ew = tf.cast(tf.equal(self._tokens, eos_id), tf.float32)
        ew = tf.transpose(ew, [1, 0])
        ew = tf.reshape(ew, [(-1)])
        self._eos_weights = ew
