tensorflow / tensor2tensor
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 5,348 units with 63,280 lines of code in units (85.9% of code).
    • 0 very complex units (0 lines of code)
    • 26 complex units (3,373 lines of code)
    • 147 medium complex units (9,474 lines of code)
    • 349 simple units (11,523 lines of code)
    • 4,826 very simple units (38,910 lines of code)
0% | 5% | 14% | 18% | 61%
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
py0% | 5% | 15% | 18% | 61%
cc0% | 0% | 43% | 4% | 52%
js0% | 0% | 0% | 24% | 75%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tensor2tensor/models0% | 6% | 11% | 18% | 63%
tensor2tensor/utils0% | 12% | 23% | 20% | 44%
tensor2tensor/layers0% | 4% | 20% | 21% | 53%
tensor2tensor/data_generators0% | 2% | 13% | 14% | 69%
tensor2tensor/insights0% | 7% | 0% | 28% | 64%
tensor2tensor/rl0% | 0% | 14% | 10% | 74%
tensor2tensor/envs0% | 0% | 9% | 13% | 76%
tensor2tensor/visualization0% | 0% | 0% | 19% | 80%
tensor2tensor/serving0% | 0% | 0% | 28% | 71%
tensor2tensor0% | 0% | 0% | 0% | 100%
tensor2tensor/metrics0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def _slow_greedy_infer()
in tensor2tensor/utils/t2t_model.py
126 42 3
def multihead_attention()
in tensor2tensor/layers/common_attention.py
232 40 39
def _fast_decode()
in tensor2tensor/models/transformer.py
177 38 7
def input_fn()
in tensor2tensor/utils/data_reader.py
173 35 13
def compile_data()
in tensor2tensor/data_generators/translate.py
92 34 4
def _slow_greedy_infer_tpu()
in tensor2tensor/utils/t2t_model.py
114 34 3
def body_sharded()
in tensor2tensor/models/research/aligned.py
154 34 2
def estimator_model_fn()
in tensor2tensor/utils/t2t_model.py
80 33 9
def body_sharded()
in tensor2tensor/models/research/attention_lm_moe.py
211 33 2
def ae_transformer_internal()
in tensor2tensor/models/research/transformer_vae.py
180 32 6
def data_parallelism()
in tensor2tensor/utils/devices.py
97 31 13
def get_name()
in tensor2tensor/layers/modalities.py
83 29 2
def decode_from_file()
in tensor2tensor/utils/decoding.py
152 29 6
def next_frame()
in tensor2tensor/models/video/basic_deterministic.py
122 29 7
def evolved_transformer_decoder()
in tensor2tensor/models/evolved_transformer.py
283 29 12
def preprocess()
in tensor2tensor/data_generators/video_utils.py
76 28 5
def body()
in tensor2tensor/models/research/autoencoders.py
165 28 2
def multihead_attention()
in tensor2tensor/layers/vqa_layers.py
157 27 29
def fast_match_sequences()
in tensor2tensor/data_generators/wiki_revision_utils.py
58 27 8
def build_from_token_counts()
in tensor2tensor/data_generators/text_encoder.py
70 27 6