26421ce20c6b626ceacafbb3282cad1d5dce04ca,onmt/Models.py,Embeddings,forward,#Embeddings#Any#,60
Before Change
word = self.word_lut(src_input[:, :, 0])
emb = word
if self.feature_dicts:
features = [feature_lut(src_input[:, :, j+1])
for j, feature_lut in enumerate(self.feature_luts)]
// Apply one MLP layer.
emb = self.activation(
self.linear(torch.cat([word] + features, -1)))
if self.positional_encoding:
emb = emb + Variable(self.pe[:emb.size(0), :1, :emb.size(2)]
.expand_as(emb))
emb = self.dropout(emb)
return emb
class Encoder(nn.Module):
After Change
Return:
emb (FloatTensor): len x batch x sum of feature embedding sizes
feat_inputs = (feat.squeeze(2) for feat in src_input.split(1, dim=2) )
features = [lut(feat) for lut, feat in zip(self.emb_luts, feat_inputs)]
emb = self.merge(features)
return emb
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 6
Instances Project Name: OpenNMT/OpenNMT-py
Commit Name: 26421ce20c6b626ceacafbb3282cad1d5dce04ca
Time: 2017-07-30
Author: bpeters@coli.uni-saarland.de
File Name: onmt/Models.py
Class Name: Embeddings
Method Name: forward
Project Name: keras-team/keras
Commit Name: b6d23b2e2dfc90480519ab52047006b1936fda02
Time: 2016-07-28
Author: jer.despraz@gmail.com
File Name: keras/backend/tensorflow_backend.py
Class Name:
Method Name: batch_set_value
Project Name: minimaxir/textgenrnn
Commit Name: 6b1dda39d64647cb7b4e5b1d7feee759c77c41e4
Time: 2020-05-10
Author: josh.prewer@focusrite.com
File Name: textgenrnn/utils.py
Class Name:
Method Name: textgenrnn_texts_from_file
Project Name: hanxiao/bert-as-service
Commit Name: 3618f2773407f7c6016940a6dca8c3e12565f6d8
Time: 2018-11-11
Author: hanhxiao@tencent.com
File Name: utils/sentence_split.py
Class Name: SentenceSplitter
Method Name: _split