conv_gru.py 文件源码

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

项目:Multitask-and-Transfer-Learning 作者: AI-ON 项目源码 文件源码
def __call__(self, x):
        z = self.W_z(x)
        h_bar = self.W(x)
        if self.h is not None:
            r = F.sigmoid(self.W_r(x) + self.U_r(self.h))
            z += self.U_z(self.h)
            h_bar += self.U(r * self.h)
        z = F.sigmoid(z)
        h_bar = F.tanh(h_bar)

        if self.h is not None:
            h_new = F.linear_interpolate(z, h_bar, self.h)
        else:
            h_new = z * h_bar
        self.h = h_new  # save the state
        return h_new
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号