'Returns the input vector for the given position in the event sequence.
Returns a self.input_size length list of floats. Assuming a one-hot
encoding with 38 classes, two lookback distances, and five binary counters,
self.input_size will = 121. Each index represents a different input signal
to the model.
Indices [0, 120]:
[0, 37]: Event of current step.
[38, 75]: Event of next step for first lookback.
[76, 113]: Event of next step for second lookback.
114: 16th note binary counter.
115: 8th note binary counter.
116: 4th note binary counter.
117: Half note binary counter.
118: Whole note binary counter.
119: The current step is repeating (first lookback).
120: The current step is repeating (second lookback).
Args:
events: A list-like sequence of events.
position: An integer position in the event sequence.
Returns:
An input vector, an self.input_size length list of floats.'

def events_to_input(self, events, position):

    input_ = ([0.0] * self.input_size)
    offset = 0
    index = self._one_hot_encoding.encode_event(events[position])
    input_[index] = 1.0
    offset += self._one_hot_encoding.num_classes
    for (i, lookback_distance) in enumerate(self._lookback_distances):
        lookback_position = ((position - lookback_distance) + 1)
        if (lookback_position < 0):
            event = self._one_hot_encoding.default_event
        else:
            event = events[lookback_position]
        index = self._one_hot_encoding.encode_event(event)
        input_[(offset + index)] = 1.0
        offset += self._one_hot_encoding.num_classes
    n = (position + 1)
    for i in range(self._binary_counter_bits):
        input_[offset] = (1.0 if ((n // (2 ** i)) % 2) else (-1.0))
        offset += 1
    for (i, lookback_distance) in enumerate(self._lookback_distances):
        lookback_position = (position - lookback_distance)
        if ((lookback_position >= 0) and (events[position] == events[lookback_position])):
            input_[offset] = 1.0
        offset += 1
    assert (offset == self.input_size)
    return input_
