class_docstr: General DALI iterator for PyTorch. It can return any number of
  outputs from the DALI pipeline in the form of PyTorch's Tensors.
  
  Parameters
  ----------
  pipelines : list of nvidia.dali.Pipeline
              List of pipelines to use
  output_map : list of str
              List of strings which maps consecutive outputs
              of DALI pipelines to user specified name.
              Outputs will be returned from iterator as dictionary
              of those names.
              Each name should be distinct
  size : int, default = -1
              Number of samples in the shard for the wrapped pipeline (if there is more than
              one it is a sum)
              Providing -1 means that the iterator will work until StopIteration is raised
              from the inside of iter_setup(). The options `last_batch_policy` and
              `last_batch_padded` don't work in such case. It works with only one pipeline inside
              the iterator.
              Mutually exclusive with `reader_name` argument
  reader_name : str, default = None
              Name of the reader which will be queried for the shard size, number of shards and
              all other properties necessary to count properly the number of relevant and padded
              samples that iterator needs to deal with. It automatically sets
              `last_batch_padded` accordingly to match the reader's configuration.
  auto_reset : string or bool, optional, default = False
              Whether the iterator resets itself for the next epoch or it requires reset() to be
              called explicitly.
  
              It can be one of the following values:
  
              * ``"no"``, ``False`` or ``None`` - at the end of epoch StopIteration is raised
                and reset() needs to be called
              * ``"yes"`` or ``"True"``- at the end of epoch StopIteration is raised but reset()
                is called internally automatically
  
  dynamic_shape : any, optional,
              Parameter used only for backward compatibility.
  fill_last_batch : bool, optional, default = None
              **Deprecated** Please use ``last_batch_policy`` instead
  
              Whether to fill the last batch with data up to 'self.batch_size'.
              The iterator would return the first integer multiple
              of self._num_gpus * self.batch_size entries which exceeds 'size'.
              Setting this flag to False will cause the iterator to return
              exactly 'size' entries.
  last_batch_policy: optional, default = LastBatchPolicy.FILL
              What to do with the last batch when there are not enough samples in the epoch
              to fully fill it. See :meth:`nvidia.dali.plugin.base_iterator.LastBatchPolicy`
  last_batch_padded : bool, optional, default = False
              Whether the last batch provided by DALI is padded with the last sample
              or it just wraps up. In the conjunction with ``last_batch_policy`` it tells
              if the iterator returning last batch with data only partially filled with
              data from the current epoch is dropping padding samples or samples from
              the next epoch. If set to ``False`` next
              epoch will end sooner as data from it was consumed but dropped. If set to
              True next epoch would be the same length as the first one. For this to happen,
              the option `pad_last_batch` in the reader needs to be set to True as well.
              It is overwritten when `reader_name` argument is provided
  prepare_first_batch : bool, optional, default = True
              Whether DALI should buffer the first batch right after the creation of the iterator,
              so one batch is already prepared when the iterator is prompted for the data
  
  Example
  -------
  With the data set ``[1,2,3,4,5,6,7]`` and the batch size 2:
  
  last_batch_policy = LastBatchPolicy.PARTIAL, last_batch_padded = True  -> last batch = ``[7]``,
  next iteration will return ``[1, 2]``
  
  last_batch_policy = LastBatchPolicy.PARTIAL, last_batch_padded = False -> last batch = ``[7]``,
  next iteration will return ``[2, 3]``
  
  last_batch_policy = LastBatchPolicy.FILL, last_batch_padded = True   -> last batch = ``[7, 7]``,
  next iteration will return ``[1, 2]``
  
  last_batch_policy = LastBatchPolicy.FILL, last_batch_padded = False  -> last batch = ``[7, 1]``,
  next iteration will return ``[2, 3]``
  
  last_batch_policy = LastBatchPolicy.DROP, last_batch_padded = True   -> last batch = ``[5, 6]``,
  next iteration will return ``[1, 2]``
  
  last_batch_policy = LastBatchPolicy.DROP, last_batch_padded = False  -> last batch = ``[5, 6]``,
  next iteration will return ``[2, 3]``
class_docstr_tok: ["General","DALI","iterator","for","PyTorch",".","It","can","return","any","number","of","outputs","from","the","DALI","pipeline","in","the","form","of","PyTorch","'s","Tensors",".","Parameters","--","--","--","--","--","pipelines",":","list","of","nvidia.dali.Pipeline","List","of","pipelines","to","use","output_map",":","list","of","str","List","of","strings","which","maps","consecutive","outputs","of","DALI","pipelines","to","user","specified","name",".","Outputs","will","be","returned","from","iterator","as","dictionary","of","those","names",".","Each","name","should","be","distinct","size",":","int",",","default","=","-1","Number","of","samples","in","the","shard","for","the","wrapped","pipeline","(","if","there","is","more","than","one","it","is","a","sum",")","Providing","-1","means","that","the","iterator","will","work","until","StopIteration","is","raised","from","the","inside","of","iter_setup","(",")",".","The","options","`","last_batch_policy","`","and","`","last_batch_padded","`","do","n't","work","in","such","case",".","It","works","with","only","one","pipeline","inside","the","iterator",".","Mutually","exclusive","with","`","reader_name","`","argument","reader_name",":","str",",","default","=","None","Name","of","the","reader","which","will","be","queried","for","the","shard","size",",","number","of","shards","and","all","other","properties","necessary","to","count","properly","the","number","of","relevant","and","padded","samples","that","iterator","needs","to","deal","with",".","It","automatically","sets","`","last_batch_padded","`","accordingly","to","match","the","reader","'s","configuration",".","auto_reset",":","string","or","bool",",","optional",",","default","=","False","Whether","the","iterator","resets","itself","for","the","next","epoch","or","it","requires","reset","(",")","to","be","called","explicitly",".","It","can","be","one","of","the","following","values",":","*","``","``","no","''","``",",","``","False","``","or","``","None","``","-","at","the","end","of","epoch","StopIteration","is","raised","and","reset","(",")","needs","to","be","called","*","``","``","yes","''","``","or","``","``","True","''","``","-","at","the","end","of","epoch","StopIteration","is","raised","but","reset","(",")","is","called","internally","automatically","dynamic_shape",":","any",",","optional",",","Parameter","used","only","for","backward","compatibility",".","fill_last_batch",":","bool",",","optional",",","default","=","None","*","*","Deprecated","*","*","Please","use","``","last_batch_policy","``","instead","Whether","to","fill","the","last","batch","with","data","up","to","'self.batch_size","'",".","The","iterator","would","return","the","first","integer","multiple","of","self._num_gpus","*","self.batch_size","entries","which","exceeds","'size","'",".","Setting","this","flag","to","False","will","cause","the","iterator","to","return","exactly","'size","'","entries",".","last_batch_policy",":","optional",",","default","=","LastBatchPolicy.FILL","What","to","do","with","the","last","batch","when","there","are","not","enough","samples","in","the","epoch","to","fully","fill","it",".","See",":","meth",":","`","nvidia.dali.plugin.base_iterator.LastBatchPolicy","`","last_batch_padded",":","bool",",","optional",",","default","=","False","Whether","the","last","batch","provided","by","DALI","is","padded","with","the","last","sample","or","it","just","wraps","up",".","In","the","conjunction","with","``","last_batch_policy","``","it","tells","if","the","iterator","returning","last","batch","with","data","only","partially","filled","with","data","from","the","current","epoch","is","dropping","padding","samples","or","samples","from","the","next","epoch",".","If","set","to","``","False","``","next","epoch","will","end","sooner","as","data","from","it","was","consumed","but","dropped",".","If","set","to","True","next","epoch","would","be","the","same","length","as","the","first","one",".","For","this","to","happen",",","the","option","`","pad_last_batch","`","in","the","reader","needs","to","be","set","to","True","as","well",".","It","is","overwritten","when","`","reader_name","`","argument","is","provided","prepare_first_batch",":","bool",",","optional",",","default","=","True","Whether","DALI","should","buffer","the","first","batch","right","after","the","creation","of","the","iterator",",","so","one","batch","is","already","prepared","when","the","iterator","is","prompted","for","the","data","Example","--","--","--","-","With","the","data","set","``","[","1,2,3,4,5,6,7","]","``","and","the","batch","size","2",":","last_batch_policy","=","LastBatchPolicy.PARTIAL",",","last_batch_padded","=","True","-",">","last","batch","=","``","[","7","]","``",",","next","iteration","will","return","``","[","1",",","2","]","``","last_batch_policy","=","LastBatchPolicy.PARTIAL",",","last_batch_padded","=","False","-",">","last","batch","=","``","[","7","]","``",",","next","iteration","will","return","``","[","2",",","3","]","``","last_batch_policy","=","LastBatchPolicy.FILL",",","last_batch_padded","=","True","-",">","last","batch","=","``","[","7",",","7","]","``",",","next","iteration","will","return","``","[","1",",","2","]","``","last_batch_policy","=","LastBatchPolicy.FILL",",","last_batch_padded","=","False","-",">","last","batch","=","``","[","7",",","1","]","``",",","next","iteration","will","return","``","[","2",",","3","]","``","last_batch_policy","=","LastBatchPolicy.DROP",",","last_batch_padded","=","True","-",">","last","batch","=","``","[","5",",","6","]","``",",","next","iteration","will","return","``","[","1",",","2","]","``","last_batch_policy","=","LastBatchPolicy.DROP",",","last_batch_padded","=","False","-",">","last","batch","=","``","[","5",",","6","]","``",",","next","iteration","will","return","``","[","2",",","3","]","``"]
code: def __init__(
      self,
      pipelines: Union[List[Pipeline], Pipeline],
      output_map: List[str],
      size: int = -1,
      reader_name: Optional[str] = None,
      auto_reset: Union[str, bool, None] = False,
      fill_last_batch: Optional[bool] = None,
      dynamic_shape: Optional[bool] = False,
      last_batch_padded: bool = False,
      last_batch_policy: LastBatchPolicy = LastBatchPolicy.FILL,
      prepare_first_batch: bool = True,
  ) -> None:
      # check the assert first as _DaliBaseIterator would run the prefetch
      assert len(set(output_map)) == len(
          output_map
      ), "output_map names should be distinct"
      self._output_categories = set(output_map)
      self.output_map = output_map
  
      _DaliBaseIterator.__init__(
          self,
          pipelines,
          size,
          reader_name,
          auto_reset,
          fill_last_batch,
          last_batch_padded,
          last_batch_policy,
          prepare_first_batch=prepare_first_batch,
      )
  
      self._first_batch = None
      if self._prepare_first_batch:
          try:
              self._first_batch = DALIGenericIterator.__next__(self)
              # call to `next` sets _ever_consumed to True but if we are just calling it from
              # here we should set if to False again
              self._ever_consumed = False
          except StopIteration:
              # This case might not be an error if we're iterating over pipeline that is
              # currently at the end of epoch, for example because it was restored from
              # checkpoint.
              if all(
                  not p.is_restored_from_checkpoint or p._first_iter
                  for p in self._pipes
              ):
                  raise RuntimeError(
                      "It seems that there is no data in the pipeline. This may happen "
                      "if `last_batch_policy` is set to PARTIAL and the requested batch size is "
                      "greater than the shard size."
                  )
  
imports: import sys
  from typing import Union, Optional
  from typing import Any, Dict, List
  from nvidia.dali import internal
  from nvidia.dali import ops
  from nvidia.dali import types
  from nvidia.dali.backend import TensorCPU, TensorGPU, TensorListCPU, TensorListGPU
  from nvidia.dali.pipeline import Pipeline
  from nvidia.dali.plugin.base_iterator import _DaliBaseIterator
  from nvidia.dali.plugin.base_iterator import LastBatchPolicy
  import torch
  import torch.utils.dlpack
  import ctypes
  import numpy
  from .None import fn
  from nvidia.dali.plugin.pytorch._torch_function import TorchPythonFunction
label_desc: Use image node_id 1 to create a new DALIGenericIterator object from inherited base classes: _DaliBaseIterator with example: obj = DALIGenericIterator(pipelines, output_map, size, reader_name, auto_reset, fill_last_batch, dynamic_shape, last_batch_padded, last_batch_policy, prepare_first_batch)