tensorflow / benchmarks
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 641 units with 9,244 lines of code in units (84.9% of code).
    • 2 very complex units (532 lines of code)
    • 2 complex units (188 lines of code)
    • 24 medium complex units (1,249 lines of code)
    • 67 simple units (1,848 lines of code)
    • 546 very simple units (5,427 lines of code)
5% | 2% | 13% | 19% | 58%
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
py5% | 2% | 13% | 19% | 58%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
scripts/tf_cnn_benchmarks10% | 3% | 13% | 25% | 46%
scripts/tf_cnn_benchmarks/models/tf1_only0% | 0% | 24% | 8% | 67%
perfzero/lib/perfzero0% | 0% | 18% | 20% | 61%
scripts/tf_cnn_benchmarks/models0% | 0% | 0% | 17% | 82%
perfzero/dockertest0% | 0% | 0% | 41% | 58%
perfzero/scripts0% | 0% | 0% | 100% | 0%
perfzero/lib0% | 0% | 0% | 4% | 95%
scripts/tf_cnn_benchmarks/models/experimental0% | 0% | 0% | 5% | 94%
scripts/tf_cnn_benchmarks/platforms/default0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def __init__()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
337 92 4
def benchmark_with_session()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
195 59 9
def benchmark_one_step()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
98 36 15
def _benchmark_graph()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
90 30 3
def _build_nasnet_base()
in scripts/tf_cnn_benchmarks/models/tf1_only/nasnet_model.py
82 24 8
def conv()
in scripts/tf_cnn_benchmarks/convnet_builder.py
91 20 14
def expanded_conv()
in scripts/tf_cnn_benchmarks/models/tf1_only/mobilenet_conv_blocks.py
90 19 3
def create_config_proto()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
60 18 1
def _eval_once()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
69 18 7
def _build_graph()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
50 18 1
def postprocess()
in scripts/tf_cnn_benchmarks/models/tf1_only/ssd_model.py
77 18 2
def sum_gradients_all_reduce()
in scripts/tf_cnn_benchmarks/allreduce.py
52 17 10
def batch_all_reduce()
in scripts/tf_cnn_benchmarks/batch_allreduce.py
56 15 6
def get_learning_rate()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
45 14 5
def inception_module()
in scripts/tf_cnn_benchmarks/convnet_builder.py
37 13 5
def preprocess_device_grads()
in scripts/tf_cnn_benchmarks/variable_mgr.py
21 13 2
def validate_params()
in scripts/tf_cnn_benchmarks/benchmark_cnn.py
18 12 1
def aggregate_indexed_slices_gradients()
in scripts/tf_cnn_benchmarks/variable_mgr_util.py
16 12 1
def get_post_init_ops()
in scripts/tf_cnn_benchmarks/variable_mgr.py
38 12 1
def sum_grad_and_var_all_reduce()
in scripts/tf_cnn_benchmarks/allreduce.py
43 12 7