code: def test_box_coder(self):
      prior_box_np = np.random.random((81, 4)).astype("float32")
      prior_box_var_np = np.random.random((81, 4)).astype("float32")
      target_box_np = np.random.random((20, 81, 4)).astype("float32")
  
      # static
      with self.static_graph():
          prior_box = paddle.static.data(
              name="prior_box", shape=[81, 4], dtype="float32"
          )
          prior_box_var = paddle.static.data(
              name="prior_box_var", shape=[81, 4], dtype="float32"
          )
          target_box = paddle.static.data(
              name="target_box", shape=[20, 81, 4], dtype="float32"
          )
  
          boxes = ops.box_coder(
              prior_box=prior_box,
              prior_box_var=prior_box_var,
              target_box=target_box,
              code_type="decode_center_size",
              box_normalized=False,
          )
  
          (boxes_np,) = self.get_static_graph_result(
              feed={
                  "prior_box": prior_box_np,
                  "prior_box_var": prior_box_var_np,
                  "target_box": target_box_np,
              },
              fetch_list=[boxes],
              with_lod=False,
          )
  
      # dygraph
      with self.dynamic_graph():
          prior_box_dy = paddle.to_tensor(prior_box_np)
          prior_box_var_dy = paddle.to_tensor(prior_box_var_np)
          target_box_dy = paddle.to_tensor(target_box_np)
  
          boxes_dy = ops.box_coder(
              prior_box=prior_box_dy,
              prior_box_var=prior_box_var_dy,
              target_box=target_box_dy,
              code_type="decode_center_size",
              box_normalized=False,
          )
  
          boxes_dy_np = boxes_dy.numpy()
  
          self.assertTrue(np.array_equal(boxes_np, boxes_dy_np))
  
imports: from __future__ import print_function
  import os, sys
  import unittest
  import numpy
  import paddle
  import ppdet.modeling.ops
  from ppdet.modeling.tests.test_base import LayerTest
label_desc: Use image node_id 1 for calling the TestBoxCoder obj's underlying member method code with example usage: obj.test_box_coder() without return types