code: def _ffcv_infer_decoder(
      value,
      ffcv_parameters: "FFCVParameters",
      encoder: Optional["Field"] = None,
      add_common_collate: bool = True,
  ) -> Optional[List["Operation"]]:
      """
      Infers the field decoder definition from a given example.
  
      :param value: The example obtained from the dataset.
      :param ffcv_parameters: The additional parameters passed
          to the :func:`enable_ffcv` function.
      :param encoder: If not None, will try to infer the decoder
          definition from the field.
      :param add_common_collate: If True, will apply a PyTorch-alike
          collate to int and float fields so that they end up being
          a flat PyTorch tensor instead of a list of int/float.
      :return: The decoder pipeline as a list of :class:`Operation`
          or None if the decoder pipeline cannot be inferred.
      """
      from ffcv.transforms import ToTensor, Squeeze
  
      if encoder is not None:
          if isinstance(encoder, TorchTensorField):
              return [NDArrayDecoder(), ToTensor()]
  
          encoder_class = encoder.get_decoder_class()
          pipeline: List["Operation"] = [encoder_class()]
          if add_common_collate and encoder_class in [
              IntDecoder,
              FloatDecoder,
          ]:
              pipeline.extend((ToTensor(), Squeeze()))
          return pipeline
  
      if isinstance(value, int):
          pipeline: List["Operation"] = [IntDecoder()]
  
          if add_common_collate:
              pipeline.extend((ToTensor(), Squeeze()))
          return pipeline
  
      if isinstance(value, float):
          pipeline: List["Operation"] = [FloatDecoder()]
  
          if add_common_collate:
              pipeline.extend((ToTensor(), Squeeze()))
          return pipeline
  
      if isinstance(value, np.ndarray):
          return [NDArrayDecoder()]
  
      if isinstance(value, Tensor):
          return [NDArrayDecoder(), ToTensor()]
  
      if isinstance(value, Image):
          return [SimpleRGBImageDecoder()]
  
      return None
  
file_path: avalanche/avalanche/benchmarks/utils/ffcv_support/ffcv_support_internals.py
imports: from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Sequence, Union
  from collections import OrderedDict
  import numpy
  from torch import Tensor
  from PIL.Image import Image
  from ffcv.fields import TorchTensorField
  from ffcv.fields.decoders import IntDecoder, FloatDecoder, NDArrayDecoder, SimpleRGBImageDecoder
label_desc: Use image node_id 3 for calling a global function with example usage: _ffcv_infer_decoder(value, ffcv_parameters, encoder, add_common_collate) and returns: None, pipeline, pipeline, pipeline, list, list, list, list