pytorch / examples
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 325 units with 3,752 lines of code in units (66.7% of code).
    • 0 very complex units (0 lines of code)
    • 1 complex units (110 lines of code)
    • 3 medium complex units (155 lines of code)
    • 22 simple units (703 lines of code)
    • 299 very simple units (2,784 lines of code)
0% | 2% | 4% | 18% | 74%
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% | 3% | 3% | 17% | 74%
cpp0% | 0% | 6% | 21% | 71%
h0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
imagenet0% | 42% | 0% | 31% | 25%
fx0% | 0% | 18% | 7% | 73%
distributed0% | 0% | 4% | 20% | 74%
cpp0% | 0% | 0% | 23% | 76%
fast_neural_style0% | 0% | 0% | 38% | 61%
mnist0% | 0% | 0% | 50% | 49%
reinforcement_learning0% | 0% | 0% | 18% | 81%
word_language_model0% | 0% | 0% | 0% | 100%
snli0% | 0% | 0% | 0% | 100%
super_resolution0% | 0% | 0% | 0% | 100%
vae0% | 0% | 0% | 0% | 100%
dcgan0% | 0% | 0% | 0% | 100%
mnist_hogwild0% | 0% | 0% | 0% | 100%
time_sequence_prediction0% | 0% | 0% | 0% | 100%
regression0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def main_worker()
in imagenet/main.py
110 31 3
def nnc_compile()
in fx/nnc_compile.py
53 17 2
at::Tensor __call__()
in fx/native_interpreter/interpreter.cpp
56 13 1
def run_worker()
in distributed/rpc/ddp_rpc/main.py
46 12 2
def _run_trainer()
in distributed/rpc/ddp_rpc/main.py
34 9 2
def train()
in fast_neural_style/neural_style/neural_style.py
71 9 1
def run_episode()
in distributed/rpc/batch/reinforce.py
21 8 2
def finish_episode()
in distributed/rpc/rl/main.py
24 8 1
def gen_binary_nnc()
in fx/nnc_compile.py
30 8 1
def run_episode()
in distributed/rpc/batch/reinforce.py
25 7 3
def __init__()
in fast_neural_style/neural_style/vgg.py
18 7 2
int main()
in cpp/distributed/dist-mnist.cpp
78 7 2
int main()
in cpp/dcgan/dcgan.cpp
101 7 2
def main()
in imagenet/main.py
23 7 0
def train()
in imagenet/main.py
31 7 6
def main()
in mnist/main.py
53 6 0
def spmd_main()
in distributed/ddp/example.py
26 6 2
def __init__()
in distributed/rpc/batch/reinforce.py
17 6 3
def __init__()
in distributed/rpc/parameter_server/rpc_parameter_server.py
16 6 2
def run_parameter_server()
in distributed/rpc/parameter_server/rpc_parameter_server.py
6 6 2