class_docstr: This class stores the segmentation masks for all objects in one image, in
  the form of bitmaps.
  
  Attributes:
      tensor: bool Tensor of N,H,W, representing N instances in the image.
class_docstr_tok: ["This","class","stores","the","segmentation","masks","for","all","objects","in","one","image",",","in","the","form","of","bitmaps",".","Attributes",":","tensor",":","bool","Tensor","of","N",",","H",",","W",",","representing","N","instances","in","the","image","."]
docstr: Args:
      polygon_masks (list[list[ndarray]] or PolygonMasks)
      height, width (int)
docstr_tok: ["Args",":","polygon_masks","(","list","[","list","[","ndarray","]","]","or","PolygonMasks",")","height",",","width","(","int",")"]
code: def from_polygon_masks(
      polygon_masks: Union["PolygonMasks", List[List[np.ndarray]]],
      height: int,
      width: int,
  ) -> "BitMasks":
      """
      Args:
          polygon_masks (list[list[ndarray]] or PolygonMasks)
          height, width (int)
      """
      if isinstance(polygon_masks, PolygonMasks):
          polygon_masks = polygon_masks.polygons
      masks = [
          polygons_to_bitmask(p, height, width) for p in polygon_masks
      ]
      return BitMasks(torch.stack([torch.from_numpy(x) for x in masks]))
  
imports: import copy
  import itertools
  from typing import Any, Iterator, List, Union
  import numpy
  import torch
  import torchvision
  from .boxes import Boxes
label_desc: Use image node_id 9 for calling the BitMasks obj's underlying member method code with example usage: obj.from_polygon_masks(polygon_masks, height, width) and returns: BitMasks