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: Args:
      tensor (Tensor[float]): a Nx4 matrix.  Each row is (x1, y1, x2, y2).
docstr_tok: ["Args",":","tensor","(","Tensor","[","float","]",")",":","a","Nx4","matrix",".","Each","row","is","(","x1",",","y1",",","x2",",","y2",")","."]
code: def __init__(self, tensor: torch.Tensor):
      """
      Args:
          tensor (Tensor[float]): a Nx4 matrix.  Each row is (x1, y1, x2, y2).
      """
      device = (
          tensor.device
          if isinstance(tensor, torch.Tensor)
          else torch.device("cpu")
      )
      if isinstance(tensor, torch.Tensor):
          tensor = tensor.float().to(device)
      else:
          tensor = torch.as_tensor(
              tensor, dtype=torch.float32, device=device
          )
      if tensor.numel() == 0:
          # Use reshape, so we don't end up creating a new tensor that does not depend on
          # the inputs (and consequently confuses jit)
          tensor = tensor.reshape((0, 4)).to(
              dtype=torch.float32, device=device
          )
      assert tensor.dim() == 2 and tensor.size(-1) == 4, tensor.size()
  
      self.tensor = tensor
  
imports: import math
  from enum import IntEnum, unique
  from typing import Any, List, Tuple, Union
  import numpy
  import torch
label_desc: Use image node_id 1 to create a new Boxes object  with example: obj = Boxes(tensor)