code: def ConvNorm(
      input,
      num_filters,
      filter_size,
      stride=1,
      groups=1,
      norm_decay=0.0,
      norm_type="affine_channel",
      norm_groups=32,
      dilation=1,
      lr_scale=1,
      freeze_norm=False,
      act=None,
      norm_name=None,
      initializer=None,
      name=None,
  ):
      fan = num_filters
      conv = fluid.layers.conv2d(
          input=input,
          num_filters=num_filters,
          filter_size=filter_size,
          stride=stride,
          padding=((filter_size - 1) // 2) * dilation,
          dilation=dilation,
          groups=groups,
          act=None,
          param_attr=ParamAttr(
              name=name + "_weights",
              initializer=initializer,
              learning_rate=lr_scale,
          ),
          bias_attr=False,
          name=name + ".conv2d.output.1",
      )
  
      norm_lr = 0.0 if freeze_norm else 1.0
      pattr = ParamAttr(
          name=norm_name + "_scale",
          learning_rate=norm_lr * lr_scale,
          regularizer=L2Decay(norm_decay),
      )
      battr = ParamAttr(
          name=norm_name + "_offset",
          learning_rate=norm_lr * lr_scale,
          regularizer=L2Decay(norm_decay),
      )
  
      if norm_type in ["bn", "sync_bn"]:
          global_stats = True if freeze_norm else False
          out = fluid.layers.batch_norm(
              input=conv,
              act=act,
              name=norm_name + ".output.1",
              param_attr=pattr,
              bias_attr=battr,
              moving_mean_name=norm_name + "_mean",
              moving_variance_name=norm_name + "_variance",
              use_global_stats=global_stats,
          )
          scale = fluid.framework._get_var(pattr.name)
          bias = fluid.framework._get_var(battr.name)
      elif norm_type == "gn":
          out = fluid.layers.group_norm(
              input=conv,
              act=act,
              name=norm_name + ".output.1",
              groups=norm_groups,
              param_attr=pattr,
              bias_attr=battr,
          )
          scale = fluid.framework._get_var(pattr.name)
          bias = fluid.framework._get_var(battr.name)
      elif norm_type == "affine_channel":
          scale = fluid.layers.create_parameter(
              shape=[conv.shape[1]],
              dtype=conv.dtype,
              attr=pattr,
              default_initializer=fluid.initializer.Constant(1.0),
          )
          bias = fluid.layers.create_parameter(
              shape=[conv.shape[1]],
              dtype=conv.dtype,
              attr=battr,
              default_initializer=fluid.initializer.Constant(0.0),
          )
          out = fluid.layers.affine_channel(
              x=conv, scale=scale, bias=bias, act=act
          )
      if freeze_norm:
          scale.stop_gradient = True
          bias.stop_gradient = True
      return out
  
file_path: PaddleHub/modules/image/object_detection/faster_rcnn_resnet50_fpn_venus/fpn.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  from collections import OrderedDict
  from paddle import fluid
  from paddle.fluid.param_attr import ParamAttr
  from paddle.fluid.initializer import Xavier
  from paddle.fluid.regularizer import L2Decay
label_desc: Use image node_id 1 for calling a global function with example usage: ConvNorm(input, num_filters, filter_size, stride, groups, norm_decay, norm_type, norm_groups, dilation, lr_scale, freeze_norm, act, norm_name, initializer, name) and returns: out