⚗️ | Small fixes here and there
This commit is contained in:
@@ -8,13 +8,12 @@ def stereo_tensor_to_mono(waveform: torch.Tensor) -> torch.Tensor:
|
||||
|
||||
|
||||
def pad_tensor(audio_tensor: torch.Tensor, target_length: int = 512) -> torch.Tensor:
|
||||
padding_amount = target_length - audio_tensor.size(-1)
|
||||
current = audio_tensor.size(-1)
|
||||
padding_amount = target_length - current
|
||||
if padding_amount <= 0:
|
||||
return audio_tensor
|
||||
|
||||
padded_audio_tensor = F.pad(audio_tensor, (0, padding_amount))
|
||||
|
||||
return padded_audio_tensor
|
||||
return F.pad(audio_tensor, (0, padding_amount))
|
||||
|
||||
|
||||
def split_audio(audio_tensor: torch.Tensor, chunk_size: int = 512, pad_last_tensor: bool = False) -> list[torch.Tensor]:
|
||||
|
||||
Reference in New Issue
Block a user