D-X-Y / AutoDL-Projects

Automated deep learning algorithms implemented in PyTorch.
MIT License
1.57k stars 282 forks source link

Why use exponential distribution to implement Gumbel softmax? #89

Closed pingguokiller closed 3 years ago

pingguokiller commented 3 years ago

In function select2withP of AutoDL-Projects\lib\models\shape_searchs\SoftSelect.py, the implementation of Gumbel softmax is below:

gumbels = -torch.emptylike(logits).exponential().log()

I don't understand why to use exponential distribution to implement Gumbel softmax?

D-X-Y commented 3 years ago

I follow the implementation of PyTorch at here: https://pytorch.org/docs/stable/_modules/torch/nn/functional.html#gumbel_softmax