# tensorplay.nn.functional.gumbel_softmax

Source: https://www.tensorplay.cn/docs/generated/tensorplay.nn.functional.gumbel_softmax.html

# tensorplay.nn.functional.gumbel_softmax

tensorplay.nn.functional.gumbel_softmax(logits: TensorBase, tau: [float](https://docs.python.org/3/library/functions.html#float) = 1, hard: [bool](https://docs.python.org/3/library/functions.html#bool) = False, eps: [float](https://docs.python.org/3/library/functions.html#float) = 1e-10, dim: [int](https://docs.python.org/3/library/functions.html#int) = -1) &#x2192; TensorBase[[source]](../_modules/tensorplay/nn/functional.html#gumbel_softmax)

Sample from the Gumbel-Softmax distribution and optionally discretize.

Port of torch.nn.functional.gumbel_softmax (reparametrization trick;
straight-through when hard=True).
