This page compares the source lines of code (SLOC) of tensorflow/tensorflow and pytorch/pytorch using cached OctoCounts reports. Code size is not code quality: a larger count only means more source material, not a better or worse project.
As of 2026-09-07, tensorflow/tensorflow contains 6,771,326 total lines (5,078,399 code) across 24,114 files, while pytorch/pytorch contains 3,218,930 total lines (2,518,292 code) across 8,683 files as of 2026-09-10. tensorflow/tensorflow is about 2.0x the size of pytorch/pytorch by code lines. Code size is not code quality: a larger count only means more source material, not a better or worse project.
| Metric | tensorflow/tensorflow | pytorch/pytorch |
|---|---|---|
| Files | 24,114 | 8,683 |
| Total lines | 6,771,326 | 3,218,930 |
| Code lines | 5,078,399 | 2,518,292 |
| Comment lines | 949,226 | 333,792 |
| Blank lines | 743,701 | 366,846 |
| Languages counted | 12 | 12 |
Top languages in tensorflow/tensorflow: C++ (56.0% of code), Python (18.3% of code), C Header (10.5% of code). Top languages in pytorch/pytorch: Python (46.3% of code), C++ (26.2% of code), C Header (17.3% of code). C++, Python, C Header appear in both top language lists; Bazel, HTML appear only in tensorflow/tensorflow's top languages; CUDA, C appear only in pytorch/pytorch's top languages.
Methodology: both counts come from cached OctoCounts reports generated with tokei. tensorflow/tensorflow was counted at ref master (commit 01990a8ef1f8) on 2026-09-07; pytorch/pytorch was counted at ref main (commit cd96aa6ae455) on 2026-09-10. See the counting methodology for ignored directories and analysis options.
Evidence and next steps:
Note: code size is not code quality. OctoCounts only reports reproducible line counts and makes no claim that either project is better.
tensorflow/tensorflow has more code: 5,078,399 code lines versus 2,518,292 for pytorch/pytorch, about 2.0x as much, based on cached OctoCounts reports as of 2026-09-10.
Not necessarily. SLOC measures size, not complexity, quality, or maintainability. A larger codebase can mean more features, more generated or vendored code, more verbose language idioms, or more tests — none of which imply the code is harder to work with. Use SLOC to gauge the scale of what you'd be reading or maintaining, not as a quality signal for tensorflow/tensorflow, pytorch/pytorch, or any repository.
Methodology: both counts come from cached OctoCounts reports generated with tokei. tensorflow/tensorflow was counted at ref master (commit 01990a8ef1f8) on 2026-09-07; pytorch/pytorch was counted at ref main (commit cd96aa6ae455) on 2026-09-10. See the counting methodology for ignored directories and analysis options.
Yes. This page shows the default branch for each repository. Use the interactive comparison tool to pick any public GitHub repository, branch, tag, or commit SHA for both sides and get a fresh side-by-side report.