pytorch / pytorch
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 46,530 units with 640,723 lines of code in units (53.8% of code).
    • 68 very complex units (27,650 lines of code)
    • 212 complex units (32,966 lines of code)
    • 1,602 medium complex units (115,295 lines of code)
    • 3,509 simple units (115,759 lines of code)
    • 41,139 very simple units (349,053 lines of code)
4% | 5% | 17% | 18% | 54%
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
cc14% | 6% | 18% | 18% | 41%
cpp4% | 6% | 17% | 18% | 53%
py1% | 3% | 16% | 20% | 59%
h<1% | 3% | 12% | 15% | 68%
c2% | 7% | 66% | 11% | 12%
mm0% | 0% | 16% | 25% | 58%
js0% | 0% | 32% | 5% | 61%
hpp0% | 0% | <1% | 20% | 78%
java0% | 0% | 0% | 8% | 91%
pyi0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
caffe28% | 5% | 17% | 18% | 49%
torch3% | 6% | 17% | 18% | 54%
aten2% | 3% | 22% | 17% | 54%
tools3% | 4% | 12% | 23% | 55%
c10<1% | 4% | 4% | 11% | 79%
android0% | 16% | 12% | 3% | 67%
ROOT0% | 29% | 15% | 32% | 22%
benchmarks0% | <1% | 7% | 10% | 82%
binaries0% | 0% | 26% | 30% | 42%
modules0% | 0% | 12% | 23% | 63%
scripts0% | 0% | 0% | 26% | 73%
ios0% | 0% | 0% | 0% | 100%
mypy_plugins0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
throw propagation_error()
in torch/csrc/jit/passes/shape_analysis.cpp
1660 362 0
void do_avg_pool_nhwc_on_AVX_n()
in aten/src/ATen/native/quantized/cpu/kernels/QuantizedOpKernels.cpp
1871 180 16
VkBool32 vulkanSymbolWrapperLoadCoreSymbols()
in caffe2/mobile/contrib/libvulkan-stub/src/libvulkan-stub.c
137 134 1
void PropagateOnNode()
in torch/csrc/jit/codegen/cuda/type_inference.cpp
376 127 1
VkBool32 vulkanSymbolWrapperLoadCoreDeviceSymbols()
in caffe2/mobile/contrib/libvulkan-stub/src/libvulkan-stub.c
124 121 1
void handleBlock()
in torch/csrc/jit/passes/autocast.cpp
188 118 2
bool removableGuard()
in torch/csrc/jit/passes/guard_elimination.cpp
149 110 1
cc
bool BatchMatMulDNNLowPOp::RunOnDevice()
in caffe2/quantization/server/batch_matmul_dnnlowp_op.cc
557 103 0
static void registerJitOperator()
in torch/csrc/jit/codegen/cuda/parser.cpp
1489 101 0
void AliasDb::analyzeImpl()
in torch/csrc/jit/ir/alias_analysis.cpp
243 92 1
def _recover_record_by_prefix()
in caffe2/python/core.py
231 90 2
cc
void VideoDecoder::decodeLoop()
in caffe2/video/video_decoder.cc
411 87 5
cc
bool CudnnConvGradientOp::DoRunWithType()
in caffe2/operators/conv_op_cudnn.cc
512 87 0
void ComputeConstant()
in torch/csrc/jit/passes/onnx/shape_type_inference.cpp
305 83 2
def interpolate()
in torch/nn/functional.py
155 83 7
void loopnestRandomization()
in torch/csrc/jit/tensorexpr/loopnest_randomization.cpp
491 80 2
IValue toIValue()
in torch/csrc/jit/python/pybind_utils.cpp
296 76 3
270 74 5
def emit_body()
in tools/autograd/gen_variable_type.py
421 72 1
bool runImpl()
in torch/csrc/jit/runtime/interpreter.cpp
439 71 1