"vscode:/vscode.git/clone" did not exist on "eda560d34c8db599115f37f35e9aca08d4388878"
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 @@
# *****************************************************************************
import warnings
from math import sqrt
from typing import Tuple, List, Optional, Union
import torch
......@@ -984,9 +983,7 @@ class Tacotron2(nn.Module):
self.n_mels = n_mels
self.n_frames_per_step = n_frames_per_step
self.embedding = nn.Embedding(n_symbol, symbol_embedding_dim)
std = sqrt(2.0 / (n_symbol + symbol_embedding_dim))
val = sqrt(3.0) * std
self.embedding.weight.data.uniform_(-val, val)
torch.nn.init.xavier_uniform_(self.embedding.weight)
self.encoder = _Encoder(
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