@SimonW thanks for the reply!
I had the same error even when the parameter are defined like in the loss function below.
In this case where the projection is defined inside the loss, show the “weights” be defined as buffers?
What about the attribute self.mel_basis? What should it be defined as?
 class TacotronLoss(nn.Module):
    def __init__(self, sr=16000, mel_size=80, frame_size=512, stride=128, size_average=True):
        super(TacotronLoss, self).__init__()
        from librosa.filters import mel
        mel_basis = mel(sr, n_fft=frame_size-1, n_mels=mel_size)
        self.mel_basis = torch.from_numpy(mel_basis).float().cuda()
        self.spectrogram = Projection(frame_size, stride)
        self.size_average = size_average
        self.L1 = nn.L1Loss(self.size_average)

    def forward(self, denoised_mel, denoised_spect, original):
        original.requires_grad = False
        original_spect = self.spectrogram(original)
        original_mel = torch.matmul(self.mel_basis, original_spect.data)
        original_mel = torch.autograd.Variable(original_mel, requires_grad=False)
        mel_loss = self.L1(denoised_mel, original_mel)
        spec_loss = self.L1(denoised_spect, original_spect)
        return mel_loss + spec_loss