(self, emb_file, fixed)
Load in pretrained embeddings.

        Args:
          emb_file (str) : path to torch serialized embeddings
          fixed (bool) : if true, embeddings are not updated
Load in pretrained embeddings.
Load in pretrained embeddings .
def load_pretrained_vectors(self, emb_file, fixed):
        """Load in pretrained embeddings.

        Args:
          emb_file (str) : path to torch serialized embeddings
          fixed (bool) : if true, embeddings are not updated
        """
        if emb_file:
            pretrained = torch.load(emb_file)
            pretrained_vec_size = pretrained.size(1)
            if self.word_vec_size > pretrained_vec_size:
                self.word_lut.weight.data[:, :pretrained_vec_size] = pretrained
            elif self.word_vec_size < pretrained_vec_size:
                self.word_lut.weight.data \
                    .copy_(pretrained[:, :self.word_vec_size])
            else:
                self.word_lut.weight.data.copy_(pretrained)
            if fixed:
                self.word_lut.weight.requires_grad = False
def load_pretrained_vectors ( self , emb_file , fixed ) : if emb_file : pretrained = torch . load ( emb_file ) pretrained_vec_size = pretrained . size ( 1 ) if self . word_vec_size > pretrained_vec_size : self . word_lut . weight . data [ : , : pretrained_vec_size ] = pretrained elif self . word_vec_size < pretrained_vec_size : self . word_lut . weight . data . copy_ ( pretrained [ : , : self . word_vec_size ] ) else : self . word_lut . weight . data . copy_ ( pretrained ) if fixed : self . word_lut . weight . requires_grad = False