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
评论列表
文章目录