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:
      item: int, slice, or a BoolTensor
  
  Returns:
      Boxes: Create a new :class:`Boxes` by indexing.
  
  The following usage are allowed:
  
  1. `new_boxes = boxes[3]`: return a `Boxes` which contains only one box.
  2. `new_boxes = boxes[2:10]`: return a slice of boxes.
  3. `new_boxes = boxes[vector]`, where vector is a torch.BoolTensor
     with `length = len(boxes)`. Nonzero elements in the vector will be selected.
  
  Note that the returned Boxes might share storage with this Boxes,
  subject to Pytorch's indexing semantics.
docstr_tok: ["Args",":","item",":","int",",","slice",",","or","a","BoolTensor","Returns",":","Boxes",":","Create","a","new",":","class",":","`","Boxes","`","by","indexing",".","The","following","usage","are","allowed",":","1",".","`","new_boxes","=","boxes","[","3","]","`",":","return","a","`","Boxes","`","which","contains","only","one","box",".","2",".","`","new_boxes","=","boxes","[","2:10","]","`",":","return","a","slice","of","boxes",".","3",".","`","new_boxes","=","boxes","[","vector","]","`",",","where","vector","is","a","torch.BoolTensor","with","`","length","=","len","(","boxes",")","`",".","Nonzero","elements","in","the","vector","will","be","selected",".","Note","that","the","returned","Boxes","might","share","storage","with","this","Boxes",",","subject","to","Pytorch","'s","indexing","semantics","."]
code: def __getitem__(self, item) -> "Boxes":
      """
      Args:
          item: int, slice, or a BoolTensor
  
      Returns:
          Boxes: Create a new :class:`Boxes` by indexing.
  
      The following usage are allowed:
  
      1. `new_boxes = boxes[3]`: return a `Boxes` which contains only one box.
      2. `new_boxes = boxes[2:10]`: return a slice of boxes.
      3. `new_boxes = boxes[vector]`, where vector is a torch.BoolTensor
         with `length = len(boxes)`. Nonzero elements in the vector will be selected.
  
      Note that the returned Boxes might share storage with this Boxes,
      subject to Pytorch's indexing semantics.
      """
      if isinstance(item, int):
          return Boxes(self.tensor[item].view(1, -1))
      b = self.tensor[item]
      assert (
          b.dim() == 2
      ), "Indexing on Boxes with {} failed to return a matrix!".format(
          item
      )
      return Boxes(b)
  
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 7 for calling the Boxes obj's underlying member method code with example usage: obj.__getitem__(item) and returns: Boxes, Boxes