facebookresearch / AttentiveNAS
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 244 units with 2,288 lines of code in units (72.5% of code).
    • 0 very long units (0 lines of code)
    • 3 long units (209 lines of code)
    • 24 medium size units (706 lines of code)
    • 40 small units (570 lines of code)
    • 177 very small units (803 lines of code)
0% | 9% | 30% | 24% | 35%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py0% | 9% | 30% | 24% | 35%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
models0% | 20% | 31% | 33% | 15%
ROOT0% | 58% | 0% | 26% | 14%
solver0% | 33% | 19% | 0% | 47%
models/modules0% | 0% | 28% | 32% | 39%
data0% | 0% | 49% | 10% | 39%
utils0% | 0% | 32% | 25% | 42%
sampler0% | 0% | 53% | 0% | 46%
evaluate0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in models/attentive_nas_dynamic_model.py
88 14 5
def main_worker()
in train_attentive_nas.py
70 12 3
def build_lr_scheduler()
in solver/build.py
51 9 2
def compute_active_subnet_flops()
in models/attentive_nas_dynamic_model.py
46 10 1
def profile()
in utils/flops_counter.py
42 11 5
def __init__()
in models/modules/static_layers.py
39 4 10
37 6 1
def get_active_subnet()
in models/attentive_nas_dynamic_model.py
34 5 2
def __init__()
in models/modules/dynamic_layers.py
34 3 9
def get_active_subnet()
in models/modules/dynamic_layers.py
34 4 3
def create_model()
in models/model_factory.py
34 4 2
def __init__()
in data/auto_augment_tf.py
31 21 5
def auto_augment_policy_v0()
in data/auto_augment_tf.py
30 3 1
def auto_augment_policy_original()
in data/auto_augment_tf.py
30 3 1
def build_optimizer()
in solver/build.py
29 6 2
def rotate()
in data/auto_augment_tf.py
28 3 3
def get_parameters()
in models/modules/nn_base.py
27 17 4
def forward()
in models/modules/dynamic_ops.py
27 4 2
def load_checkpoints()
in utils/saver.py
25 11 5
def get_active_filter()
in models/modules/dynamic_ops.py
25 5 3