def load_batch_x(path_batch,
                 flatten = False,
                 time_major = False):
    """ Loads a batch of input features given a list of paths to numpy
    arrays in that batch."""

    utterances = [np.load(str(path)) for path in path_batch]
    utter_lens = [utterance.shape[0] for utterance in utterances]
    max_len = max(utter_lens)
    batch_size = len(path_batch)
    shape = (batch_size, max_len) + tuple(utterances[0].shape[1:])
    batch = np.zeros(shape)
    for i, utt in enumerate(utterances):
        batch[i] = zero_pad(utt, max_len)
    if flatten:
        batch = collapse(batch, time_major=time_major)
    return batch, np.array(utter_lens)
def load_batch_x ( path_batch , flatten = False , time_major = False ) : utterances = [ np . load ( str ( path ) ) for path in path_batch ] utter_lens = [ utterance . shape [ 0 ] for utterance in utterances ] max_len = max ( utter_lens ) batch_size = len ( path_batch ) shape = ( batch_size , max_len ) + tuple ( utterances [ 0 ] . shape [ 1 : ] ) batch = np . zeros ( shape ) for i , utt in enumerate ( utterances ) : batch [ i ] = zero_pad ( utt , max_len ) if flatten : batch = collapse ( batch , time_major = time_major ) return batch , np . array ( utter_lens )
Loads a batch of input features given a list of paths to numpy
    arrays in that batch.