Model.py 文件源码

python
阅读 17 收藏 0 点赞 0 评论 0

项目:MemNN 作者: berlino 项目源码 文件源码
def forward(self, qu, w, cand):
        qu = Variable(qu)
        cand = Variable(cand)
        embed_q = self.embed(qu)
        embed_cand = self.embed(cand)

        out, (self.h0, self.c0) = self.rnn(embed_q, (self.h0, self.c0))
        self.h0.detach_()
        self.c0.detach_()
        q_state = out[:,-1,:]

        f_fea_v = torch.mm(q_state, torch.transpose(embed_cand,0,1))

        score_n = F.log_softmax(f_fea_v)
        return score_n
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号