Refactoring PyTorch project structure

Hi all,
Each time when I look at pytorch code organization , each time it is pain for me …

PyTorch source code organized in such way that it intermix source code folder, test folder and some scripts. Such structure make navigation in code much harder. It makes harder to understand what are packages, what are examples, what are tests.

I would suggest refactoring of code structure in following way src/, tests/, tools/, samples/ (maven, gradle and other conventions) and etc. structure that much easier to navigate

Lets take a look for example how it is done in openvino, this source code layout is almost ideal, because it decrease cognitive pressure on reader

1 Like

Hey!

Thanks for the feedback.
I think a lot of the current layout is more an artefact of the history of the project rather than any global organization.
I think the main folders are here properly: high level libs that form pytorch: torch, aten, c10, torchgen, tools, functorch. Dependencies in third_party. Tests in test. Documentation in docs. Everything else can be ignored for most devs.

We do need a lot of these other things for mobile builds, the many CI builds, source building, github features. While these are not important for most people, they are required for the wide range of users we have.

Not to say that it cannot be improved, just that it is a lot of work for β€œjust” shuffling things around.

1 Like

If you refer to this rule Structuring Your Project β€” The Hitchhiker's Guide to Python, I think this rule mostly apply to single package repository, but for multi-package repository, it makes it much harder to read