tensorflow / swift-apis
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,816 units with 17,739 lines of code in units (19.4% of code).
    • 1 very complex units (134 lines of code)
    • 2 complex units (184 lines of code)
    • 40 medium complex units (1,847 lines of code)
    • 46 simple units (1,623 lines of code)
    • 1,727 very simple units (13,951 lines of code)
<1% | 1% | 10% | 9% | 78%
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
py11% | 11% | 42% | 6% | 27%
swift0% | 1% | 4% | 9% | 85%
cpp0% | 0% | 13% | 9% | 77%
cc0% | 0% | 5% | 14% | 79%
h0% | 0% | 6% | <1% | 92%
inc0% | 0% | 0% | 0% | 100%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
Sources/x101% | 1% | 12% | 10% | 74%
Sources/TensorFlow0% | 1% | 13% | 4% | 80%
Sources/Tensor0% | 0% | 0% | 91% | 8%
Sources/CX100% | 0% | 0% | 2% | 97%
Utilities/ReferenceImplementations0% | 0% | 0% | 0% | 100%
Utilities0% | 0% | 0% | 0% | 100%
Sources/CX10Modules0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def c_function_define()
in Sources/x10/swift_bindings/generate_ops.py
134 57 1
def node_type_define()
in Sources/x10/swift_bindings/generate_ops.py
135 47 1
func execute()
in Sources/TensorFlow/Core/LazyTensorOperation.swift
49 26 0
def canonicalize_op()
in Sources/x10/swift_bindings/generate_ops.py
73 24 1
def swift_wrapper_define()
in Sources/x10/swift_bindings/generate_ops.py
66 22 1
xla::PrimitiveType GetDevicePrimitiveType()
in Sources/x10/xla_tensor/tensor_util.cpp
35 18 2
def _swift_dispatch_body()
in Sources/TensorFlow/Bindings/generate_wrappers.py
37 17 2
def __init__()
in Sources/TensorFlow/Bindings/generate_wrappers.py
44 17 3
def swift_default()
in Sources/TensorFlow/Bindings/generate_wrappers.py
32 17 1
xla::PrimitiveType XlaHelpers::PromoteType()
in Sources/x10/xla_tensor/helpers.cpp
42 17 2
def generic_constraints()
in Sources/TensorFlow/Bindings/generate_wrappers.py
33 16 2
def main()
in Sources/TensorFlow/Bindings/generate_wrappers.py
81 16 1
at::ScalarType TensorTypeFromXlaType()
in Sources/x10/xla_tensor/tensor_util.cpp
29 16 1
static xla::Literal ScalarLiteral()
in Sources/x10/xla_tensor/helpers.h
39 16 2
xla::XlaOp CreateMatMul()
in Sources/x10/xla_tensor/xla_lower_util.cpp
41 16 2
tensorflow::DataType XrtComputationClient::XlaTypeToDataType()
in Sources/x10/xla_client/xrt_computation_client.cc
39 16 1
NodePtr ARange()
in Sources/x10/xla_tensor/ops/ops.cpp
62 15 4
XlaOpVector Scalar::Lower()
in Sources/x10/xla_tensor/ops/scalar.cpp
56 15 1
xla::XlaOp ConvertTo()
in Sources/x10/xla_tensor/convert_ops.cpp
33 15 4
def _swift_documentation()
in Sources/TensorFlow/Bindings/generate_wrappers.py
37 14 1