code: def InferenceDataLoader(
      dataset: Dataset,
      *,
      transform: Transformation = Identity(),
      batch_size: int,
      stack_fn: Callable,
  ):
      """
      Construct an iterator of batches for inference purposes.
  
      Parameters
      ----------
      dataset
          Data to iterate over.
      transform
          Transformation to be lazily applied as data is being iterated.
          The transformation is applied in "inference mode" (``is_train=False``).
      batch_size
          Number of entries to include in a batch.
      stack_fn
          Function to use to stack data entries into batches.
          This can be used to set a specific array type or computing device
          the arrays should end up onto (CPU, GPU).
  
      Returns
      -------
      Iterable[DataBatch]
          An iterable sequence of batches.
      """
      transform += Batch(batch_size=batch_size) + AdhocTransform(
          stack_fn
      )
      return transform.apply(dataset, is_train=False)
  
file_path: gluonts/src/gluonts/dataset/loader.py
imports: import logging
  from typing import Callable, Iterable, Optional
  import numpy
  from gluonts.dataset import DataBatch, Dataset
  from gluonts.itertools import Cyclic, IterableSlice, PseudoShuffled, batcher, rows_to_columns
  from gluonts.pydantic import BaseModel
  from gluonts.transform import AdhocTransform, Identity, SelectFields, Transformation, Valmap
label_desc: Use image node_id 4 for calling a global function with example usage: InferenceDataLoader(dataset) and returns: transform