def _decoder_infer_all(
    dataset,
    ffcv_parameters: "FFCVParameters",
    encoder_dictionary: Optional["FFCVEncodeDef"] = None,
) -> Optional["FFCVDecodeDef"]:
    """
    Infer the decoder pipeline from the dataset.

    :param dataset: The dataset to use. Must have at least
        one example.
    :param ffcv_parameters: The additional parameters passed
        to the :func:`enable_ffcv` function.
    :param encoder_dictionary: If not None, will be used as a
        basis to create the decoder pipeline.
    :return: The decoder pipeline or None if it could not be inferred.
    """
    dataset_item: Sequence[Any] = dataset[0]

    types: List[List["Operation"]] = []

    encoder_hints: List[Optional["Field"]] = []
    field_names: List[str]

    if encoder_dictionary is None:
        encoder_hints = [None] * len(dataset_item)
        field_names = [f"field_{i}" for i in range(len(dataset_item))]
    else:
        if len(encoder_dictionary) != len(dataset_item):
            raise ValueError("Wrong number of elements in encoder dictionary.")

        encoder_hints.extend(encoder_dictionary.values())
        field_names = list(encoder_dictionary.keys())

    # Try to infer the field type for each element
    for item, field_encoder in zip(dataset_item, encoder_hints):
        inferred_type = _ffcv_infer_decoder(
            item, ffcv_parameters, encoder=field_encoder
        )

        if inferred_type is None:
            return None

        types.append(inferred_type)

    # Type inferred for all fields
    # Let's apply the name and return the dictionary
    result = OrderedDict()
    for t, field_name in zip(types, field_names):
        result[field_name] = t

    return result

    Infer the decoder pipeline from the dataset.

    :param dataset: The dataset to use. Must have at least
        one example.
    :param ffcv_parameters: The additional parameters passed
        to the :func:`enable_ffcv` function.
    :param encoder_dictionary: If not None, will be used as a
        basis to create the decoder pipeline.
    :return: The decoder pipeline or None if it could not be inferred.
    
avalanche/benchmarks/utils/ffcv_support/ffcv_support_internals.py