33d79d35b6cebf156f226a3c4c83e2d7d1053599,pytext/models/embeddings/word_embedding.py,WordEmbedding,__init__,#WordEmbedding#Any#Any#Any#Any#Any#Any#,97
Before Change
// Create MLP layers
self.mlp_layers = nn.ModuleList([])
for next_dim in mlp_layer_dims or []:
assert next_dim > 0
self.mlp_layers.append(nn.Linear(embedding_dim, next_dim))
embedding_dim = next_dim
def __getattr__(self, name):
After Change
self.word_embedding.weight.data[unk_token_idx].fill_(0.0)
// Create MLP layers
self.mlp = nn.Sequential(
*(
nn.Sequential(nn.Linear(m, n), nn.ReLU())
for m, n in zip([embedding_dim] + list(mlp_layer_dims), mlp_layer_dims)
)
)
def __getattr__(self, name):
if name == "weight":
return self.word_embedding.weight
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: facebookresearch/pytext
Commit Name: 33d79d35b6cebf156f226a3c4c83e2d7d1053599
Time: 2019-04-24
Author: snl@fb.com
File Name: pytext/models/embeddings/word_embedding.py
Class Name: WordEmbedding
Method Name: __init__
Project Name: keras-team/keras
Commit Name: c81d6ec93f6350eabec347acc4420456dc07312b
Time: 2015-08-08
Author: francois.chollet@gmail.com
File Name: tests/auto/keras/test_normalization.py
Class Name: TestBatchNormalization
Method Name: test_mode_0
Project Name: keras-team/keras
Commit Name: 96f3404a574faa97b1895753fed7a602f853baa7
Time: 2015-12-08
Author: francois.chollet@gmail.com
File Name: tests/keras/layers/test_recurrent.py
Class Name:
Method Name: _runner