80e9e26deca028ef6b1b51c307b61bb305dc9b1c,txtgen/data/embedding_test.py,EmbeddingTest,test_load_glove,#EmbeddingTest#,23
Before Change
word_vecs, vector_size = embedding.load_glove(glove_file.name)
self.assertEqual(len(word_vecs), 2)
self.assertEqual(set(word_vecs.keys()),
set(["word", "词".encode("utf-8")]))
self.assertEqual(vector_size, 3)
np.testing.assert_array_equal(word_vecs["word"], [1.2, 3.4, 5.6])
def test_load_word2vec(self):
After Change
glove_file.write("\n".join(word_vec_lines).encode("utf-8"))
glove_file.flush()
vocab = {"word": 0, "词".encode("utf8"): 1}
word_vecs = np.zeros([2, 3])
word_vecs = embedding.load_glove(glove_file.name, vocab, word_vecs)
self.assertEqual(word_vecs.shape[0], 2)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances
Project Name: asyml/texar
Commit Name: 80e9e26deca028ef6b1b51c307b61bb305dc9b1c
Time: 2017-09-04
Author: zhitinghu@gmail.com
File Name: txtgen/data/embedding_test.py
Class Name: EmbeddingTest
Method Name: test_load_glove
Project Name: OpenNMT/OpenNMT-py
Commit Name: e8065b7e890390dbd9398507d909aa2e955fd9f6
Time: 2021-01-27
Author: steve.kommrusch@gmail.com
File Name: onmt/encoders/ggnn_encoder.py
Class Name: GGNNEncoder
Method Name: forward
Project Name: asyml/texar
Commit Name: 80e9e26deca028ef6b1b51c307b61bb305dc9b1c
Time: 2017-09-04
Author: zhitinghu@gmail.com
File Name: txtgen/data/embedding_test.py
Class Name: EmbeddingTest
Method Name: test_load_word2vec