aws-samples / sagemaker-distributed-training-pytorch-kr
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 62 units with 1,334 lines of code in units (85.1% of code).
    • 3 very long units (392 lines of code)
    • 2 long units (161 lines of code)
    • 13 medium size units (395 lines of code)
    • 16 small units (227 lines of code)
    • 28 very small units (159 lines of code)
29% | 12% | 29% | 17% | 11%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py29% | 12% | 29% | 17% | 11%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
train_code70% | 0% | 11% | 16% | 2%
src_dir15% | 19% | 33% | 15% | 15%
util0% | 0% | 58% | 26% | 14%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def main()
in distributed_training/train_code/pytorch_mnist_smdp.py
135 13 0
def train()
in distributed_training/src_dir/main_trainer.py
130 27 2
def main()
in distributed_training/train_code/pytorch_mnist.py
127 9 0
def args_fn()
in distributed_training/src_dir/main_trainer.py
98 3 0
def validate()
in distributed_training/src_dir/main_trainer.py
63 8 6
def smp_savemodel()
in distributed_training/src_dir/dis_util.py
48 7 4
def _get_train_data_loader()
in distributed_training/src_dir/main_trainer.py
42 2 2
def plot_roc_curve_multiclass()
in distributed_training/util/inference_utils.py
41 9 6
def plot_pr_curve_multiclass()
in distributed_training/util/inference_utils.py
37 8 6
def dist_setting()
in distributed_training/src_dir/dis_util.py
33 5 1
def dist_init()
in distributed_training/src_dir/dis_util.py
32 11 2
def _loader_file()
in distributed_training/src_dir/main_trainer.py
26 9 2
def sync_s3_checkpoints_to_local()
in distributed_training/src_dir/util.py
25 8 3
def torch_model()
in distributed_training/src_dir/util.py
24 10 5
def _get_test_data_loader()
in distributed_training/src_dir/main_trainer.py
23 2 2
def sync_local_checkpoints_to_s3()
in distributed_training/src_dir/util.py
22 7 3
def train()
in distributed_training/train_code/pytorch_mnist.py
21 5 6
def train()
in distributed_training/train_code/pytorch_mnist_smdp.py
21 5 6
def dist_model()
in distributed_training/src_dir/dis_util.py
20 17 2
def init_modelhistory()
in distributed_training/src_dir/util.py
19 1 1