def concrete_sample(logits, temperature, shape=torch.Size([])):
    '\n    Sampling for Concrete distribution.\n\n    See Eq. 10 of Maddison et al., 2017.\n    '
    uniform_shape = (torch.Size(shape) + logits.shape)
    u = clamp_probs(torch.rand(uniform_shape, dtype=torch.float32, device=logits.device))
    gumbels = (- torch.log((- torch.log(u))))
    scores = ((logits + gumbels) / temperature)
    return scores.softmax(dim=(- 1))
Sampling for Concrete distribution.

See Eq. 10 of Maddison et al., 2017.
def concrete_sample(logits, temperature, shape=torch.Size([])):
    '\n    Sampling for Concrete distribution.\n\n    See Eq. 10 of Maddison et al., 2017.\n    '
    uniform_shape = (torch.Size(shape) + logits.shape)
    u = clamp_probs(torch.rand(uniform_shape, dtype=torch.float32, device=logits.device))
    gumbels = (- torch.log((- torch.log(u))))
    scores = ((logits + gumbels) / temperature)
    return scores.softmax(dim=(- 1))