tensorflow / models
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 9,329 units with 175,682 lines of code in units (80.5% of code).
    • 133 very long units (19,721 lines of code)
    • 577 long units (39,149 lines of code)
    • 1,999 medium size units (63,797 lines of code)
    • 2,071 small units (30,809 lines of code)
    • 4,549 very small units (22,206 lines of code)
11% | 22% | 36% | 17% | 12%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py11% | 22% | 36% | 17% | 12%
cc7% | 17% | 44% | 17% | 12%
h0% | 0% | 0% | 0% | 100%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
research/object_detection17% | 22% | 35% | 13% | 10%
official/nlp13% | 20% | 37% | 18% | 10%
official/legacy11% | 25% | 31% | 18% | 12%
official/vision5% | 26% | 37% | 17% | 12%
research/slim20% | 12% | 43% | 14% | 8%
research/deeplab17% | 31% | 34% | 10% | 7%
research/efficient-hrl20% | 12% | 34% | 15% | 17%
official/projects3% | 26% | 40% | 18% | 10%
research/lstm_object_detection13% | 21% | 42% | 14% | 7%
official/recommendation21% | 10% | 38% | 14% | 16%
research/delf9% | 32% | 24% | 22% | 10%
official/utils37% | 8% | 14% | 17% | 21%
research/vid2depth6% | 23% | 27% | 24% | 18%
research/autoaugment11% | 13% | 33% | 16% | 25%
research/seq_flow_lite3% | 8% | 45% | 21% | 21%
research/lfads5% | 40% | 24% | 15% | 14%
research/pcl_rl4% | 22% | 34% | 23% | 15%
research/cognitive_planning0% | 10% | 49% | 22% | 17%
official/core0% | 15% | 21% | 31% | 31%
research/attention_ocr0% | 15% | 33% | 28% | 23%
research/deep_speech0% | 33% | 24% | 19% | 21%
official/modeling0% | 8% | 30% | 31% | 29%
research/rebar0% | 15% | 29% | 28% | 25%
research/cvt_text0% | 12% | 35% | 19% | 33%
research/adversarial_text0% | 8% | 41% | 27% | 22%
official/common0% | 34% | 39% | 14% | 11%
research/audioset0% | 0% | 65% | 14% | 19%
orbit0% | 0% | 28% | 43% | 28%
orbit/utils0% | 0% | 14% | 27% | 58%
orbit/actions0% | 0% | 0% | 23% | 76%
official/pip_package0% | 0% | 0% | 100% | 0%
research/marco0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def inception_v2_base()
in research/slim/nets/inception_v2.py
363 30 8
def train_uvf()
in research/efficient-hrl/train.py
352 27 49
def inception_v3_base()
in research/slim/nets/inception_v3.py
298 23 5
def convert_examples_to_features()
in official/nlp/data/squad_lib_sp.py
289 82 10
def __init__()
in research/object_detection/data_decoders/tf_example_decoder.py
281 20 15
def run_customized_training_loop()
in official/legacy/bert/model_training_utils.py
275 12 23
def build_encoder()
in official/nlp/configs/encoders.py
273 15 4
def draw_bbox()
in research/object_detection/utils/colab_utils.py
272 4 2
def build()
in research/object_detection/builders/preprocessor_builder.py
266 87 1
def s3dg_base()
in research/slim/nets/s3dg.py
265 40 9
def main()
in research/delf/delf/python/training/train.py
255 50 1
def convert_examples_to_features()
in official/nlp/xlnet/squad_utils.py
247 72 8
def create_model_fn()
in research/object_detection/model_lib.py
241 57 5
def get_default_func_arg_map()
in research/object_detection/core/preprocessor.py
229 10 9
def batch_multiclass_non_max_suppression()
in research/object_detection/core/post_processing.py
225 39 22
def _build_faster_rcnn_model()
in research/object_detection/builders/model_builder.py
223 19 3
def vgg16()
in official/legacy/image_classification/vgg/vgg_model.py
209 2 5
def inception_v1_base()
in research/slim/nets/inception_v1.py
200 18 4
def create_tf_example()
in research/object_detection/dataset_tools/create_coco_tf_record.py
192 29 9
def define_performance()
in official/utils/flags/_performance.py
185 22 16