"tests/git@developer.sourcefind.cn:OpenDAS/fairscale.git" did not exist on "f7813d6d3321fbef5dfe04f4294ed913c8c784e6"
Commit b3830bac authored by krishnakalyan3's avatar krishnakalyan3 Committed by Facebook GitHub Bot
Browse files

Update to xavier_uniform and avoid legacy data.uniform_ initialization (#2018)

Summary: Pull Request resolved: https://github.com/pytorch/audio/pull/2018

Reviewed By: hwangjeff, mthrok

Differential Revision: D32540498

Pulled By: nateanl

fbshipit-source-id: f104fbf84c0f489906b6555f21f931b60fedb59e
parent 78ce7010
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
# ***************************************************************************** # *****************************************************************************
import warnings import warnings
from math import sqrt
from typing import Tuple, List, Optional, Union from typing import Tuple, List, Optional, Union
import torch import torch
...@@ -984,9 +983,7 @@ class Tacotron2(nn.Module): ...@@ -984,9 +983,7 @@ class Tacotron2(nn.Module):
self.n_mels = n_mels self.n_mels = n_mels
self.n_frames_per_step = n_frames_per_step self.n_frames_per_step = n_frames_per_step
self.embedding = nn.Embedding(n_symbol, symbol_embedding_dim) self.embedding = nn.Embedding(n_symbol, symbol_embedding_dim)
std = sqrt(2.0 / (n_symbol + symbol_embedding_dim)) torch.nn.init.xavier_uniform_(self.embedding.weight)
val = sqrt(3.0) * std
self.embedding.weight.data.uniform_(-val, val)
self.encoder = _Encoder( self.encoder = _Encoder(
encoder_embedding_dim, encoder_n_convolution, encoder_kernel_size encoder_embedding_dim, encoder_n_convolution, encoder_kernel_size
) )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment