def split_shard(*inputs, split_size=1):
    if (split_size <= 1):
        (yield inputs)
    else:
        lengths = [len(s) for s in inputs[(- 1)]]
        sorted_indices = np.argsort(lengths)
        inputs = [[inp[ii] for ii in sorted_indices] for inp in inputs]
        total_batch = sorted_indices.shape[0]
        if (split_size >= total_batch):
            (yield inputs)
        else:
            shard_size = (total_batch // split_size)
            _indices = (list(range(total_batch))[::shard_size] + [total_batch])
            for (beg, end) in zip(_indices[:(- 1)], _indices[1:]):
                (yield (inp[beg:end] for inp in inputs))
def split_shard(*inputs, split_size=1):
    if (split_size <= 1):
        (yield inputs)
    else:
        lengths = [len(s) for s in inputs[(- 1)]]
        sorted_indices = np.argsort(lengths)
        inputs = [[inp[ii] for ii in sorted_indices] for inp in inputs]
        total_batch = sorted_indices.shape[0]
        if (split_size >= total_batch):
            (yield inputs)
        else:
            shard_size = (total_batch // split_size)
            _indices = (list(range(total_batch))[::shard_size] + [total_batch])
            for (beg, end) in zip(_indices[:(- 1)], _indices[1:]):
                (yield (inp[beg:end] for inp in inputs))