mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/69415 Adding the imports inside the torch/ao/__init__.py has a high chance of causing circular dependencies, especially if sparsity and quantization use each other's resources. To avoid the dependency issues, we can just keep the __init__ empty. Notes: - This means that the user will have to explicitly import the `torch.ao.quantization` or `torch.ao.sparsity` instead of `from torch import ao; ao.quantization.???`. - The issue of circular dependencies that are caused by the imports with binding submodules is [fixed in Python 3.7](https://docs.python.org/3/whatsnew/3.7.html#other-language-changes), which means this solution will become obsolete at the [3.6's EoL](https://www.python.org/dev/peps/pep-0494/#and-beyond-schedule), which comes [12/23/2022](https://devguide.python.org/#status-of-python-branches). Future options to resolve the circular dependencies (subject to discussion): 1. Use interfaces for binding submodules. For example, have a torch/ao/_nn with all the source code, and an interface torch/ao/nn with only the __init__.py file. The __init__ files inside the torch/ao/_nn will be empty 2. Completely isolate the common code into a separate submodule, s.a. torch/ao/common. The other submodules will not be referencing each other. Test Plan: Imported from OSS Reviewed By: vkuzo Differential Revision: D32860168 Pulled By: z-a-f fbshipit-source-id: e3fe77e285992d34c87d8742e1a5e449ce417c36
0 lines
Python
0 lines
Python