code: def _calculate_gain(nonlinearity, param=None):
      linear_fns = [
          "linear",
          "conv1d",
          "conv2d",
          "conv3d",
          "conv_transpose1d",
          "conv_transpose2d",
          "conv_transpose3d",
      ]
      if nonlinearity in linear_fns or nonlinearity == "sigmoid":
          return 1
      elif nonlinearity == "tanh":
          return 5.0 / 3
      elif nonlinearity == "relu":
          return math.sqrt(2.0)
      elif nonlinearity == "leaky_relu":
          if param is None:
              negative_slope = 0.01
          elif (
              not isinstance(param, bool)
              and isinstance(param, int)
              or isinstance(param, float)
          ):
              # True/False are instances of int, hence check above
              negative_slope = param
          else:
              raise ValueError(
                  "negative_slope {} not a valid number".format(param)
              )
          return math.sqrt(2.0 / (1 + negative_slope**2))
      elif nonlinearity == "selu":
          return 3.0 / 4
      else:
          raise ValueError(
              "Unsupported nonlinearity {}".format(nonlinearity)
          )
  
imports: import math
  import numpy
  import paddle
  import paddle.nn
label_desc: Use image node_id 14 for calling a global function with example usage: _calculate_gain(nonlinearity, param) and returns: int, unknown, math, math, unknown