(max_lengths, samples, controls=None)
return unpadded_samples, unpadded_controls
Remove padding.
Remove padding.
Remove padding .
def remove_padding(max_lengths, samples, controls=None):
  """Remove padding."""
  if not max_lengths:
    return samples, controls
  unpadded_samples = [sample.reshape(max_lengths + [-1])
                      for sample in samples]
  unpadded_controls = None
  if controls is not None:
    unpadded_controls = [control.reshape(max_lengths + [-1])
                         for control in controls]
  return unpadded_samples, unpadded_controls
def remove_padding ( max_lengths , samples , controls = None ) : if not max_lengths : return samples , controls unpadded_samples = [ sample . reshape ( max_lengths + [ - 1 ] ) for sample in samples ] unpadded_controls = None if controls is not None : unpadded_controls = [ control . reshape ( max_lengths + [ - 1 ] ) for control in controls ] return unpadded_samples , unpadded_controls