mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Summary: This adds torch.jit.annotate for annotating the type of an intermediate. This is Py2/3 compatible, e.g.: ``` from torch.jit import annotate from typing import List torch.jit.script def foo(): a = annotate(List[int], []) ``` This is needed to output valid python programs from our IR. It removes the need for the empty list constructors. A future patch can add support to the C++ parser and Python 3, via desugaring: ``` a : int = b a = anntoate(int, b) ``` But this functionality is not required for serialization so is not added in this patch. Pull Request resolved: https://github.com/pytorch/pytorch/pull/13752 Differential Revision: D12989885 Pulled By: zdevito fbshipit-source-id: 161573a7352094543dc0d33a892f2a3b9103d847 |
||
|---|---|---|
| .. | ||
| builtin_functions.cpp | ||
| builtin_functions.h | ||
| compiler.cpp | ||
| compiler.h | ||
| error_report.h | ||
| init.cpp | ||
| init.h | ||
| jit_exception.h | ||
| lexer.cpp | ||
| lexer.h | ||
| module.cpp | ||
| module.h | ||
| parser.h | ||
| python_tree_views.cpp | ||
| python_tree_views.h | ||
| tree_views.h | ||
| tree.h | ||