(self, x)
return embed
word index: [batch_size] => word vectors: [batch_size, hidden_size]
word index: [batch_size] => word vectors: [batch_size, hidden_size]
word index : [ batch_size ] = > word vectors : [ batch_size hidden_size ]
def embed(self, x):
        """word index: [batch_size] => word vectors: [batch_size, hidden_size]"""

        if self.training and self.word_drop > 0.0:
            if random.random() < self.word_drop:
                embed = self.embedding(to_var(x.data.new([UNK_ID] * x.size(0))))
            else:
                embed = self.embedding(x)
        else:
            embed = self.embedding(x)

        return embed
def embed ( self , x ) : if self . training and self . word_drop > 0.0 : if random . random ( ) < self . word_drop : embed = self . embedding ( to_var ( x . data . new ( [ UNK_ID ] * x . size ( 0 ) ) ) ) else : embed = self . embedding ( x ) else : embed = self . embedding ( x ) return embed