pytorch / vision
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,596 units with 26,526 lines of code in units (51.6% of code).
    • 1 very complex units (293 lines of code)
    • 7 complex units (924 lines of code)
    • 52 medium complex units (2,866 lines of code)
    • 149 simple units (4,397 lines of code)
    • 2,387 very simple units (18,046 lines of code)
1% | 3% | 10% | 16% | 68%
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% | 6% | 12% | 76%
cpp0% | 4% | 19% | 25% | 50%
h0% | 0% | 52% | 0% | 47%
m0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
ROOT80% | 0% | 12% | 0% | 7%
torchvision/csrc0% | 3% | 21% | 24% | 50%
references/video_classification0% | 33% | 0% | 10% | 56%
references/classification0% | 15% | 17% | 18% | 49%
references/segmentation0% | 18% | 0% | 11% | 69%
references/detection0% | 9% | 10% | 18% | 61%
torchvision/transforms0% | 3% | 11% | 15% | 70%
torchvision/models0% | 0% | 2% | 8% | 88%
torchvision/datasets0% | 0% | 4% | 19% | 76%
references/optical_flow0% | 0% | 18% | 23% | 58%
torchvision/prototype0% | 0% | 3% | 5% | 90%
packaging/wheel0% | 0% | 44% | 31% | 24%
torchvision/ops0% | 0% | 4% | 3% | 92%
references/similarity0% | 0% | 0% | 28% | 71%
torchvision0% | 0% | 0% | 33% | 66%
torchvision/io0% | 0% | 0% | 11% | 88%
gallery0% | 0% | 0% | 19% | 80%
scripts/release_notes0% | 0% | 0% | 9% | 90%
scripts0% | 0% | 0% | 0% | 100%
ios/VisionTestApp0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
293 72 0
def main()
in references/classification/train.py
160 42 1
def to_pil_image()
in torchvision/transforms/functional.py
61 41 2
torch::Tensor decode_png()
in torchvision/csrc/io/image/cpu/decode_png.cpp
175 39 3
def main()
in references/video_classification/train.py
169 34 1
bool Decoder::init()
in torchvision/csrc/io/decoder/decoder.cpp
151 31 3
def main()
in references/segmentation/train.py
113 28 1
def main()
in references/detection/train.py
95 26 1
def main()
in references/classification/train_quantization.py
113 24 1
int Decoder::getFrame()
in torchvision/csrc/io/decoder/decoder.cpp
87 23 1
def forward()
in torchvision/models/detection/retinanet.py
60 23 3
def gaussian_blur()
in torchvision/transforms/functional.py
34 22 3
def _coco_remove_images_without_annotations()
in references/detection/coco_utils.py
27 20 2
def pad()
in torchvision/transforms/functional_tensor.py
48 19 4
inline bool serializeItem()
in torchvision/csrc/io/decoder/util.cpp
57 18 4
inline bool deserializeItem()
in torchvision/csrc/io/decoder/util.cpp
62 18 4
void setFormatDimensions()
in torchvision/csrc/io/decoder/util.cpp
64 18 9
torch::List readVideo()
in torchvision/csrc/io/video_reader/video_reader.cpp
210 18 21
def handle_legacy_interface()
in torchvision/prototype/models/_utils.py
45 18 5
def box_convert()
in torchvision/ops/boxes.py
25 17 3