pytorch/torch/csrc/jit/frontend
Yanan Cao c22bbb2124 [JIT] Add Type::repr_str to return human-readable str (#39544)
Summary:
Clearly expressing a type is inferred by PyTorch instead of explicitly annotated by user makes many error messages more user-friendly

Currently Type has two string conversion methods. str() for IR printing and python_str() for serialization and error message generation. If we want to include more information in type printing while maintaining serialization/deserialization correctness, we need to split python_str() into annotation_str() and repr_str().

annotation_str is solely responsible for serialization, it strictly matches format of python type annotation. repr_str() is responsible for generating a human-readable error message that includes information like "this type is inferred, not explicitly annotated"

Closes https://github.com/pytorch/pytorch/issues/39449
Pull Request resolved: https://github.com/pytorch/pytorch/pull/39544

Differential Revision: D21978759

Pulled By: gmagogsfm

fbshipit-source-id: 733566f5a62e748b5ca4bb3c5943ebb6d5b664d0
2020-06-10 12:01:24 -07:00
..
builtin_functions.cpp [JIT] remove list_with_default op (#37886) 2020-05-06 17:32:11 -07:00
builtin_functions.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
canonicalize_modified_loop.cpp [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
canonicalize_modified_loop.h [jit] do the code reorg (#33851) 2020-02-27 13:02:51 -08:00
code_template.h [jit] do the code reorg (#33851) 2020-02-27 13:02:51 -08:00
concrete_module_type.cpp [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
concrete_module_type.h [JIT] Refactor attributes to support buffers and parameters as first class citizens, add support for iterating over named_buffers() (#37905) 2020-05-18 23:23:43 -07:00
convert_to_ssa.cpp [JIT] fix comprehension scope writes (#36105) 2020-04-08 10:00:45 -07:00
convert_to_ssa.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
edit_distance.cpp [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
edit_distance.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
error_report.cpp [JIT] recursively compile class types (#38050) 2020-05-12 17:16:28 -07:00
error_report.h [JIT] recursively compile class types (#38050) 2020-05-12 17:16:28 -07:00
exit_transforms.cpp [JIT] Exit Transform Rewrite (#38282) 2020-05-15 12:22:28 -07:00
exit_transforms.h [jit] do the code reorg (#33851) 2020-02-27 13:02:51 -08:00
function_schema_parser.cpp [RELAND] New operator registration API (#35061) (#35629) 2020-03-29 19:48:29 -07:00
function_schema_parser.h [RELAND] New operator registration API (#35061) (#35629) 2020-03-29 19:48:29 -07:00
inline_loop_condition.cpp [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
inline_loop_condition.h [jit] do the code reorg (#33851) 2020-02-27 13:02:51 -08:00
ir_emitter.cpp [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
ir_emitter.h [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
lexer.cpp Support left and right shift operators in JIT (#34563) 2020-03-13 13:00:33 -07:00
lexer.h Add %= support in TorchScript (#38983) 2020-05-31 12:51:56 -07:00
mini_environment.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
name_mangler.cpp [jit] factor mangler out (#35716) 2020-03-31 22:27:39 -07:00
name_mangler.h [jit] factor mangler out (#35716) 2020-03-31 22:27:39 -07:00
parse_string_literal.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parser_constants.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
parser.cpp Add %= support in TorchScript (#38983) 2020-05-31 12:51:56 -07:00
parser.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
resolver.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_matching.cpp [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
schema_matching.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
schema_type_parser.cpp Have DeviceType available in torch namespace (#38036) 2020-05-11 16:06:52 -07:00
schema_type_parser.h [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
script_type_parser.cpp [JIT] JIT should let people know we inferred an argument as a tensor (#38527) 2020-05-29 10:41:50 -07:00
script_type_parser.h [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
source_range.cpp [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
source_range.h [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
string_to_type.cpp [jit] kill script namespace (#34515) 2020-03-11 23:32:48 -07:00
strtod.cpp [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
strtod.h [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
sugared_value.cpp [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
sugared_value.h [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
tracer.cpp [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
tracer.h [quant] ConvPackedParams with TorchBind (#35923) 2020-05-05 20:18:36 -07:00
tree_views.h Add %= support in TorchScript (#38983) 2020-05-31 12:51:56 -07:00
tree.h [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
versioned_symbols.cpp Creates "Versioned Symbol" pattern to preserve serialized Torchscript semantics (#36300) 2020-04-16 04:56:53 -07:00
versioned_symbols.h Creates "Versioned Symbol" pattern to preserve serialized Torchscript semantics (#36300) 2020-04-16 04:56:53 -07:00