code: def temporal_iou(
      pred_displacements: Array,
      gt_displacements: Array,
      eps: float = 1e-6,
      np_backend: PyModule = jnp,
  ) -> Array:
      """Computes temporal IoUs.
  
      The displacements are assumed to be greater or equal to zero.
  
      Args:
        pred_displacements: A ND array where the last dimension is 2 containing the
          predicted displacements to the start/end times.
        gt_displacements: A ND array where the last dimension is 2 containing the
          ground truth displacements to the start/end times.
        eps: A small value to avoid division by zero.
        np_backend: Numpy backend.
  
      Returns:
        A (N-1)D array containing the computed IoUs.
      """
      intersection = np_backend.minimum(
          pred_displacements[..., 0], gt_displacements[..., 0]
      ) + np_backend.minimum(
          pred_displacements[..., 1], gt_displacements[..., 1]
      )
      union = np_backend.maximum(
          pred_displacements[..., 0], gt_displacements[..., 0]
      ) + np_backend.maximum(
          pred_displacements[..., 1], gt_displacements[..., 1]
      )
      return intersection / (union + eps)
  
file_path: scenic/scenic/projects/unloc/metrics.py
imports: from typing import Any, List, Union
  import jax.numpy
  import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: temporal_iou(pred_displacements, gt_displacements, eps, np_backend) and returns: unknown