- mat1 and mat2 shape cannot be multiplied

Hi all,
I am using torch audio = 0.5.0 (as the code already uses it, I too gave same version). While executing code error occurs as :RuntimeError: mat1 and mat2 shapes cannot be multiplied (258x577 and 201x192)
Error is traced to file torchaudio/transforms/ in line
mel_specgram = torch.matmul(specgram.transpose(-1, -2), self.fb).transpose(-1, -2).
Kindly suggest a solution for the issue.

Could you post a minimal and executable code snippet reproducing the error, please?

The code is executed for Voice conversion.
%tensorflow_version 2.x
except Exception:
import tensorflow as tf
!pip install soundfile
!pip install --no-deps torchaudio==0.5.0

Execution sequence - 4->3->2->1
1 ) torch.set_default_tensor_type(‘torch.cuda.FloatTensor’)

specobj = Spectrogram(n_fft=6hop, win_length=6hop, hop_length=hop, pad=0, power=2, normalized=True)
specfunc = specobj.forward
melobj = MelScale(n_mels=hop, sample_rate=sr, f_min=0.)
melfunc = melobj.forward

  1. def melspecfunc(waveform):
    specgram = specfunc(waveform)
    mel_specgram = melfunc(specgram)
    return mel_specgram

3)def prep(wv,hop=192):
S = np.array(torch.squeeze(melspecfunc(torch.Tensor(wv).view(1,-1))).detach().cpu())
S = librosa.power_to_db(S)-ref_level_db
return normalize(S)

  1. prep(x) → x = data[i] , i in range(data.shape[0]) and ‘data’ is the wave form array

Error - Same error is encountered for the code even if I change the audio dataset.
/usr/local/lib/python3.10/dist-packages/torchaudio/transforms/ in forward(self, specgram)
mel_specgram = torch.matmul(specgram.transpose(-1, -2), self.fb).transpose(-1, -2)
RuntimeError: mat1 and mat2 shapes cannot be multiplied (258x577 and 201x192)