lm_polygraph.utils.common module
- lm_polygraph.utils.common.flatten_results(results, result_generator_class)[source]
Flattens a list of lists into a single list. Сan be used with any type of result, such as UEs, statistics, or generation metrics.
- Args:
- results: A list of lists, where each sublist contains results for a single input.
Expected shape: [num_inputs, num_token_level_results_per_input].
- result_generator_class: The class of the object that generated the results.
Used for error reporting.
- Returns:
A flattened list of results of shape [num_inputs * num_token_level_results_per_input].
- Raises:
Exception: If the input is not a list of lists.