class_docstr: A structure for storing masks and their related data in batched format.
  Implements basic filtering and concatenation.
class_docstr_tok: ["A","structure","for","storing","masks","and","their","related","data","in","batched","format",".","Implements","basic","filtering","and","concatenation","."]
code: def filter(self, keep: torch.Tensor) -> None:
      for k, v in self._stats.items():
          if v is None:
              self._stats[k] = None
          elif isinstance(v, torch.Tensor):
              self._stats[k] = v[torch.as_tensor(keep, device=v.device)]
          elif isinstance(v, np.ndarray):
              self._stats[k] = v[keep.detach().cpu().numpy()]
          elif isinstance(v, list) and keep.dtype == torch.bool:
              self._stats[k] = [a for i, a in enumerate(v) if keep[i]]
          elif isinstance(v, list):
              self._stats[k] = [v[i] for i in keep]
          else:
              raise TypeError(
                  f"MaskData key {k} has an unsupported type {type(v)}."
              )
  
imports: import numpy
  import torch
  import math
  from copy import deepcopy
  from itertools import product
  from typing import Any, Dict, Generator, ItemsView, List, Tuple
label_desc: Use image node_id 6 for calling the MaskData obj's underlying member method code with example usage: obj.filter(keep) without return types