Added dimension to tensor to save audio

Иначе во всех примерах (в колабе по крайней мере), вылетала ошибка: ValueError: Expected 2D Tensor, got 1D.
This commit is contained in:
Sergey Polyakov
2021-03-16 16:35:29 +03:00
committed by GitHub
parent 88850f92c4
commit 46aa1f5e7b

View File

@@ -41,7 +41,7 @@ def read_audio(path: str,
def save_audio(path: str,
tensor: torch.Tensor,
sr: int = 16000):
torchaudio.save(path, tensor, sr)
torchaudio.save(path, tensor.unsqueeze(0), sr)
def init_jit_model(model_path: str,