class_docstr: Swish activation definition.
  
  Swish(x) = (beta * x) * sigmoid(x)
               where beta = 1 defines standard Swish activation.
  
  References:
      https://arxiv.org/abs/2108.12943 / https://arxiv.org/abs/1710.05941v1.
      E-swish variant: https://arxiv.org/abs/1801.07145.
  
  Args:
      beta: Beta parameter for E-Swish.
              (beta >= 1. If beta < 1, use standard Swish).
      use_builtin: Whether to use PyTorch function if available.
class_docstr_tok: ["Swish","activation","definition",".","Swish","(","x",")","=","(","beta","*","x",")","*","sigmoid","(","x",")","where","beta","=","1","defines","standard","Swish","activation",".","References",":","https",":","\/\/arxiv.org\/abs\/2108.12943","\/","https",":","\/\/arxiv.org\/abs\/1710.05941v1",".","E-swish","variant",":","https",":","\/\/arxiv.org\/abs\/1801.07145",".","Args",":","beta",":","Beta","parameter","for","E-Swish",".","(","beta",">","=","1",".","If","beta","<","1",",","use","standard","Swish",")",".","use_builtin",":","Whether","to","use","PyTorch","function","if","available","."]
code: def __init__(
      self, beta: float = 1.0, use_builtin: bool = False
  ) -> None:
      super().__init__()
  
      self.beta = beta
  
      if beta > 1:
          self.swish = lambda x: (self.beta * x) * torch.sigmoid(x)
      else:
          if use_builtin:
              self.swish = torch.nn.SiLU()
          else:
              self.swish = lambda x: x * torch.sigmoid(x)
  
file_path: espnet/espnet2/asr_transducer/activation.py
imports: import torch
  from packaging.version import parse
label_desc: Use image node_id 1 to create a new Swish object from inherited base classes: torch.nn with example: obj = Swish(beta, use_builtin)