mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
This PR allows `FileManager` to accept `pathlib.Path` as arguments while keeping the original `str` path support. This allows us to simplify the code such as: 1. `os.path.join(..., ...)` with `Path.__floordiv__(..., ...)`.95a5958db4/torchgen/utils.py (L155)
95a5958db4/torchgen/utils.py (L176)
2. `os.path.basename(...)` with `Path(...).name`.95a5958db4/torchgen/utils.py (L161)
3. Manual file extension split with `Path(...).with_stem(new_stem)`95a5958db4/torchgen/utils.py (L241-L256)
------ Pull Request resolved: https://github.com/pytorch/pytorch/pull/150726 Approved by: https://github.com/zou3519