(files, sample_length=125)
return batch
Load a batch of encodings from .npy files.

  Args:
    files: A list of filepaths to .npy files
    sample_length: Maximum sample length

  Raises:
    ValueError: .npy array has wrong dimensions.

  Returns:
    batch: A padded array encodings [batch, length, dims]
Load a batch of encodings from .npy files.
Load a batch of encodings from . npy files .
def load_batch_encodings(files, sample_length=125):
  """Load a batch of encodings from .npy files.

  Args:
    files: A list of filepaths to .npy files
    sample_length: Maximum sample length

  Raises:
    ValueError: .npy array has wrong dimensions.

  Returns:
    batch: A padded array encodings [batch, length, dims]
  """
  batch = []
  # Load the data
  for f in files:
    data = np.load(f)
    if data.ndim != 2:
      raise ValueError("Encoding file should have 2 dims "
                       "[time, channels], not {}".format(data.ndim))
    length, channels = data.shape
    # Add padding or crop if not equal to sample length
    if length < sample_length:
      padded = np.zeros([sample_length, channels])
      padded[:length, :] = data
      batch.append(padded)
    else:
      batch.append(data[:sample_length])
  # Return as an numpy array
  batch = np.array(batch)
  return batch
def load_batch_encodings ( files , sample_length = 125 ) : batch = [ ] # Load the data for f in files : data = np . load ( f ) if data . ndim != 2 : raise ValueError ( "Encoding file should have 2 dims " "[time, channels], not {}" . format ( data . ndim ) ) length , channels = data . shape # Add padding or crop if not equal to sample length if length < sample_length : padded = np . zeros ( [ sample_length , channels ] ) padded [ : length , : ] = data batch . append ( padded ) else : batch . append ( data [ : sample_length ] ) # Return as an numpy array batch = np . array ( batch ) return batch