aws / aws-neuron-tensorflow
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 615 units with 10,612 lines of code in units (74.8% of code).
    • 11 very long units (2,096 lines of code)
    • 28 long units (1,768 lines of code)
    • 102 medium size units (3,278 lines of code)
    • 126 small units (1,873 lines of code)
    • 348 very small units (1,597 lines of code)
19% | 16% | 30% | 17% | 15%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
cc20% | 16% | 32% | 17% | 12%
py15% | 17% | 29% | 17% | 19%
h35% | 10% | 19% | 18% | 16%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
grappler/convert54% | 5% | 21% | 11% | 7%
grappler26% | 14% | 28% | 19% | 11%
python14% | 16% | 34% | 18% | 15%
runtime17% | 19% | 28% | 15% | 19%
python/hlo19% | 21% | 17% | 12% | 28%
runtime/kernels0% | 42% | 34% | 15% | 7%
runtime/direct0% | 14% | 46% | 28% | 10%
tf2hlo0% | 0% | 63% | 23% | 13%
runtime/ops0% | 0% | 100% | 0% | 0%
ROOT0% | 0% | 0% | 43% | 56%
api0% | 0% | 0% | 0% | 100%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
351 47 2
Status PropagateShapes()
in grappler/shape_inference.cc
247 67 4
tensorflow::Status ConvertSubGraphToNeuronNodeDef()
in grappler/convert/convert_graph.cc
239 34 1
Status SegmentGraph()
in grappler/convert/segment.cc
231 57 6
gtl::FlatSet AllowList()
in grappler/auto_mixed_precision_lists.h
230 9 0
def maybe_enable_dynamic_batch_size()
in python/hlo/optimize.py
173 51 1
def inference_graph_from_session()
in python/graph_util.py
160 62 20
def fuse()
in python/fuse.py
122 38 14
def compile_subgraphs()
in python/graph_util.py
121 41 6
Status CreateNeuronGraphDef()
in grappler/convert/convert_graph.cc
115 23 10
Status AutoMixedPrecisionImpl::Optimize()
in grappler/auto_mixed_precision.cc
107 18 0
def maybe_rewrite_batch_size()
in python/hlo/optimize.py
92 44 1
Status NeuronBatchSharder::Setup()
in runtime/direct/dynamic_batch.cc
85 18 2
72 18 1
Status GraphTypeTopologyView::InitializeFromGraph()
in grappler/auto_mixed_precision.cc
70 12 2
def convert_to_inference_model()
in python/saved_model.py
69 23 13
def inline_shape_inputs_in_subgraphs()
in python/graph_def_util.py
69 25 1
void Compute()
in runtime/kernels/maxpooling_op.cc
68 10 1
void Compute()
in runtime/kernels/avgpooling_op.cc
68 10 1
static void same_padding_new_num_rows_and_cols()
in runtime/kernels/pooling_utils.h
68 19 15