code: def build_activation_layer(
      opts: argparse.Namespace,
      act_type: Optional[str] = None,
      inplace: Optional[bool] = None,
      negative_slope: Optional[float] = None,
      num_parameters: int = -1,
  ) -> torch.nn.Module:
      """
      Helper function to build the activation function. If any of the optional
      arguments are not provided (i.e. None), the corresponding ``model.activation.*``
      config entry will be used as default value.
  
      Args:
          act_type: Name of the activation layer.
              Default: --model.activation.name config value.
          inplace: If true, operation will be inplace.
              Default: --model.activation.inplace config value.
          negative_slope: Negative slope parameter for leaky_relu.
              Default: --model.activation.neg_slop config value.
      """
      assert isinstance(
          opts, argparse.Namespace
      ), f"Expected first argument to be an argparse.Namespace, but received a {type(opts)}."
      if act_type is None:
          act_type = getattr(opts, "model.activation.name")
      if inplace is None:
          inplace = getattr(opts, "model.activation.inplace")
      if negative_slope is None:
          negative_slope = getattr(opts, "model.activation.neg_slope")
  
      act_type = act_type.lower()
      act_layer = None
      if act_type in ACT_FN_REGISTRY:
          act_layer = ACT_FN_REGISTRY[act_type](
              num_parameters=num_parameters,
              inplace=inplace,
              negative_slope=negative_slope,
          )
      else:
          logger.error(
              "Supported activation layers are: {}. Supplied argument is: {}".format(
                  SUPPORTED_ACT_FNS, act_type
              )
          )
      return act_layer
  
file_path: ml-cvnets/cvnets/layers/activation/__init__.py
imports: import argparse
  import importlib
  import os
  from typing import Optional
  import torch.nn
  from utils import logger
label_desc: Use image node_id 3 for calling a global function with example usage: build_activation_layer(opts, act_type, inplace, negative_slope, num_parameters) and returns: act_layer