def to_samples(inputs: List[Any], targets: Optional[List[Any]] = None) -> List[Dict[str, Any]]:
    """Package a list of inputs and, optionally, a list of targets in a list of dictionaries (samples).

    Args:
        inputs: The list of inputs to package as dictionaries.
        targets: Optionally provide a list of targets to also be included in the samples.

    Returns:
        A list of sample dictionaries.

    """
    if targets is None:
        return [to_sample(input) for input in inputs]
    return [to_sample(input) for input in zip(inputs, targets)]
Package a list of inputs and, optionally, a list of targets in a list of dictionaries (samples).

    Args:
        inputs: The list of inputs to package as dictionaries.
        targets: Optionally provide a list of targets to also be included in the samples.

    Returns:
        A list of sample dictionaries.

    
src/flash/core/data/utilities/samples.py