tensorflow / model-optimization
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 867 units with 7,544 lines of code in units (80.7% of code).
    • 0 very complex units (0 lines of code)
    • 3 complex units (210 lines of code)
    • 17 medium complex units (864 lines of code)
    • 52 simple units (1,339 lines of code)
    • 795 very simple units (5,131 lines of code)
0% | 2% | 11% | 17% | 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
py0% | 2% | 11% | 17% | 68%
Conditional Complexity per Logical Component
primary logical decomposition
51+
26-50
11-25
6-10
1-5
tensorflow_model_optimization/python/core/quantization0% | 4% | 7% | 19% | 68%
tensorflow_model_optimization/python/core/sparsity0% | 4% | 9% | 27% | 58%
tensorflow_model_optimization/python/core/internal0% | 0% | 14% | 11% | 74%
tensorflow_model_optimization/python/core/clustering0% | 0% | 27% | 24% | 47%
tensorflow_model_optimization/python/core/common0% | 0% | 8% | 3% | 87%
tensorflow_model_optimization/python/core/keras0% | 0% | 0% | 26% | 73%
tensorflow_model_optimization/g3doc/tools0% | 0% | 0% | 0% | 100%
tensorflow_model_optimization0% | 0% | 0% | 0% | 100%
ROOT0% | 0% | 0% | 0% | 100%
Most Complex Units
Top 20 most complex units
Unit# linesMcCabe index# params
def quantize_apply()
in tensorflow_model_optimization/python/core/quantization/keras/quantize.py
100 37 2
def _check_layer_support()
in tensorflow_model_optimization/python/core/sparsity/keras/pruning_policy.py
51 36 2
def _replace_functional()
in tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py
59 27 3
def strip_clustering_cqat()
in tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/cluster_preserve/cluster_utils.py
49 19 1
def create_layer_for_training()
in tensorflow_model_optimization/python/core/common/keras/compression/internal/optimize.py
32 18 2
def transform()
in tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py
44 18 1
def prune_low_magnitude()
in tensorflow_model_optimization/python/core/sparsity/keras/prune.py
57 17 3
def from_encoder()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py
153 17 3
def __init__()
in tensorflow_model_optimization/python/core/clustering/keras/cluster_wrapper.py
59 16 8
def _cmwc_random_sequence()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/utils/tf_utils.py
60 14 2
def _cluster_weights()
in tensorflow_model_optimization/python/core/clustering/keras/cluster.py
54 14 6
def merge_dicts()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/utils/py_utils.py
21 12 2
def _map_to_training_weights()
in tensorflow_model_optimization/python/core/common/keras/compression/internal/optimize.py
18 12 3
def build()
in tensorflow_model_optimization/python/core/clustering/keras/cluster_wrapper.py
64 12 2
def _match_layer_with_inputs()
in tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py
26 12 4
def __new__()
in tensorflow_model_optimization/python/core/sparsity/keras/estimator_utils.py
38 11 5
def __init__()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/stages/research/kashin.py
29 11 6
def make_clusterable()
in tensorflow_model_optimization/python/core/clustering/keras/clustering_registry.py
37 11 2
def LastValueQuantize()
in tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py
60 11 9
def MovingAvgQuantize()
in tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py
63 11 10