class_docstr: This structure stores a list of boxes as a Nx4 torch.Tensor.
  It supports some common methods about boxes
  (`area`, `clip`, `nonempty`, etc),
  and also behaves like a Tensor
  (support indexing, `to(device)`, `.device`, and iteration over all boxes)
  
  Attributes:
      tensor (torch.Tensor): float matrix of Nx4. Each row is (x1, y1, x2, y2).
class_docstr_tok: ["This","structure","stores","a","list","of","boxes","as","a","Nx4","torch.Tensor",".","It","supports","some","common","methods","about","boxes","(","`","area","`",",","`","clip","`",",","`","nonempty","`",",","etc",")",",","and","also","behaves","like","a","Tensor","(","support","indexing",",","`","to","(","device",")","`",",","`",".device","`",",","and","iteration","over","all","boxes",")","Attributes",":","tensor","(","torch.Tensor",")",":","float","matrix","of","Nx4",".","Each","row","is","(","x1",",","y1",",","x2",",","y2",")","."]
docstr: Clip (in place) the boxes by limiting x coordinates to the range [0, width]
  and y coordinates to the range [0, height].
  
  Args:
      box_size (height, width): The clipping box's size.
docstr_tok: ["Clip","(","in","place",")","the","boxes","by","limiting","x","coordinates","to","the","range","[","0",",","width","]","and","y","coordinates","to","the","range","[","0",",","height","]",".","Args",":","box_size","(","height",",","width",")",":","The","clipping","box","'s","size","."]
code: def clip(self, box_size: Tuple[int, int]) -> None:
      """
      Clip (in place) the boxes by limiting x coordinates to the range [0, width]
      and y coordinates to the range [0, height].
  
      Args:
          box_size (height, width): The clipping box's size.
      """
      assert torch.isfinite(
          self.tensor
      ).all(), "Box tensor contains infinite or NaN!"
      h, w = box_size
      x1 = self.tensor[:, 0].clamp(min=0, max=w)
      y1 = self.tensor[:, 1].clamp(min=0, max=h)
      x2 = self.tensor[:, 2].clamp(min=0, max=w)
      y2 = self.tensor[:, 3].clamp(min=0, max=h)
      self.tensor = torch.stack((x1, y1, x2, y2), dim=-1)
  
imports: import math
  import numpy
  from enum import IntEnum, unique
  from typing import List, Tuple, Union
  import torch
  from torch import device
label_desc: Use image node_id 5 for calling the Boxes obj's underlying member method code with example usage: obj.clip(box_size) without return types