• moto's avatar
    Replace c10::Dict with std::map in StreamReader/Writer (#3092) · c3310018
    moto authored
    Summary:
    This commit is kind of clean up and preparation for future development.
    
    We plan to pass around more complicated objects among StreamReader and StreamWriter, and TorchBind is not expressive enough for defining intermediate object, so we want to use PyBind11 for binding StreamReader/Writer.
    
    PyBind11 converts Python dict into std::map, while TorchBind converts it into c10::Dict. Because of this descrepancy, conversion from c10::Dict to std::map have to happen in multiple places, and this makes the binding code thicker as it requires to wrapper methods.
    
    Using std::map reduces the number of wrapper methods / conversions, because the same method can be bound for file-like object and the others.
    
    Pull Request resolved: https://github.com/pytorch/audio/pull/3092
    
    Reviewed By: nateanl
    
    Differential Revision: D43524808
    
    Pulled By: mthrok
    
    fbshipit-source-id: f7467c66ccd37dbf4abc337bbb18ffaac21a0058
    c3310018
pybind.cpp 2.38 KB