original_docstring: Concatenate two noise batches of potentially different lengths
docstring: Concatenate two noise batches of potentially different lengths
docstring_tokens: Concatenate two noise batches of potentially different lengths
code: def _concat_batch(noise_batch, noise_lens, added_noise, added_lens):
          """Concatenate two noise batches of potentially different lengths"""
  
          # pad shorter batch to correct length
          noise_tensor_len = noise_batch.shape[1]
          added_tensor_len = added_noise.shape[1]
          pad = (0, abs(noise_tensor_len - added_tensor_len))
          if noise_tensor_len > added_tensor_len:
              added_noise = torch.nn.functional.pad(added_noise, pad)
              added_lens = added_lens * added_tensor_len / noise_tensor_len
          else:
              noise_batch = torch.nn.functional.pad(noise_batch, pad)
              noise_lens = noise_lens * noise_tensor_len / added_tensor_len
  
          noise_batch = torch.cat((noise_batch, added_noise))
          noise_lens = torch.cat((noise_lens, added_lens))
  
          return noise_batch, noise_lens
code_tokens: def _concat_batch ( noise_batch , noise_lens , added_noise , added_lens ) : noise_tensor_len = noise_batch . shape [ 1 ] added_tensor_len = added_noise . shape [ 1 ] pad = ( 0 , abs ( noise_tensor_len - added_tensor_len ) ) if noise_tensor_len > added_tensor_len : added_noise = torch . nn . functional . pad ( added_noise , pad ) added_lens = added_lens * added_tensor_len / noise_tensor_len else : noise_batch = torch . nn . functional . pad ( noise_batch , pad ) noise_lens = noise_lens * noise_tensor_len / added_tensor_len noise_batch = torch . cat ( ( noise_batch , added_noise ) ) noise_lens = torch . cat ( ( noise_lens , added_lens ) ) return noise_batch , noise_lens
short_docstring: Concatenate two noise batches of potentially different lengths
short_docstring_tokens: Concatenate two noise batches of potentially different lengths
comment: """Concatenate two noise batches of potentially different lengths"""$SEP$# pad shorter batch to correct length