def get_activation_by_name(name, inplace=False,
                           elu_alpha=1.0,
                           leaky_relu_negative_slope=0.01,
                           softmax_dim=None,
                           softplus_beta=1.0, softplus_threshold=20.0):
    """
    Get activation function by name

    Parameters
    ----------
    name : str
        Activation function name. Available functions: 
        'elu', 'leaky_relu', 'relu', 'sigmoid',
        'softmax', 'softplus', 'tanh'.

    inplace : bool, optional (default=False)
        If set to True, do the operation in-place.

    elu_alpha : float, optional (default=1.0)
        The alpha value for the ELU formulation.
        See https://pytorch.org/docs/stable/generated/torch.nn.ELU.html#elu for details.

    leaky_relu_negative_slope : float, optional (default=0.01)
        Controls the angle of the negative slope (which is used for negative inputs values).
        See https://pytorch.org/docs/stable/generated/torch.nn.LeakyReLU.html#leakyrelu for details.

    softmax_dim : int, optional (default=None)
        A dimension along which Softmax will be computed (so every slice along dim will sum to 1).
        See https://pytorch.org/docs/stable/generated/torch.nn.Softmax.html#softmax for details.

    softplus_beta : float, optional (default=1.0)
        The beta value for the Softplus formulation.
        See https://pytorch.org/docs/stable/generated/torch.nn.Softplus.html#softplus for details.

    softplus_threshold : float, optional (default=20.0)
        Values above this revert to a linear function
        See https://pytorch.org/docs/stable/generated/torch.nn.Softplus.html#softplus for details.

    Returns
    -------
    activation : torch.nn.Module
        Activation function module
    """
    activation_dict = {
        'elu': nn.ELU(alpha=elu_alpha, inplace=inplace),
        'leaky_relu': nn.LeakyReLU(negative_slope=leaky_relu_negative_slope,
                                   inplace=inplace),
        'relu': nn.ReLU(inplace=inplace),
        'sigmoid': nn.Sigmoid(),
        'softmax': nn.Softmax(dim=softmax_dim),
        'softplus': nn.Softplus(beta=softplus_beta,
                                threshold=softplus_threshold),
        'tanh': nn.Tanh()
    }

    if name in activation_dict.keys():
        return activation_dict[name]

    else:
        raise ValueError(f"{name} is not a valid activation.")

    Get activation function by name

    Parameters
    ----------
    name : str
        Activation function name. Available functions: 
        'elu', 'leaky_relu', 'relu', 'sigmoid',
        'softmax', 'softplus', 'tanh'.

    inplace : bool, optional (default=False)
        If set to True, do the operation in-place.

    elu_alpha : float, optional (default=1.0)
        The alpha value for the ELU formulation.
        See https://pytorch.org/docs/stable/generated/torch.nn.ELU.html#elu for details.

    leaky_relu_negative_slope : float, optional (default=0.01)
        Controls the angle of the negative slope (which is used for negative inputs values).
        See https://pytorch.org/docs/stable/generated/torch.nn.LeakyReLU.html#leakyrelu for details.

    softmax_dim : int, optional (default=None)
        A dimension along which Softmax will be computed (so every slice along dim will sum to 1).
        See https://pytorch.org/docs/stable/generated/torch.nn.Softmax.html#softmax for details.

    softplus_beta : float, optional (default=1.0)
        The beta value for the Softplus formulation.
        See https://pytorch.org/docs/stable/generated/torch.nn.Softplus.html#softplus for details.

    softplus_threshold : float, optional (default=20.0)
        Values above this revert to a linear function
        See https://pytorch.org/docs/stable/generated/torch.nn.Softplus.html#softplus for details.

    Returns
    -------
    activation : torch.nn.Module
        Activation function module
    
pyod/utils/torch_utility.py