code: def _clip_box(tensor, box_size: Tuple[int, int]):
      assert torch.isfinite(
          tensor
      ).all(), "Box tensor contains infinite or NaN!"
      h, w = box_size
      tensor[:, 0].clamp_(min=0, max=w)
      tensor[:, 1].clamp_(min=0, max=h)
      tensor[:, 2].clamp_(min=0, max=w)
      tensor[:, 3].clamp_(min=0, max=h)
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/examples/research_projects/lxmert/processing_image.py
imports: import sys
  from typing import Tuple
  import numpy
  import torch
  from PIL import Image
  from torch import nn
  from transformers.image_utils import PILImageResampling
  from utils import img_tensorize
label_desc: Use image node_id 2 for calling a global function with example usage: _clip_box(tensor, box_size) without return types