facebookresearch / pytorchvideo
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 720 units with 5,941 lines of code in units (38.7% of code).
    • 1 very long units (186 lines of code)
    • 7 long units (491 lines of code)
    • 41 medium size units (1,212 lines of code)
    • 111 small units (1,630 lines of code)
    • 560 very small units (2,422 lines of code)
3% | 8% | 20% | 27% | 40%
Legend:
101+
51-100
21-50
11-20
1-10
Unit Size per Extension
101+
51-100
21-50
11-20
1-10
py3% | 7% | 20% | 27% | 41%
js0% | 62% | 0% | 23% | 13%
Unit Size per Logical Component
primary logical decomposition
101+
51-100
21-50
11-20
1-10
pytorchvideo/layers21% | 0% | 10% | 25% | 42%
pytorchvideo/models0% | 18% | 28% | 27% | 26%
pytorchvideo/data0% | 8% | 22% | 26% | 42%
tutorials/video_classification_example0% | 22% | 21% | 35% | 20%
website/website0% | 62% | 0% | 23% | 13%
pytorchvideo_trainer/pytorchvideo_trainer0% | 0% | 17% | 36% | 46%
pytorchvideo/accelerator0% | 0% | 76% | 0% | 23%
pytorchvideo/transforms0% | 0% | 5% | 17% | 76%
pytorchvideo/neural_engine0% | 0% | 17% | 10% | 72%
projects/video_nerf0% | 0% | 0% | 77% | 22%
tutorials/video_detection_example0% | 0% | 0% | 21% | 78%
ROOT0% | 0% | 0% | 78% | 21%
Alternative Visuals
Longest Units
Top 20 longest units
Unit# linesMcCabe index# params
def forward()
in pytorchvideo/layers/accelerator/mobile_cpu/conv_helper.py
186 8 2
def __next__()
in pytorchvideo/data/labeled_video_dataset.py
85 30 1
def create_module()
in pytorchvideo/models/audio_visual_slowfast.py
78 13 3
def create_audio_visual_slowfast()
in pytorchvideo/models/audio_visual_slowfast.py
74 1 3
def create_slowfast_with_roi_head()
in pytorchvideo/models/slowfast.py
71 1 3
def create_slowfast()
in pytorchvideo/models/slowfast.py
68 1 3
def main()
in tutorials/video_classification_example/train.py
64 3 0
render()
in website/website/pages/en/index.js
51 3 0
def create_resnet_with_roi_head()
in pytorchvideo/models/resnet.py
49 1 11
def create_resnet()
in pytorchvideo/models/resnet.py
46 1 11
def create_r2plus1d()
in pytorchvideo/models/r2plus1d.py
45 1 13
def transmute_Conv3dTemporalKernel1BnAct()
in pytorchvideo/accelerator/deployment/mobile_cpu/transmuter/transmuter_mobile_cpu.py
39 14 1
def __next__()
in pytorchvideo/data/charades.py
39 10 1
def _step()
in pytorchvideo_trainer/pytorchvideo_trainer/module/video_classification.py
37 7 4
def add_video_frames()
in pytorchvideo/data/epic_kitchen/utils.py
36 8 2
def _get_dataloader()
in pytorchvideo_trainer/pytorchvideo_trainer/datamodule/datamodule.py
36 5 2
def _audio_transform()
in tutorials/video_classification_example/train.py
35 1 1
def create_acoustic_resnet()
in pytorchvideo/models/resnet.py
35 1 11
def convert()
in pytorchvideo/layers/accelerator/mobile_cpu/attention.py
33 4 3
def create_multiscale_vision_transformers()
in pytorchvideo/models/vision_transformers.py
33 1 13