apple / ml-quant
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 128 units with 875 lines of code in units (46.7% of code).
    • 0 very long units (0 lines of code)
    • 0 long units (0 lines of code)
    • 6 medium size units (138 lines of code)
    • 22 small units (306 lines of code)
    • 100 very small units (431 lines of code)
0% | 0% | 15% | 34% | 49%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 0% | 15% | 34% | 49%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
quant/data0% | 0% | 44% | 31% | 23%
quant/common0% | 0% | 10% | 27% | 61%
quant/binary0% | 0% | 9% | 29% | 61%
quant/utils0% | 0% | 0% | 55% | 44%
quant/models0% | 0% | 0% | 59% | 40%
quant0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def get_base_argument_parser()
in quant/common/parser.py
26 1 1
def get_train_loader()
in quant/data/data_loaders.py
23 1 1
def get_train_loader()
in quant/data/data_loaders.py
23 1 1
def forward()
in quant/binary/activation_quantization.py
22 7 2
def get_train_loader()
in quant/data/data_loaders.py
22 1 1
def get_test_loader()
in quant/data/data_loaders.py
22 1 1
def get_test_loader()
in quant/data/data_loaders.py
19 1 1
def get_test_loader()
in quant/data/data_loaders.py
19 1 1
def hook()
in quant/utils/visualization.py
19 8 10
def compute_mask()
in quant/binary/optimal.py
18 12 2
def parse_common_fields()
in quant/common/parser.py
17 8 2
def update()
in quant/common/metrics.py
16 5 5
def get_path_to_checkpoint()
in quant/utils/checkpoints.py
16 5 2
def opt_v1()
in quant/binary/optimal.py
15 3 3
def _get_w_quantizer()
in quant/binary/binary_conv.py
14 3 2
def parse_config()
in quant/common/parser.py
14 4 3
def __init__()
in quant/models/resnet.py
14 1 0
def get_test_loader()
in quant/data/data_loaders.py
13 1 1
def forward()
in quant/binary/binary_conv.py
12 1 2
def get_train_loader()
in quant/data/data_loaders.py
12 1 1