'Pad the batch to be stroke-5 bigger format as described in paper.'

def pad_batch(self, batch, max_len):

    result = np.zeros((self.batch_size, (max_len + 1), 5), dtype=float)
    assert (len(batch) == self.batch_size)
    for i in range(self.batch_size):
        l = len(batch[i])
        assert (l <= max_len)
        result[i, 0:l, 0:2] = batch[i][:, 0:2]
        result[i, 0:l, 3] = batch[i][:, 2]
        result[i, 0:l, 2] = (1 - result[i, 0:l, 3])
        result[i, l:, 4] = 1
        result[i, 1:, :] = result[i, :(-1), :]
        result[i, 0, :] = 0
        result[(i, 0, 2)] = self.start_stroke_token[2]
        result[(i, 0, 3)] = self.start_stroke_token[3]
        result[(i, 0, 4)] = self.start_stroke_token[4]
    return result
