tensorflow / kfac
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 799 units with 6,373 lines of code in units (90.0% of code).
    • 2 very long units (251 lines of code)
    • 12 long units (737 lines of code)
    • 61 medium size units (1,851 lines of code)
    • 84 small units (1,210 lines of code)
    • 640 very small units (2,324 lines of code)
3% | 11% | 29% | 18% | 36%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 11% | 29% | 18% | 36%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
kfac/python/ops2% | 9% | 30% | 18% | 39%
kfac/python/ops/tensormatch17% | 11% | 17% | 22% | 31%
kfac/python/keras0% | 32% | 28% | 23% | 15%
kfac/python/ops/kfac_utils0% | 0% | 41% | 18% | 40%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def __init__()
in kfac/python/ops/optimizer.py
135 18 34
def register_records()
in kfac/python/ops/tensormatch/graph_search.py
116 8 4
def register_subgraph_layers()
in kfac/python/ops/tensormatch/graph_search.py
79 31 4
def __init__()
in kfac/python/ops/layer_collection.py
72 2 3
def __init__()
in kfac/python/keras/optimizers.py
64 15 14
def _compute_raw_update_steps()
in kfac/python/ops/optimizer.py
61 18 2
def get_layer_collection()
in kfac/python/keras/utils.py
61 9 6
def set_global_constants()
in kfac/python/ops/fisher_factors.py
60 16 15
def register_conv2d()
in kfac/python/ops/layer_collection.py
59 6 13
def register_scale_and_shift()
in kfac/python/ops/layer_collection.py
59 15 6
def _compute_new_cov()
in kfac/python/ops/fisher_factors.py
59 18 3
def get_matpower()
in kfac/python/ops/fisher_factors.py
57 9 3
def _process_data()
in kfac/python/ops/fisher_blocks.py
54 31 2
def register_layer()
in kfac/python/keras/utils.py
52 31 4
def _compute_qmodel_hyperparams()
in kfac/python/ops/optimizer.py
50 13 5
def make_inverse_update_ops()
in kfac/python/ops/fisher_factors.py
49 11 1
def instantiate_inv_variables()
in kfac/python/ops/fisher_factors.py
49 2 1
def __init__()
in kfac/python/ops/estimator.py
45 3 6
def _register_block()
in kfac/python/ops/layer_collection.py
44 16 4
def _compute_qmodel()
in kfac/python/ops/optimizer.py
42 5 4