pytorch / pytorch
File Size

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

Intro
  • File size measurements show the distribution of size of files.
  • Files are classified in four categories based on their size (lines of code): 1-100 (very small files), 101-200 (small files), 201-500 (medium size files), 501-1000 (long files), 1001+(very long files).
  • It is a good practice to keep files small. Long files may become "bloaters", code that have increased to such gargantuan proportions that they are hard to work with.
Learn more...
File Size Overall
  • There are 6,667 files with 1,190,840 lines of code.
    • 146 very long files (341,906 lines of code)
    • 348 long files (238,854 lines of code)
    • 975 medium size files (303,055 lines of codeclsfd_ftr_w_mp_ins)
    • 1,080 small files (153,861 lines of code)
    • 4,118 very small files (153,164 lines of code)
28% | 20% | 25% | 12% | 12%
Legend:
1001+
501-1000
201-500
101-200
1-100


explore: zoomable circles | sunburst | 3D view
File Size per Extension
1001+
501-1000
201-500
101-200
1-100
cpp37% | 22% | 24% | 8% | 6%
py26% | 18% | 25% | 14% | 15%
h19% | 15% | 25% | 16% | 22%
cc19% | 21% | 26% | 17% | 15%
hpp87% | 2% | 4% | 1% | 3%
yaml98% | 0% | 0% | 0% | 1%
cu10% | 31% | 34% | 13% | 9%
c22% | 30% | 24% | 14% | 8%
cmake33% | 10% | 28% | 7% | 20%
cuh23% | 7% | 48% | 13% | 6%
pb100% | 0% | 0% | 0% | 0%
mm33% | 7% | 19% | 19% | 19%
bzl81% | 0% | 0% | 0% | 18%
metal100% | 0% | 0% | 0% | 0%
S0% | 51% | 47% | 0% | <1%
in0% | 54% | 11% | 16% | 18%
pyi0% | 24% | 13% | 27% | 34%
js0% | 100% | 0% | 0% | 0%
java0% | 0% | 83% | 0% | 16%
proto0% | 0% | 59% | 0% | 40%
glsl0% | 0% | 0% | 11% | 88%
yy0% | 0% | 0% | 100% | 0%
html0% | 0% | 0% | 85% | 14%
rb0% | 0% | 0% | 56% | 43%
css0% | 0% | 0% | 0% | 100%
ll0% | 0% | 0% | 0% | 100%
m0% | 0% | 0% | 0% | 100%
pt0% | 0% | 0% | 0% | 100%
ps10% | 0% | 0% | 0% | 100%
toml0% | 0% | 0% | 0% | 100%
lds0% | 0% | 0% | 0% | 100%
File Size per Logical Decomposition
primary
1001+
501-1000
201-500
101-200
1-100
torch28% | 22% | 24% | 11% | 12%
aten33% | 21% | 25% | 10% | 8%
caffe226% | 17% | 24% | 15% | 15%
c1028% | 15% | 26% | 16% | 14%
tools27% | 11% | 25% | 18% | 16%
cmake32% | 10% | 27% | 9% | 19%
benchmarks0% | 6% | 47% | 26% | 19%
ROOT0% | 86% | 0% | 0% | 13%
binaries0% | 14% | 39% | 23% | 22%
android0% | 23% | 46% | 21% | 8%
modules0% | 0% | 18% | 36% | 44%
scripts0% | 0% | 24% | 52% | 23%
ios0% | 0% | 0% | 40% | 59%
mypy_plugins0% | 0% | 0% | 0% | 100%
Longest Files (Top 50)
File# lines# units
SobolEngineOpsUtils.cpp
in aten/src/ATen/native
42413 -
vk_mem_alloc.h
in aten/src/ATen/native/vulkan/api
12820 484
common_methods_invocations.py
in torch/testing/_internal
12259 383
cl.hpp
in caffe2/contrib/opencl/OpenCL
10263 215
cl.hpp
in caffe2/mobile/contrib/libopencl-stub/include/CL
9959 208
native_functions.yaml
in aten/src/ATen/native
8466 -
cuda_to_hip_mappings.py
in torch/utils/hipify
8181 -
common_nn.py
in torch/testing/_internal
5816 118
vulkan.h
in caffe2/mobile/contrib/libvulkan-stub/include/vulkan
5488 -
ir_emitter.cpp
in torch/csrc/jit/frontend
4328 122
external_functions_codegen.cpp
in torch/csrc/jit/tensorexpr
3297 155
FunctionsManual.cpp
in torch/csrc/autograd
3181 188
cc
embedding_lookup_idx_avx2.cc
in caffe2/perfkernels
2972 18
QuantizedOpKernels.cpp
in aten/src/ATen/native/quantized/cpu/kernels
2972 25
cc
embedding_lookup_fused_8bit_rowwise_idx_avx2.cc
in caffe2/perfkernels
2968 18
register_prim_ops.cpp
in torch/csrc/jit/runtime
2958 23
cc
embedding_lookup_avx2.cc
in caffe2/perfkernels
2912 18
cc
embedding_lookup_fused_8bit_rowwise_avx2.cc
in caffe2/perfkernels
2902 18
BatchLinearAlgebra.cpp
in aten/src/ATen/native
2819 116
cu
math_gpu.cu
in caffe2/utils
2801 -
functional.py
in torch/nn
2645 118
BatchLinearAlgebra.cpp
in aten/src/ATen/native/cuda
2525 102
loopnest.cpp
in torch/csrc/jit/tensorexpr
2502 134
parser.cpp
in torch/csrc/jit/codegen/cuda
2466 54
cc
math_cpu.cc
in caffe2/utils
2441 65
symbolic_opset9.py
in torch/onnx
2371 260
pb
concat_elim_test_net.pb
in caffe2/opt/custom
2367 -
mobile_bytecode_generated.h
in torch/csrc/jit/serialization
2339 241
ops.cpp
in torch/csrc/jit/runtime/static
2339 41
variant.h
in c10/util
2317 93
LinearAlgebra.cpp
in aten/src/ATen/native
2281 91
ProcessGroupGloo.cpp
in torch/csrc/distributed/c10d
2263 104
mpscnn.mm
in caffe2/mobile/contrib/ios/mpscnn
2213 38
ir_simplifier.cpp
in torch/csrc/jit/tensorexpr
2198 67
cu
pool_op.cu
in caffe2/operators
2151 -
fusion_segmenter.cpp
in torch/csrc/jit/codegen/cuda
2148 72
index_compute.cpp
in torch/csrc/jit/codegen/cuda
2108 37
vec256_zarch.h
in aten/src/ATen/cpu/vec/vec256/zarch
2070 81
order_preserving_flat_hash_map.h
in c10/util
2068 302
common_utils.py
in torch/testing/_internal
2066 162
TensorShape.cpp
in aten/src/ATen/native
2064 123
shape_type_inference.cpp
in torch/csrc/jit/passes/onnx
2036 50
flat_hash_map.h
in c10/util
2001 294
script_init.cpp
in torch/csrc/jit/python
1978 40
ir.cpp
in torch/csrc/jit/ir
1885 87
optimizer.py
in caffe2/python
1845 79
cmake
FindCUDA.cmake
in cmake/Modules_CUDA_fix/upstream
1839 -
shape_analysis.cpp
in torch/csrc/jit/passes
1821 15
cmake
Dependencies.cmake
in cmake
1814 -
libopencl.c
in caffe2/mobile/contrib/libopencl-stub/src
1810 4
Files With Most Units (Top 20)
File# lines# units
vk_mem_alloc.h
in aten/src/ATen/native/vulkan/api
12820 484
common_methods_invocations.py
in torch/testing/_internal
12259 383
order_preserving_flat_hash_map.h
in c10/util
2068 302
flat_hash_map.h
in c10/util
2001 294
symbolic_opset9.py
in torch/onnx
2371 260
mobile_bytecode_generated.h
in torch/csrc/jit/serialization
2339 241
cl.hpp
in caffe2/contrib/opencl/OpenCL
10263 215
cl.hpp
in caffe2/mobile/contrib/libopencl-stub/include/CL
9959 208
ivalue_inl.h
in aten/src/ATen/core
1803 206
common_quantization.py
in torch/testing/_internal
1664 202
FunctionsManual.cpp
in torch/csrc/autograd
3181 188
tree_views.h
in torch/csrc/jit/frontend
1021 188
jit_type.h
in aten/src/ATen/core
1616 181
kernel_ir.h
in torch/csrc/jit/codegen/cuda
1221 179
common_utils.py
in torch/testing/_internal
2066 162
external_functions_codegen.cpp
in torch/csrc/jit/tensorexpr
3297 155
transforms.py
in torch/distributions
708 136
loopnest.cpp
in torch/csrc/jit/tensorexpr
2502 134
TensorShape.cpp
in aten/src/ATen/native
2064 123
ir_emitter.cpp
in torch/csrc/jit/frontend
4328 122
Files With Long Lines (Top 20)

There are 774 files with lines longer than 120 characters. In total, there are 6052 long lines.

File# lines# units# long lines
native_functions.yaml
in aten/src/ATen/native
8466 - 521
pb
concat_elim_test_net.pb
in caffe2/opt/custom
2367 - 470
vulkan.h
in caffe2/mobile/contrib/libvulkan-stub/include/vulkan
5488 - 233
derivatives.yaml
in tools/autograd
1722 - 212
libvulkan-stub.c
in caffe2/mobile/contrib/libvulkan-stub/src
515 11 145
autocast_mode.cpp
in aten/src/ATen
590 20 142
BatchLinearAlgebra.cpp
in aten/src/ATen/native
2819 116 133
library.cpp
in aten/src/ATen/native/quantized
190 - 119
cuh
Math.cuh
in aten/src/ATen/native/cuda
1509 - 105
vk_mem_alloc.h
in aten/src/ATen/native/vulkan/api
12820 484 105
Math.h
in aten/src/ATen/native
1620 30 100
ForeachOpsKernels.cpp
in aten/src/ATen/native
214 2 75
mobile_bytecode_generated.h
in torch/csrc/jit/serialization
2339 241 70
common_methods_invocations.py
in torch/testing/_internal
12259 383 65
FunctionsManual.h
in torch/csrc/autograd
440 2 52
cu
LossCTC.cu
in aten/src/ATen/native/cuda
702 - 46
cu
ForeachPointwiseOp.cu
in aten/src/ATen/native/cuda
172 - 44
FunctionsManual.cpp
in torch/csrc/autograd
3181 188 43
cu
DistanceKernel.cu
in aten/src/ATen/native/cuda
339 - 42
BatchLinearAlgebra.cpp
in aten/src/ATen/native/cuda
2525 102 41