mirror of
https://github.com/xiph/opus.git
synced 2025-05-16 16:38:30 +00:00
added LPCNet torch implementation
Signed-off-by: Jan Buethe <jbuethe@amazon.de>
This commit is contained in:
parent
90a171c1c2
commit
35ee397e06
38 changed files with 3200 additions and 0 deletions
15
dnn/torch/lpcnet/utils/layers/dual_fc.py
Normal file
15
dnn/torch/lpcnet/utils/layers/dual_fc.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import torch
|
||||
from torch import nn
|
||||
|
||||
class DualFC(nn.Module):
|
||||
def __init__(self, input_dim, output_dim):
|
||||
super(DualFC, self).__init__()
|
||||
|
||||
self.dense1 = nn.Linear(input_dim, output_dim)
|
||||
self.dense2 = nn.Linear(input_dim, output_dim)
|
||||
|
||||
self.alpha = nn.Parameter(torch.tensor([0.5]), requires_grad=True)
|
||||
self.beta = nn.Parameter(torch.tensor([0.5]), requires_grad=True)
|
||||
|
||||
def forward(self, x):
|
||||
return self.alpha * torch.tanh(self.dense1(x)) + self.beta * torch.tanh(self.dense2(x))
|
Loading…
Add table
Add a link
Reference in a new issue