• moto's avatar
    Fix backward compatibility layer in backend module (#3595) · 931598c1
    moto authored
    Summary:
    The PR https://github.com/pytorch/audio/issues/3549 re-organized the backend implementations and deprecated the direct access to torchaudio.backend.
    
    The change was supposed to be BC-compatible while issuing a warning to users, but the implementation of module-level `__getattr__` was not quite right.
    
    See an issue https://github.com/pyannote/pyannote-audio/pull/1456.
    
    This commit fixes it so that the following imports work;
    
    ```python
    from torchaudio.backend.common import AudioMetaData
    
    from torchaudio.backend import sox_io_backend
    from torchaudio.backend.sox_io_backend import save, load, info
    
    from torchaudio.backend import no_backend
    from torchaudio.backend.no_backend import save, load, info
    
    from torchaudio.backend import soundfile_backend
    from torchaudio.backend.soundfile_backend import save, load, info
    ```
    
    Pull Request resolved: https://github.com/pytorch/audio/pull/3595
    
    Reviewed By: nateanl
    
    Differential Revision: D48957446
    
    Pulled By: mthrok
    
    fbshipit-source-id: ebb256461dd3032025fd27d0455ce980888f7778
    931598c1
common.py 443 Bytes