class_docstr: Wrap a list to a torch Dataset. It produces elements of the list as data.
class_docstr_tok: ["Wrap","a","list","to","a","torch","Dataset",".","It","produces","elements","of","the","list","as","data","."]
docstr: Args:
      lst (list): a list which contains elements to produce.
      copy (bool): whether to deepcopy the element when producing it,
          so that the result can be modified in place without affecting the
          source in the list.
      serialize (bool): whether to hold memory using serialized objects, when
          enabled, data loader workers can use shared RAM from master
          process instead of making a copy.
docstr_tok: ["Args",":","lst","(","list",")",":","a","list","which","contains","elements","to","produce",".","copy","(","bool",")",":","whether","to","deepcopy","the","element","when","producing","it",",","so","that","the","result","can","be","modified","in","place","without","affecting","the","source","in","the","list",".","serialize","(","bool",")",":","whether","to","hold","memory","using","serialized","objects",",","when","enabled",",","data","loader","workers","can","use","shared","RAM","from","master","process","instead","of","making","a","copy","."]
code: def __init__(
      self, lst: list, copy: bool = True, serialize: bool = True
  ):
      """
      Args:
          lst (list): a list which contains elements to produce.
          copy (bool): whether to deepcopy the element when producing it,
              so that the result can be modified in place without affecting the
              source in the list.
          serialize (bool): whether to hold memory using serialized objects, when
              enabled, data loader workers can use shared RAM from master
              process instead of making a copy.
      """
      self._lst = lst
      self._copy = copy
      self._serialize = serialize
  
      def _serialize(data):
          buffer = pickle.dumps(data, protocol=-1)
          return np.frombuffer(buffer, dtype=np.uint8)
  
      if self._serialize:
          logger = logging.getLogger(__name__)
          logger.info(
              "Serializing {} elements to byte tensors and concatenating them all ...".format(
                  len(self._lst)
              )
          )
          self._lst = [_serialize(x) for x in self._lst]
          self._addr = np.asarray(
              [len(x) for x in self._lst], dtype=np.int64
          )
          self._addr = np.cumsum(self._addr)
          self._lst = np.concatenate(self._lst)
          logger.info(
              "Serialized dataset takes {:.2f} MiB".format(
                  len(self._lst) / 1024**2
              )
          )
  
imports: import itertools
  import random
  import logging
  import operator
  import dill
  import pickle
  from pprint import pformat
  from typing import List, Optional, Union
  import numpy
  import torch
  import torch.utils.data
  from ..structures import BoxMode
  from ...utils.comm import get_world_size
  from ...utils.random import seed_all_rng
  from ..transforms import instance_transforms
  from ..registry.catalog import DatasetCatalog, MetadataCatalog
  from .detection_utils import check_metadata_consistency
  from .None import detection_utils
  from .samplers import InferenceSampler, RepeatFactorTrainingSampler, TrainingSampler
label_desc: Use image node_id 1 to create a new DatasetFromList object from inherited base classes: data with example: obj = DatasetFromList(lst, copy, serialize)