Postprocessing Functions¶
Module: polygraphy.comparator
-
class
PostprocessFunc
[source]¶ Bases:
object
Provides functions that can apply post-processing to IterationResult s.
-
static
topk_func
(k=10, axis=-1)[source]¶ Creates a function that applies a Top-K operation to a IterationResult. Top-K will return the indices of the k largest values in the array.
- Parameters
k (Union[int, Dict[str, int]]) – The number of indices to keep. If this exceeds the axis length, it will be clamped. This can be specified on a per-output basis by provided a dictionary. In that case, use an empty string (“”) as the key to specify default top-k value for outputs not explicitly listed. Defaults to 10.
axis (int) – The axis along which to apply the topk. Defaults to -1.
- Returns
The top-k function.
- Return type
Callable(IterationResult) -> IterationResult
-
static