code: def get_activation(
      activation_type: str,
      ftswish_threshold: float = -0.2,
      ftswish_mean_shift: float = 0.0,
      hardtanh_min_val: int = -1.0,
      hardtanh_max_val: int = 1.0,
      leakyrelu_neg_slope: float = 0.01,
      smish_alpha: float = 1.0,
      smish_beta: float = 1.0,
      softplus_beta: float = 1.0,
      softplus_threshold: int = 20,
      swish_beta: float = 1.0,
  ) -> torch.nn.Module:
      """Return activation function.
  
      Args:
          activation_type: Activation function type.
          ftswish_threshold: Threshold value for FTSwish activation formulation.
          ftswish_mean_shift: Mean shifting value for FTSwish activation formulation.
          hardtanh_min_val: Minimum value of the linear region range for HardTanh.
          hardtanh_max_val: Maximum value of the linear region range for HardTanh.
          leakyrelu_neg_slope: Negative slope value for LeakyReLU activation formulation.
          smish_alpha: Alpha value for Smish activation fomulation.
          smish_beta: Beta value for Smish activation formulation.
          softplus_beta: Beta value for softplus activation formulation in Mish.
          softplus_threshold: Values above this revert to a linear function in Mish.
          swish_beta: Beta value for Swish variant formulation.
  
      Returns:
          : Activation function.
  
      """
      torch_version = V(torch.__version__)
  
      activations = {
          "ftswish": (
              FTSwish,
              {
                  "threshold": ftswish_threshold,
                  "mean_shift": ftswish_mean_shift,
              },
          ),
          "hardtanh": (
              torch.nn.Hardtanh,
              {
                  "min_val": hardtanh_min_val,
                  "max_val": hardtanh_max_val,
              },
          ),
          "leaky_relu": (
              torch.nn.LeakyReLU,
              {"negative_slope": leakyrelu_neg_slope},
          ),
          "mish": (
              Mish,
              {
                  "softplus_beta": softplus_beta,
                  "softplus_threshold": softplus_threshold,
                  "use_builtin": torch_version >= V("1.9"),
              },
          ),
          "relu": (torch.nn.ReLU, {}),
          "selu": (torch.nn.SELU, {}),
          "smish": (Smish, {"alpha": smish_alpha, "beta": smish_beta}),
          "swish": (
              Swish,
              {
                  "beta": swish_beta,
                  "use_builtin": torch_version >= V("1.8"),
              },
          ),
          "tanh": (torch.nn.Tanh, {}),
          "identity": (torch.nn.Identity, {}),
      }
  
      act_func, act_args = activations[activation_type]
  
      return act_func(**act_args)
  
file_path: espnet/espnet2/asr_transducer/activation.py
imports: import torch
  from packaging.version import parse
label_desc: Use image node_id 1 for calling a global function with example usage: get_activation(activation_type, ftswish_threshold, ftswish_mean_shift, hardtanh_min_val, hardtanh_max_val, leakyrelu_neg_slope, smish_alpha, smish_beta, softplus_beta, softplus_threshold, swish_beta) and returns: act_func