From d0c6153b1fde5ae8f9baef8312dd5f83205723d1 Mon Sep 17 00:00:00 2001 From: Alain Riou <alain.riou14000@yahoo.com> Date: Wed, 17 Jan 2024 18:09:33 +0100 Subject: [PATCH] roll instead of sub --- pesto/model.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pesto/model.py b/pesto/model.py index a728e35..9fbaddf 100644 --- a/pesto/model.py +++ b/pesto/model.py @@ -215,10 +215,9 @@ class PESTO(nn.Module): if batch_size: activations = activations.view(batch_size, -1, activations.size(-1)) - preds = reduce_activations(activations, reduction=self.reduction) + activations = activations.roll(-self.shift.cpu().item(), dims=-1) - # decrease by shift to get absolute pitch - preds.sub_(self.shift) + preds = reduce_activations(activations, reduction=self.reduction) if convert_to_freq: preds = 440 * 2 ** ((preds - 69) / 12) -- GitLab