2573c649518391ada6214cfc72d20421dfac4072,src/preprocess.py,,get_embeddings,#Any#Any#Any#,194
Before Change
try:
assert word in word2vec
except AssertionError as error:
log.debug(error)
pdb.set_trace()
embeddings[idx] = word2vec[word]
embeddings[vocab.get_token_index("@@PADDING@@")] = 0.
embeddings = torch.FloatTensor(embeddings)
After Change
idx = vocab.get_token_index(word)
if idx != unk_idx:
idx = vocab.get_token_index(word)
embeddings[idx] = np.array(list(map(float, vec.split())))
embeddings[vocab.get_token_index("@@PADDING@@")] = 0.
embeddings = torch.FloatTensor(embeddings)
log.info("\tFinished loading embeddings")
return embeddings
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 2573c649518391ada6214cfc72d20421dfac4072
Time: 2018-03-16
Author: wang.alex.c@gmail.com
File Name: src/preprocess.py
Class Name:
Method Name: get_embeddings
Project Name: pyprob/pyprob
Commit Name: f749c4f713a6f365809713ca394326faf34ec34e
Time: 2018-02-16
Author: atilimgunes.baydin@gmail.com
File Name: tests/test_distributions.py
Class Name: DistributionsTestCase
Method Name: test_dist_normal
Project Name: pyprob/pyprob
Commit Name: f749c4f713a6f365809713ca394326faf34ec34e
Time: 2018-02-16
Author: atilimgunes.baydin@gmail.com
File Name: tests/test_distributions.py
Class Name: DistributionsTestCase
Method Name: test_dist_uniform