From d576d3999fb15507bb157bcc865d83dbc7465698 Mon Sep 17 00:00:00 2001 From: yh Date: Sat, 17 Aug 2019 00:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0StaticEmbedding=E4=B8=AD?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastNLP/embeddings/static_embedding.py | 1 + 1 file changed, 1 insertion(+) diff --git a/fastNLP/embeddings/static_embedding.py b/fastNLP/embeddings/static_embedding.py index 15cb05f6..c3d4ede6 100644 --- a/fastNLP/embeddings/static_embedding.py +++ b/fastNLP/embeddings/static_embedding.py @@ -118,6 +118,7 @@ class StaticEmbedding(TokenEmbedding): embedding = self._load_with_vocab(model_path, vocab=lowered_vocab, init_method=init_method) else: embedding = self._randomly_init_embed(len(vocab), embedding_dim, init_method) + self.words_to_words = nn.Parameter(torch.arange(len(vocab)).long(), requires_grad=False) if lowered_vocab.unknown: unknown_idx = lowered_vocab.unknown_idx else: