adgm.py 文件源码

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

项目:adgm 作者: musyoku 项目源码 文件源码
def sample_ax_y_gumbel(self, a, x, temperature=10, test=False):
        a = self.to_variable(a)
        x = self.to_variable(x)
        batchsize = self.get_batchsize(x)
        log_q_y = self.q_y_ax(a, x, test=test)
        eps = 1e-16
        u = np.random.uniform(0, 1, log_q_y.shape).astype(x.dtype)
        g = self.to_variable(-np.log(-np.log(u + eps) + eps))
        sampled_y = F.softmax((log_q_y + g) / temperature)
        return sampled_y
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号