pytorch
8fe2a5e9 - Fixes type annotations for named tensors #27846 (#36890)

Commit
5 years ago
Fixes type annotations for named tensors #27846 (#36890) Summary: This enables type checking for named tensors, and fixes the underlying problems. The bulk of the fix is modifying `gen_pyi.py` to generate reasonable types in `torch/__init__.pyi`. I took two approaches: First, I tried to take a generic approach and added `DimnameList` to the magic list of variable argument lists. Unfortunately that was insufficient for many of the method signatures, so I also added manual definitions for `rename`, `refine_names`, and `unflatten` in `__init__.pyi.in`. Finally there were a few problems in the doctests that had to be cleaned up so that `test/test_type_hints.py` will run successfully. Pull Request resolved: https://github.com/pytorch/pytorch/pull/36890 Differential Revision: D21259192 Pulled By: zou3519 fbshipit-source-id: 2a9e7d7bec9be5ae3ae2995078c6abfa3eca103c
Author
Parents
Loading