apple / ml-quant
Conditional Complexity

The distribution of complexity of units (measured with McCabe index).

Intro
  • Conditional complexity (also called cyclomatic complexity) is a term used to measure the complexity of software. The term refers to the number of possible paths through a program function. A higher value ofter means higher maintenance and testing costs (infosecinstitute.com).
  • Conditional complexity is calculated by counting all conditions in the program that can affect the execution path (e.g. if statement, loops, switches, and/or operators, try and catch blocks...).
  • Conditional complexity is measured at the unit level (methods, functions...).
  • Units are classified in four categories based on the measured McCabe index: 1-5 (simple units), 6-10 (medium complex units), 11-25 (complex units), 26+ (very complex units).
Learn more...
Conditional Complexity Overall
  • There are 128 units with 875 lines of code in units (46.7% of code).
    • 0 very complex units (0 lines of code)
    • 0 complex units (0 lines of code)
    • 1 medium complex units (18 lines of code)
    • 3 simple units (58 lines of code)
    • 124 very simple units (799 lines of code)
0% | 0% | 2% | 6% | 91%
Legend:
51+
26-50
11-25
6-10
1-5
Alternative Visuals
Conditional Complexity per Extension
51+
26-50
11-25
6-10
1-5
py0% | 0% | 2% | 6% | 91%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
quant/binary0% | 0% | 7% | 9% | 83%
quant/utils0% | 0% | 0% | 18% | 81%
quant/common0% | 0% | 0% | 6% | 93%
quant/data0% | 0% | 0% | 0% | 100%
quant/models0% | 0% | 0% | 0% | 100%
quant0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def compute_mask()
in quant/binary/optimal.py
18 12 2
def parse_common_fields()
in quant/common/parser.py
17 8 2
def hook()
in quant/utils/visualization.py
19 8 10
def forward()
in quant/binary/activation_quantization.py
22 7 2
def update()
in quant/common/metrics.py
16 5 5
def _validate_args()
in quant/common/parser.py
5 5 1
def get_path_to_checkpoint()
in quant/utils/checkpoints.py
16 5 2
def forward()
in quant/binary/weight_quantization.py
9 4 2
def parse_config()
in quant/common/parser.py
14 4 3
def _validate_scheme()
in quant/binary/binary_conv.py
3 3 1
def _get_w_quantizer()
in quant/binary/binary_conv.py
14 3 2
def opt_v1()
in quant/binary/optimal.py
15 3 3
def _get_best_gpus()
in quant/common/initialization.py
6 3 1
def forward()
in quant/models/resnet.py
10 3 2
def forward()
in quant/utils/moving_average.py
11 3 2
def cost_function()
in quant/binary/optimal.py
9 2 3
def forward()
in quant/binary/weight_quantization.py
7 2 2
def forward()
in quant/binary/weight_quantization.py
8 2 3
def forward()
in quant/binary/weight_quantization.py
7 2 3
def __init__()
in quant/binary/weight_quantization.py
5 2 3