code: def batch_normalization(
      x,
      mean,
      variance,
      offset,
      scale,
      variance_epsilon,
      data_format,
      name=None,
  ):
      """Data Format aware version of tf.nn.batch_normalization."""
      if data_format == "channels_last":
          mean = tf.reshape(mean, [1] * (len(x.shape) - 1) + [-1])
          variance = tf.reshape(
              variance, [1] * (len(x.shape) - 1) + [-1]
          )
          offset = tf.reshape(offset, [1] * (len(x.shape) - 1) + [-1])
          scale = tf.reshape(scale, [1] * (len(x.shape) - 1) + [-1])
      elif data_format == "channels_first":
          mean = tf.reshape(mean, [1] + [-1] + [1] * (len(x.shape) - 2))
          variance = tf.reshape(
              variance, [1] + [-1] + [1] * (len(x.shape) - 2)
          )
          offset = tf.reshape(
              offset, [1] + [-1] + [1] * (len(x.shape) - 2)
          )
          scale = tf.reshape(
              scale, [1] + [-1] + [1] * (len(x.shape) - 2)
          )
      else:
          raise ValueError("invalid data_format: %s" % data_format)
  
      with ops.name_scope(
          name, "batchnorm", [x, mean, variance, scale, offset]
      ):
          inv = math_ops.rsqrt(variance + variance_epsilon)
          if scale is not None:
              inv *= scale
  
          a = math_ops.cast(inv, x.dtype)
          b = math_ops.cast(
              offset - mean * inv
              if offset is not None
              else -mean * inv,
              x.dtype,
          )
  
          # Return a * x + b with customized data_format.
          # Currently TF doesn't have bias_scale, and tensorRT has bug in converting tf.nn.bias_add
          # So we reimplemted them to allow make the model work with tensorRT.
          # See https://github.com/tensorlayer/openpose-plus/issues/75 for more details.
          df = {"channels_first": "NCHW", "channels_last": "NHWC"}
          return _bias_add(
              _bias_scale(x, a, df[data_format]), b, df[data_format]
          )
  
imports: import tensorflow
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import math_ops
  from tensorflow.python.training import moving_averages
  import tensorlayer
  from tensorlayer import logging
  from tensorlayer.layers.core import Layer
label_desc: Use image node_id 5 for calling a global function with example usage: batch_normalization(x, mean, variance, offset, scale, variance_epsilon, data_format, name) and returns: _bias_add