tensorflow / model-optimization
Unit Size

The distribution of size of units (measured in lines of code).

Intro
  • Unit size measurements show the distribution of size of units of code (methods, functions...).
  • Units are classified in four categories based on their size (lines of code): 1-20 (small units), 20-50 (medium size units), 51-100 (long units), 101+ (very long units).
  • You should aim at keeping units small (< 20 lines). Long units may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
Unit Size Overall
  • There are 867 units with 7,544 lines of code in units (80.7% of code).
    • 1 very long units (153 lines of code)
    • 18 long units (1,110 lines of code)
    • 61 medium size units (1,787 lines of code)
    • 109 small units (1,618 lines of code)
    • 678 very small units (2,876 lines of code)
2% | 14% | 23% | 21% | 38%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py2% | 14% | 23% | 21% | 38%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
tensorflow_model_optimization/python/core/internal8% | 9% | 16% | 24% | 40%
tensorflow_model_optimization/python/core/quantization0% | 19% | 18% | 17% | 44%
tensorflow_model_optimization/python/core/clustering0% | 23% | 26% | 23% | 27%
tensorflow_model_optimization/python/core/sparsity0% | 10% | 46% | 16% | 26%
tensorflow_model_optimization/python/core/common0% | 0% | 26% | 41% | 31%
tensorflow_model_optimization/g3doc/tools0% | 0% | 100% | 0% | 0%
tensorflow_model_optimization0% | 0% | 100% | 0% | 0%
tensorflow_model_optimization/python/core/keras0% | 0% | 0% | 54% | 45%
ROOT0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def from_encoder()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/core/gather_encoder.py
153 17 3
def quantize_apply()
in tensorflow_model_optimization/python/core/quantization/keras/quantize.py
100 37 2
def replacement()
in tensorflow_model_optimization/python/core/quantization/keras/experimental/default_n_bit/default_n_bit_transforms.py
73 7 2
def replacement()
in tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_transforms.py
71 7 2
def build()
in tensorflow_model_optimization/python/core/clustering/keras/cluster_wrapper.py
64 12 2
def MovingAvgQuantize()
in tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py
63 11 10
def __init__()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/core/simple_encoder.py
61 9 3
def _cmwc_random_sequence()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/utils/tf_utils.py
60 14 2
def LastValueQuantize()
in tensorflow_model_optimization/python/core/quantization/keras/quant_ops.py
60 11 9
def __init__()
in tensorflow_model_optimization/python/core/clustering/keras/cluster_wrapper.py
59 16 8
def _replace_functional()
in tensorflow_model_optimization/python/core/quantization/keras/graph_transformations/model_transformer.py
59 27 3
def prune_low_magnitude()
in tensorflow_model_optimization/python/core/sparsity/keras/prune.py
57 17 3
def replacement()
in tensorflow_model_optimization/python/core/quantization/keras/experimental/default_n_bit/default_n_bit_transforms.py
57 5 2
def replacement()
in tensorflow_model_optimization/python/core/quantization/keras/default_8bit/default_8bit_transforms.py
57 5 2
def _build_clusters()
in tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/cluster_preserve/cluster_preserve_quantize_registry.py
56 6 3
def fast_walsh_hadamard_transform()
in tensorflow_model_optimization/python/core/internal/tensor_encoding/utils/tf_utils.py
54 6 1
def _cluster_weights()
in tensorflow_model_optimization/python/core/clustering/keras/cluster.py
54 14 6
def apply()
in tensorflow_model_optimization/python/core/quantization/keras/experimental/default_n_bit/default_n_bit_quantize_layout_transform.py
54 1 3
def _check_layer_support()
in tensorflow_model_optimization/python/core/sparsity/keras/pruning_policy.py
51 36 2
def strip_clustering_cqat()
in tensorflow_model_optimization/python/core/quantization/keras/collaborative_optimizations/cluster_preserve/cluster_utils.py
49 19 1