class_docstr: Class representing a dataset abstraction.
  
  This class wraps a :class:`torch.utils.data.Dataset` via the `dataset` attribute
  and configures the dataloaders needed to access the datasets. By default,
  this class will use `DEFAULT_NUM_WORKERS` processes to load the data
  (num_workers in :class:`torch.utils.data.DataLoader`).
  Transforms which need to be applied to the data should be specified in this class.
  ClassyDataset can be instantiated from a configuration file as well.
class_docstr_tok: ["Class","representing","a","dataset","abstraction",".","This","class","wraps","a",":","class",":","`","torch.utils.data.Dataset","`","via","the","`","dataset","`","attribute","and","configures","the","dataloaders","needed","to","access","the","datasets",".","By","default",",","this","class","will","use","`","DEFAULT_NUM_WORKERS","`","processes","to","load","the","data","(","num_workers","in",":","class",":","`","torch.utils.data.DataLoader","`",")",".","Transforms","which","need","to","be","applied","to","the","data","should","be","specified","in","this","class",".","ClassyDataset","can","be","instantiated","from","a","configuration","file","as","well","."]
docstr: Constructor for a ClassyDataset.
  
  Args:
      batchsize_per_replica: Positive integer indicating batch size for each
          replica
      shuffle: Whether to shuffle between epochs
      transform: When set, transform to be applied to each sample
      num_samples: When set, this restricts the number of samples provided by
          the dataset
docstr_tok: ["Constructor","for","a","ClassyDataset",".","Args",":","batchsize_per_replica",":","Positive","integer","indicating","batch","size","for","each","replica","shuffle",":","Whether","to","shuffle","between","epochs","transform",":","When","set",",","transform","to","be","applied","to","each","sample","num_samples",":","When","set",",","this","restricts","the","number","of","samples","provided","by","the","dataset"]
code: def __init__(
      self,
      dataset: Sequence,
      batchsize_per_replica: int,
      shuffle: bool,
      transform: Optional[Union[ClassyTransform, Callable]],
      num_samples: Optional[int],
  ) -> None:
      """
      Constructor for a ClassyDataset.
  
      Args:
          batchsize_per_replica: Positive integer indicating batch size for each
              replica
          shuffle: Whether to shuffle between epochs
          transform: When set, transform to be applied to each sample
          num_samples: When set, this restricts the number of samples provided by
              the dataset
      """
      # Asserts:
      assert is_pos_int(
          batchsize_per_replica
      ), "batchsize_per_replica must be a positive int"
      assert isinstance(shuffle, bool), "shuffle must be a boolean"
      assert num_samples is None or is_pos_int(
          num_samples
      ), "num_samples must be a positive int or None"
  
      # Assignments:
      self.batchsize_per_replica = batchsize_per_replica
      self.shuffle = shuffle
      self.transform = transform
      self.num_samples = num_samples
      self.dataset = dataset
      self.num_workers = DEFAULT_NUM_WORKERS
  
      log_class_usage("Dataset", self.__class__)
  
file_path: ClassyVision/classy_vision/dataset/classy_dataset.py
imports: from typing import Any, Callable, Dict, Optional, Sequence, Union
  from classy_vision.dataset.transforms import ClassyTransform
  from classy_vision.generic.distributed_util import get_rank, get_world_size
  from classy_vision.generic.util import is_pos_int, log_class_usage
  from torch.utils.data import DataLoader
  from torch.utils.data.distributed import DistributedSampler
label_desc: Use image node_id 1 to create a new ClassyDataset object  with example: obj = ClassyDataset(dataset, batchsize_per_replica, shuffle, transform, num_samples)