I’m pretty sure the hierarchy is for encapsulating certain functions.
For example, with torch.nn.modules.module, folder modules contains module.py which in itself contains a Module class.
Feel free to check out the repository as it provides much better context as to why the functions are organized in the manner they are: https://github.com/pytorch/pytorch/tree/master/torch/nn/modules 1