tensorflow / tpu
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 2,519 units with 49,923 lines of code in units (64.8% of code).
    • 2 very complex units (606 lines of code)
    • 9 complex units (1,356 lines of code)
    • 127 medium complex units (9,992 lines of code)
    • 309 simple units (11,521 lines of code)
    • 2,072 very simple units (26,448 lines of code)
1% | 2% | 20% | 23% | 52%
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
py1% | 3% | 19% | 22% | 53%
c0% | <1% | 16% | 31% | 52%
go0% | 0% | 32% | 25% | 42%
h0% | 0% | 11% | 3% | 84%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
models/official1% | 2% | 19% | 24% | 51%
models/experimental0% | 5% | 22% | 13% | 59%
tools/driver0% | <1% | 16% | 29% | 54%
tools/ctpu0% | 0% | 32% | 25% | 42%
tools/datasets0% | 0% | 20% | 32% | 46%
models/hyperparameters0% | 0% | 17% | 18% | 64%
tools/data_converter0% | 0% | 6% | 6% | 86%
models/common0% | 0% | 0% | 29% | 70%
tools/diagnostics0% | 0% | 0% | 0% | 100%
tools/dataset_profiler0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main()
in models/official/retinanet/retinanet_main.py
395 67 1
def _model_fn()
in models/official/mask_rcnn/mask_rcnn_model.py
211 53 5
def build_model_fn()
in models/official/mnasnet/mnasnet_main.py
184 47 4
def resnet_model_fn()
in models/official/resnet/resnet_main.py
167 46 4
def model_fn()
in models/official/efficientnet/main.py
159 41 4
def __call__()
in models/official/detection/projects/vild/modeling/vild_head.py
176 38 3
static uint gasket_ioctl_check_permissions()
in tools/driver/drivers/gasket/gasket_ioctl.c
32 27 3
def build_model_graph()
in models/official/mask_rcnn/mask_rcnn_model.py
171 27 4
def inception_model_fn()
in models/experimental/inception/inception_v3.py
174 27 4
def batch_norm()
in models/official/amoeba_net/network_utils.py
129 26 13
def inception_model_fn()
in models/experimental/inception/inception_v4.py
164 26 4
func()
in tools/ctpu/commands/up.go
75 25 1
static ssize_t gasket_sysfs_data_show()
in tools/driver/drivers/gasket/gasket_core.c
112 24 3
def _model_fn()
in models/official/retinanet/retinanet_model.py
127 24 7
def resnet_generator()
in models/official/resnet/resnet_model.py
119 24 16
def inception_v2_base()
in models/experimental/inception/inception_v2_tpu_model.py
389 24 6
func()
in tools/ctpu/commands/auth.go
75 23 1
def main()
in models/official/efficientnet/main.py
170 23 1
def _parse_train_data()
in models/official/detection/dataloader/maskrcnn_parser_with_copy_paste.py
125 23 3
def _create_dataset_parser_fn()
in models/official/mask_rcnn/dataloader.py
152 23 2