class_docstr: Test box_iou and generalized_box_iou functions.
class_docstr_tok: ["Test","box_iou","and","generalized_box_iou","functions","."]
docstr: Same as test_box_iou but for generalized_box_iou().
docstr_tok: ["Same","as","test_box_iou","but","for","generalized_box_iou","(",")","."]
code: def test_generalized_box_iou(self):
      """Same as test_box_iou but for generalized_box_iou()."""
      in1 = jnp.array(
          [
              [
                  [0.1, 0.2, 0.3, 0.4],
                  [0.1, 0.2, 0.5, 1.0],
                  [0.1, 0.2, 0.5, 0.8],
              ],
              [
                  [0.6, 0.2, 1.0, 1.0],
                  [0.6, 0.2, 1.0, 0.8],
                  [0.0, 0.0, 0.0, 0.0],
              ],
              [
                  [0.0, 0.0, 0.0, 0.0],
                  [0.2, 0.1, 0.2, 0.1],
                  [0.1, 0.1, 0.2, 0.2],
              ],
          ],
          dtype=jnp.float32,
      )
      in2 = jnp.array(
          [
              [
                  [0.4, 0.4, 0.5, 0.8],
                  [0.4, 0.4, 0.5, 0.8],
                  [0.4, 0.4, 0.7, 0.8],
              ],
              [
                  [0.7, 0.4, 0.8, 0.6],
                  [0.4, 0.4, 0.8, 0.6],
                  [0.1, 0.1, 0.2, 0.2],
              ],
              [
                  [0.0, 0.0, 0.0, 0.0],
                  [0.2, 0.1, 0.2, 0.1],
                  [0.1, 0.1, 0.2, 0.2],
              ],
          ],
          dtype=jnp.float32,
      )
  
      target_iou = jnp.array(
          [
              [0.0, 0.125, 0.125],
              [0.0625, 1.0 / 7.0, 0.0],
              [0.0, 0.0, 1.0],
          ],
          dtype=jnp.float32,
      )
      target_extra = jnp.array(
          [
              [-2.0 / 3.0, 0.0, -1.0 / 9.0],
              [0.0, -2.0 / 9.0, -3.0 / 4.0],
              [0.0, 0.0, 0.0],
          ],
          dtype=jnp.float32,
      )
      target = target_iou + target_extra
  
      output = box_utils.generalized_box_iou(in1, in2, all_pairs=False)
  
      self.assertSequenceAlmostEqual(
          output.flatten(), target.flatten(), places=3
      )
  
imports: from absl.testing import absltest
  from absl.testing import parameterized
  import jax
  import jax.numpy
  import numpy
  from scenic.model_lib.base_models import box_utils
  from shapely import geometry
label_desc: Use image node_id 5 for calling the IoUTest obj's underlying member method code with example usage: obj.test_generalized_box_iou() without return types