Return type:
      Tensor
Note:
 This function is here for legacy reasons, may be removed from
 nn.Functional in the future.

Note:
 The main trick for *hard* is to do  *y_hard - y_soft.detach() +
 y_soft*It achieves two things: - makes the output value exactly
 one-hot (since we add then subtract y_soft value) - makes the
 gradient equal to y_soft gradient (since we strip all other
 gradients)

Examples::
      >>> logits = torch.randn(20, 32)
      >>> # Sample soft categorical using reparametrization trick:
      >>> F.gumbel_softmax(logits, tau=1, hard=False)
      >>> # Sample hard categorical using "Straight-through" trick:
      >>> F.gumbel_softmax(logits, tau=1, hard=True)