pytorch
44edf8c4 - [DataLoader] Typing Enforcement for DataPipe at Compile-time (#54020)

Commit
3 years ago
[DataLoader] Typing Enforcement for DataPipe at Compile-time (#54020) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/54020 ## Feature - Add `issubtype` to check the type is a subtype of the other type. - Add `_DataPipeMeta` (mimic Python typing 3.6) - Add `type` attribute for each DataPipe - Save original `__init__` function for each DataPipe - Validate return hint of `__iter__` - Replace `__init__` function bases on `type` - Fixed type: Put original `__init__` back, if it exists or use a plain `__init__` - Non-fixed type: Add new `__init__` with the functionality to copy `cls.type` for each instance. (Optimized for memory) No Error for main repo, `torchvision`, `torchaudio` and `torchtext`. ## Future - Add same thing for `__getitem__`. - When DataFrame came out, add an another type for DataFrame with column name and type. Test Plan: Imported from OSS Reviewed By: VitalyFedyunin Differential Revision: D27327232 Pulled By: ejguan fbshipit-source-id: fd3a6029c16f5d814b1d7e1b1566fdcd8fd1ad9a
Author
Parents
Loading