pytorch / functorch
Duplication

Places in code with 6 or more lines that are exactly the same.

Intro
  • For duplication, we look at places in code where there are 6 or more lines of code that are exactly the same.
  • Before duplication is calculated, the code is cleaned to remove empty lines, comments, and frequently duplicated constructs such as imports.
  • You should aim at having as little as possible (<5%) of duplicated code as high-level of duplication can lead to maintenance difficulties, poor factoring, and logical contradictions.
Learn more...
Duplication Overall
  • 6% duplication:
    • 10,687 cleaned lines of cleaned code (without empty lines, comments, and frequently duplicated constructs such as imports)
    • 707 duplicated lines
  • 60 duplicates
system6% (707 lines)
Duplication per Extension
cpp8% (503 lines)
py3% (138 lines)
h11% (66 lines)
Duplication per Component (primary)
functorch/csrc8% (569 lines)
benchmarks/transformer_fusion_patterns22% (60 lines)
notebooks/_src36% (56 lines)
functorch/_src<1% (22 lines)
op_analysis0% (0 lines)
codegen0% (0 lines)
ROOT0% (0 lines)
benchmarks0% (0 lines)
functorch/experimental0% (0 lines)
functorch0% (0 lines)
functorch/compile0% (0 lines)
Longest Duplicates
The list of 20 longest duplicates.
See data for all 60 duplicates...
Size#FoldersFilesLinesCode
21 x 2 notebooks/_src
notebooks/_src
plot_ensembling.py
plot_per_sample_gradients.py
23:46 (55%)
16:39 (36%)
view
20 x 2 functorch/csrc
functorch/csrc
BatchRulesScatterOps.cpp
BatchRulesScatterOps.cpp
135:156 (5%)
183:204 (5%)
view
19 x 2 benchmarks/transformer_fusion_patterns
benchmarks/transformer_fusion_patterns
benchmark.py
benchmark.py
22:40 (15%)
88:106 (15%)
view
17 x 2 functorch/csrc
functorch/csrc
CompileCache.cpp
PointwiseOperatorCompileCache.cpp
21:43 (11%)
45:68 (3%)
view
17 x 2 functorch/csrc
functorch/csrc
BatchRulesScatterOps.cpp
BatchRulesScatterOps.cpp
91:108 (4%)
135:152 (4%)
view
17 x 2 functorch/csrc
functorch/csrc
BatchRulesScatterOps.cpp
BatchRulesScatterOps.cpp
91:108 (4%)
183:200 (4%)
view
15 x 2 functorch/csrc
functorch/csrc
BatchRulesHelper.h
BatchRulesHelper.h
220:237 (5%)
270:287 (5%)
view
12 x 2 functorch/csrc
functorch/csrc
BatchedFallback.cpp
BatchedFallback.cpp
185:201 (5%)
360:376 (5%)
view
12 x 2 functorch/csrc
functorch/csrc
BatchRulesScatterOps.cpp
BatchRulesScatterOps.cpp
218:233 (3%)
335:350 (3%)
view
12 x 2 functorch/csrc
functorch/csrc
BatchedFallback.cpp
BatchedFallback.cpp
116:129 (5%)
312:325 (5%)
view
11 x 2 functorch/csrc
functorch/csrc
BatchedTensorImpl.cpp
BatchedTensorImpl.cpp
34:45 (11%)
66:77 (11%)
view
11 x 2 functorch/_src
functorch/_src
make_functional.py
make_functional.py
432:443 (6%)
453:464 (6%)
view
11 x 2 functorch/csrc
functorch/csrc
BatchRulesNorm.cpp
BatchRulesNorm.cpp
780:790 (1%)
796:806 (1%)
view
11 x 2 benchmarks/transformer_fusion_patterns
benchmarks/transformer_fusion_patterns
benchmark.py
bias_gelu_dropout.py
54:64 (9%)
30:43 (28%)
view
10 x 2 functorch/csrc
functorch/csrc
BatchRulesNorm.cpp
BatchRulesNorm.cpp
199:208 (1%)
716:725 (1%)
view
10 x 2 functorch/csrc
functorch/csrc
CompileCache.cpp
PointwiseOperatorCompileCache.cpp
51:77 (6%)
166:192 (2%)
view
10 x 2 functorch/csrc
functorch/csrc
BatchedFallback.cpp
BatchingRegistrations.cpp
244:254 (4%)
73:83 (2%)
view
10 x 2 functorch/csrc
functorch/csrc
BatchRulesNorm.cpp
BatchRulesNorm.cpp
223:232 (1%)
580:589 (1%)
view
10 x 2 functorch/csrc
functorch/csrc
BatchRulesHelper.h
BatchRulesReduceOps.cpp
111:123 (3%)
69:80 (4%)
view
9 x 2 functorch/csrc
functorch/csrc
BatchRulesNorm.cpp
BatchRulesNorm.cpp
223:231 (1%)
355:364 (1%)
view
Duplicated Units
The list of top 5 duplicated units.
See data for all 5 unit duplicates...
Size#FoldersFilesLinesCode
12 x 2 notebooks/_src
notebooks/_src
plot_per_sample_gradients.py
plot_ensembling.py
0:0 
0:0 
view
11 x 2 functorch/csrc
functorch/csrc
BatchedFallback.cpp
BatchingRegistrations.cpp
244:255 
73:84 
view
7 x 2 functorch/csrc
functorch/csrc
BatchRulesLoss.cpp
PyTorchOperatorHacks.cpp
70:77 
154:161 
view
7 x 2 functorch/csrc
functorch/csrc
CompileCache.cpp
PointwiseOperatorCompileCache.cpp
37:44 
62:69 
view
6 x 2 functorch/csrc
functorch/csrc
BatchRulesDynamic.cpp
BatchRulesDynamic.cpp
38:44 
46:52 
view