code: def _loss_inter_union(
      boxes1: torch.Tensor,
      boxes2: torch.Tensor,
  ) -> Tuple[torch.Tensor, torch.Tensor]:
      x1, y1, x2, y2 = boxes1.unbind(dim=-1)
      x1g, y1g, x2g, y2g = boxes2.unbind(dim=-1)
  
      # Intersection keypoints
      xkis1 = torch.max(x1, x1g)
      ykis1 = torch.max(y1, y1g)
      xkis2 = torch.min(x2, x2g)
      ykis2 = torch.min(y2, y2g)
  
      intsctk = torch.zeros_like(x1)
      mask = (ykis2 > ykis1) & (xkis2 > xkis1)
      intsctk[mask] = (xkis2[mask] - xkis1[mask]) * (
          ykis2[mask] - ykis1[mask]
      )
      unionk = (
          (x2 - x1) * (y2 - y1) + (x2g - x1g) * (y2g - y1g) - intsctk
      )
  
      return intsctk, unionk
  
file_path: vision/torchvision/ops/_utils.py
imports: from typing import List, Optional, Tuple, Union
  import torch
  from torch import nn, Tensor
label_desc: Use image node_id 7 for calling a global function with example usage: _loss_inter_union(boxes1, boxes2) and returns: intsctk,  unionk