lord-reso commited on
Commit
2a03db7
·
verified ·
1 Parent(s): 5c2c92b

Update layers.py

Browse files
Files changed (1) hide show
  1. layers.py +2 -9
layers.py CHANGED
@@ -3,7 +3,6 @@ from librosa.filters import mel as librosa_mel_fn
3
  from audio_processing import dynamic_range_compression
4
  from audio_processing import dynamic_range_decompression
5
  from stft import STFT
6
- import torch.nn.functional as F
7
 
8
 
9
  class LinearNorm(torch.nn.Module):
@@ -36,16 +35,10 @@ class ConvNorm(torch.nn.Module):
36
  self.conv.weight, gain=torch.nn.init.calculate_gain(w_init_gain))
37
 
38
  def forward(self, signal):
39
- if signal.dtype == torch.float16:
40
- x = F.dropout(F.relu(self.conv(signal.to(torch.float32))), 0.5, self.training).to(torch.float16)
41
- else:
42
- x = F.dropout(F.relu(self.conv(signal)), 0.5, self.training)
43
-
44
- conv_signal = x
45
  return conv_signal
46
 
47
 
48
-
49
  class TacotronSTFT(torch.nn.Module):
50
  def __init__(self, filter_length=1024, hop_length=256, win_length=1024,
51
  n_mel_channels=80, sampling_rate=22050, mel_fmin=0.0,
@@ -84,4 +77,4 @@ class TacotronSTFT(torch.nn.Module):
84
  magnitudes = magnitudes.data
85
  mel_output = torch.matmul(self.mel_basis, magnitudes)
86
  mel_output = self.spectral_normalize(mel_output)
87
- return mel_output
 
3
  from audio_processing import dynamic_range_compression
4
  from audio_processing import dynamic_range_decompression
5
  from stft import STFT
 
6
 
7
 
8
  class LinearNorm(torch.nn.Module):
 
35
  self.conv.weight, gain=torch.nn.init.calculate_gain(w_init_gain))
36
 
37
  def forward(self, signal):
38
+ conv_signal = self.conv(signal)
 
 
 
 
 
39
  return conv_signal
40
 
41
 
 
42
  class TacotronSTFT(torch.nn.Module):
43
  def __init__(self, filter_length=1024, hop_length=256, win_length=1024,
44
  n_mel_channels=80, sampling_rate=22050, mel_fmin=0.0,
 
77
  magnitudes = magnitudes.data
78
  mel_output = torch.matmul(self.mel_basis, magnitudes)
79
  mel_output = self.spectral_normalize(mel_output)
80
+ return mel_output