class_docstr: Samples from the Gumbel-Softmax distribution and optionally discretizes.
  
  Reference: https://arxiv.org/abs/1611.00712, https://arxiv.org/abs/1611.01144
  
  Arguments
  ----------
  tau: float
      non-negative scalar temperature
  hard: bool
      if True, the returned samples will be discretized as one-hot vectors, but will be differentiated as if it is the soft sample in autograd
  dim: int
      A dimension along which softmax will be computed (default: -1).
  
  Example
  -------
  >>> x = torch.randn((8, 40, 120))
  >>> act = GumbelSoftmax(0.8, True)
  >>> x = act(x)
class_docstr_tok: ["Samples","from","the","Gumbel-Softmax","distribution","and","optionally","discretizes",".","Reference",":","https",":","\/\/arxiv.org\/abs\/1611.00712",",","https",":","\/\/arxiv.org\/abs\/1611.01144","Arguments","--","--","--","--","--","tau",":","float","non-negative","scalar","temperature","hard",":","bool","if","True",",","the","returned","samples","will","be","discretized","as","one-hot","vectors",",","but","will","be","differentiated","as","if","it","is","the","soft","sample","in","autograd","dim",":","int","A","dimension","along","which","softmax","will","be","computed","(","default",":","-1",")",".","Example","--","--","--","-",">",">",">","x","=","torch.randn","(","(","8",",","40",",","120",")",")",">",">",">","act","=","GumbelSoftmax","(","0.8",",","True",")",">",">",">","x","=","act","(","x",")"]
docstr: Returns the Gumbel softmax of the input tensor.
  
  Arguments
  ---------
  x : torch.Tensor
      Input tensor.
docstr_tok: ["Returns","the","Gumbel","softmax","of","the","input","tensor",".","Arguments","--","--","--","--","-","x",":","torch.Tensor","Input","tensor","."]
code: def forward(self, x):
      """Returns the Gumbel softmax of the input tensor.
  
      Arguments
      ---------
      x : torch.Tensor
          Input tensor.
      """
      if self.apply_log:
          return torch.log(
              F.gumbel_softmax(x, tau=self.tau, hard=self.hard)
          )
      return F.gumbel_softmax(x, tau=self.tau, hard=self.hard)
  
file_path: speechbrain/speechbrain/nnet/activations.py
imports: import torch
  import logging
  import torch.nn.functional
label_desc: Use image node_id 2 for calling the GumbelSoftmax obj's underlying member method code with example usage: obj.forward(x) and returns: F, torch