def _encoder_infer_all(
    dataset, ffcv_parameters: "FFCVParameters"
) -> Optional["FFCVEncodeDef"]:
    """
    Infer the encoder 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.
    :return: The encoder pipeline or None if it could not be inferred.
    """
    dataset_item = dataset[0]

    types = []

    # Try to infer the field type for each element
    for item in dataset_item:
        inferred_type = _ffcv_infer_encoder(item, ffcv_parameters)

        if inferred_type is None:
            return None

        types.append(inferred_type)

    # Type inferred for all fields
    # Let's apply a generic name and return the dictionary
    result = OrderedDict()
    for i, t in enumerate(types):
        result[f"field_{i}"] = t

    return result

    Infer the encoder 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.
    :return: The encoder pipeline or None if it could not be inferred.
    
avalanche/benchmarks/utils/ffcv_support/ffcv_support_internals.py