code: def add_coord(x, data_format):
      b = paddle.shape(x)[0]
      if data_format == "NCHW":
          h, w = x.shape[2], x.shape[3]
      else:
          h, w = x.shape[1], x.shape[2]
  
      gx = paddle.cast(
          paddle.arange(w) / ((w - 1.0) * 2.0) - 1.0, x.dtype
      )
      gy = paddle.cast(
          paddle.arange(h) / ((h - 1.0) * 2.0) - 1.0, x.dtype
      )
  
      if data_format == "NCHW":
          gx = gx.reshape([1, 1, 1, w]).expand([b, 1, h, w])
          gy = gy.reshape([1, 1, h, 1]).expand([b, 1, h, w])
      else:
          gx = gx.reshape([1, 1, w, 1]).expand([b, h, w, 1])
          gy = gy.reshape([1, h, 1, 1]).expand([b, h, w, 1])
  
      gx.stop_gradient = True
      gy.stop_gradient = True
      return gx, gy
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register, serializable
  from ppdet.modeling.layers import DropBlock
  from ppdet.modeling.ops import get_act_fn
  from ..backbones.darknet import ConvBNLayer
  from ..shape_spec import ShapeSpec
  from ..backbones.csp_darknet import BaseConv, DWConv, CSPLayer
label_desc: Use image node_id 1 for calling a global function with example usage: add_coord(x, data_format) and returns: gx,  gy