afe.core.mixed_precision.ranking

Functions to work with node rankings for mixed precision search.

Functions

rank_int16_nodes(→ list[list[afe.ir.defines.NodeName]])

Rank nodes by their sensitivity.

annotate_int16_nodes(→ None)

Annotate nodes in the list so that they will be quantized with int16 precision.

count_int16_nodes(→ tuple[int, int])

Count the number of SiMa IR nodes where the output type is int16.

Module Contents

afe.core.mixed_precision.ranking.rank_int16_nodes(analysis_result: dict[afe.ir.defines.NodeName, float]) list[list[afe.ir.defines.NodeName]][source]

Rank nodes by their sensitivity.

Parameters:

analysis_result – Estimated sensitivity of nodes. Larger values indicate greater sensitivity. Noise metrics such as MSE can be used as sensitivity. The reciprocal of PSNR can be used as sensitivity.

Returns:

Sets of node names ordered from high sensitivity to low sensitivity. Nodes in the same set have equal sensitivity.

afe.core.mixed_precision.ranking.annotate_int16_nodes(net: afe.ir.net.AwesomeNet, node_names: Set[afe.ir.defines.NodeName]) None[source]

Annotate nodes in the list so that they will be quantized with int16 precision.

Parameters:
  • net – Net to annotate

  • node_names – Nodes to be given int16 precision.

afe.core.mixed_precision.ranking.count_int16_nodes(net: afe.ir.net.AwesomeNet) tuple[int, int][source]

Count the number of SiMa IR nodes where the output type is int16. Only SiMaIR nodes (representing single operators) are counted.

Parameters:

net – Network to analyze

Returns:

Number of int16 SiMaIR nodes and total number of SiMaIR nodes