Refactor extension modules initialization (#2968)
Summary:
* Refactor _extension module so that
* the implementation of initialization logic and its execution are separated.
* logic goes to `_extension.utils`
* the execution is at `_extension.__init__`
* global variables are defined and modified in `__init__`.
* Replace `is_sox_available()` with `_extension._SOX_INITIALIZED`
* Replace `is_kaldi_available()` with `_extension._IS_KALDI_AVAILABLE`
* Move `requies_sox()` and `requires_kaldi()` to break the circular dependency among `_extension` and `_internal.module_utils`.
* Merge the sox-related initialization logic in `_extension.utils` module.
Pull Request resolved: https://github.com/pytorch/audio/pull/2968
Reviewed By: hwangjeff
Differential Revision: D42387251
Pulled By: mthrok
fbshipit-source-id: 0c3245dfab53f9bc1b8a83ec2622eb88ec96673f
Showing
Please register or sign in to comment