class_docstr: ExternalSource is a special operator that can provide data to a DALI pipeline
  from Python by several methods.
  
  The simplest and preferred way is to specify a ``source``, which can be a callable or iterable.
  
  .. note::
      :meth:`nvidia.dali.fn.external_source` operator is partially compatible with TensorFlow
      integration via :meth:`nvidia.dali.plugin.tf.experimental.DALIDatasetWithInputs`.
      Please refer to its documentation for details.
  
  .. note::
      To return a batch of copies of the same tensor, use :func:`nvidia.dali.types.Constant`,
      which is more performant.
class_docstr_tok: ["ExternalSource","is","a","special","operator","that","can","provide","data","to","a","DALI","pipeline","from","Python","by","several","methods",".","The","simplest","and","preferred","way","is","to","specify","a","``","source","``",",","which","can","be","a","callable","or","iterable",".","..","note",":",":",":","meth",":","`","nvidia.dali.fn.external_source","`","operator","is","partially","compatible","with","TensorFlow","integration","via",":","meth",":","`","nvidia.dali.plugin.tf.experimental.DALIDatasetWithInputs","`",".","Please","refer","to","its","documentation","for","details",".","..","note",":",":","To","return","a","batch","of","copies","of","the","same","tensor",",","use",":","func",":","`","nvidia.dali.types.Constant","`",",","which","is","more","performant","."]
code: def __init__(
      self,
      source=None,
      num_outputs=None,
      *,
      cycle=None,
      layout=None,
      dtype=None,
      ndim=None,
      name=None,
      device="cpu",
      cuda_stream=None,
      use_copy_kernel=None,
      batch=None,
      parallel=None,
      no_copy=None,
      prefetch_queue_depth=None,
      bytes_per_sample_hint=None,
      batch_info=None,
      repeat_last=False,
      **kwargs,
  ):
      self._schema = _b.GetSchema("ExternalSource")
      self._spec = _b.OpSpec("ExternalSource")
      self._device = device
      self._layout = layout
      self._dtype = dtype
      self._ndim = ndim
      self._cuda_stream = cuda_stream
      self._use_copy_kernel = use_copy_kernel
  
      import nvidia.dali.ops
  
      kwargs, self._call_args = nvidia.dali.ops._separate_kwargs(kwargs)
  
      callback, source_desc = _get_callback_from_source(
          source, cycle, batch_info or False
      )
  
      if name is not None and num_outputs is not None:
          raise ValueError(
              "`num_outputs` is not compatible with named `ExternalSource`"
          )
  
      self._name = name
      self._num_outputs = num_outputs
      self._batch = batch
      self._callback = callback
      self._source_desc = source_desc
      self._parallel = parallel
      self._no_copy = no_copy
      self._prefetch_queue_depth = prefetch_queue_depth
      self._bytes_per_sample_hint = bytes_per_sample_hint
      self._batch_info = batch_info
      self._repeat_last = repeat_last
  
      self._spec.AddArg("device", device)
      self._spec.AddArg("repeat_last", repeat_last)
      for key, value in kwargs.items():
          self._spec.AddArg(key, value)
  
imports: from nvidia.dali import backend
  from nvidia.dali import tensors
  from nvidia.dali import types
  from nvidia.dali._multiproc.messages import TaskArgs, SampleRange
  import nvidia.dali.types
  from nvidia.dali._utils.external_source_impl import get_callback_from_source, accepted_arg_count, SourceKind
label_desc: Use image node_id 1 to create a new ExternalSource object  with example: obj = ExternalSource(source, num_outputs)