MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / __init__

Method __init__

mogen/models/rnns/t2m_bigru.py:163–184  ·  view source on GitHub ↗
(self, word_size, pos_size, hidden_size, output_size)

Source from the content-addressed store, hash-verified

161class TextEncoderBiGRUCo(nn.Module):
162
163 def __init__(self, word_size, pos_size, hidden_size, output_size):
164 super(TextEncoderBiGRUCo, self).__init__()
165
166 self.pos_emb = nn.Linear(pos_size, word_size)
167 self.input_emb = nn.Linear(word_size, hidden_size)
168 self.gru = nn.GRU(hidden_size,
169 hidden_size,
170 batch_first=True,
171 bidirectional=True)
172 self.output_net = nn.Sequential(
173 nn.Linear(hidden_size * 2, hidden_size), nn.LayerNorm(hidden_size),
174 nn.LeakyReLU(0.2, inplace=True), nn.Linear(hidden_size,
175 output_size))
176
177 self.input_emb.apply(init_weight)
178 self.pos_emb.apply(init_weight)
179 self.output_net.apply(init_weight)
180 # self.linear2.apply(init_weight)
181 # self.batch_size = batch_size
182 self.hidden_size = hidden_size
183 self.hidden = nn.Parameter(
184 torch.randn((2, 1, self.hidden_size), requires_grad=True))
185
186 # input(batch_size, seq_len, dim)
187 def forward(self, word_embs, pos_onehot, cap_lens):

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected