tensorflow / mesh
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 1,032 units with 16,737 lines of code in units (87.5% of code).
    • 1 very complex units (431 lines of code)
    • 11 complex units (1,564 lines of code)
    • 51 medium complex units (3,585 lines of code)
    • 112 simple units (3,524 lines of code)
    • 857 very simple units (7,633 lines of code)
2% | 9% | 21% | 21% | 45%
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
py2% | 9% | 21% | 21% | 45%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
mesh_tensorflow/transformer5% | 11% | 20% | 19% | 42%
mesh_tensorflow/bert0% | 18% | 31% | 16% | 33%
mesh_tensorflow0% | 2% | 10% | 27% | 59%
mesh_tensorflow/experimental0% | 0% | 33% | 18% | 48%
mesh_tensorflow/auto_mtf0% | 0% | 26% | 25% | 48%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def tpu_estimator_model_fn()
in mesh_tensorflow/transformer/utils.py
431 80 26
def convert_examples_to_features()
in mesh_tensorflow/bert/run_squad.py
134 41 7
def eval_model()
in mesh_tensorflow/transformer/utils.py
150 38 13
def _top_n_gating()
in mesh_tensorflow/transformer/moe.py
113 35 11
def write_predictions()
in mesh_tensorflow/bert/run_squad.py
147 34 9
def run()
in mesh_tensorflow/transformer/utils.py
202 32 21
def transformer_moe_layer_v1()
in mesh_tensorflow/transformer/heterogeneous_moe.py
204 31 12
def main()
in mesh_tensorflow/bert/run_classifier.py
150 31 1
def _top_2_gating()
in mesh_tensorflow/transformer/moe.py
136 28 11
def transformer_moe_layer_v1()
in mesh_tensorflow/transformer/moe.py
187 27 11
def convert_single_example()
in mesh_tensorflow/bert/run_classifier.py
62 27 5
def rewrite_stack_variables()
in mesh_tensorflow/ops.py
79 26 4
def _minimize_peak_memory_list()
in mesh_tensorflow/auto_mtf/scheduler.py
54 25 1
def transformer_moe_layer_v2()
in mesh_tensorflow/transformer/moe.py
107 23 9
def _switch_max_gating()
in mesh_tensorflow/transformer/moe.py
95 22 11
def _add_constraints()
in mesh_tensorflow/auto_mtf/layout_optimizer.py
58 21 1
def _expert_selection_gating()
in mesh_tensorflow/transformer/moe.py
81 21 13
def _switch_gating()
in mesh_tensorflow/transformer/moe.py
104 21 11
def get_final_text()
in mesh_tensorflow/bert/run_squad.py
50 21 3
def synthetic_attention()
in mesh_tensorflow/transformer/attention.py
142 20 15