pytorch/torch/csrc/jit
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
..
api [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
backends [JIT] Add support for saving/loading of lowered modules (#38893) 2020-06-01 23:50:52 -07:00
codegen [resubmit] Use TensorMethods.cpp (#39385) 2020-06-02 20:27:51 -07:00
docs [jit] update to serialization doc (#39025) 2020-06-05 17:49:08 -07:00
frontend [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
ir [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
mobile add overload name for str cmp (#39607) 2020-06-06 23:21:35 -07:00
passes [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
python [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
runtime [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
serialization [JIT] Add Type::repr_str to return human-readable str (#39544) 2020-06-10 12:01:24 -07:00
tensorexpr [TensorExpr] Fast sigmoid for LLVM (#39717) 2020-06-09 20:11:35 -07:00
testing [JIT] clang-format JIT code (#35115) 2020-03-26 11:24:51 -07:00
jit_log.cpp [jit] Fix name collision on load (#35720) 2020-04-01 00:02:38 -07:00
jit_log.h make sure logs work inside aten/c10 namespaces as well (#37018) 2020-04-21 20:01:13 -07:00
OVERVIEW.md Fix typo: TupleUnpack. (#38043) 2020-05-07 20:57:20 -07:00
README.md [jit] add top-level readme to csrc/jit (#33916) 2020-02-27 19:21:05 -08:00
resource_guard.h

PyTorch JIT

This folder contains (most of) the C++ code for the PyTorch JIT, a language and compiler stack for executing PyTorch models portably and efficiently. To learn more about the JIT from a user perspective, please consult our reference documentation and tutorials.

A brief summary of the source tree:

  • OVERVIEW.md: High-level technical overview of the JIT.
  • frontend/: Taking PyTorch modules in Python and translating them into the JIT IR.
  • ir/: Core IR abstractions.
  • runtime/: Interpreter, graph execution, and JIT operators.
  • codegen/: Generating efficient, hardware-specific code for JIT subgraphs.
  • serialization/: Saving and loading modules.
  • api/: Any user-facing C++ or Python interfaces.
  • python/: Binding stuff into Python or accessing information from the Python environment.
  • testing/: Utilities and helpers for testing.
  • mobile/: Mobile-specific implementations of runtime components.
  • passes/: IR-to-IR passes, generally for optimization and lowering.
  • generated/: This folder is generated by the PyTorch build, and contains bindings for native PyTorch operators into the JIT.

Refer to each folder for more in-depth documentation.

Other relevant parts of the codebase not contained here:

  • aten/src/ATen/core: contains JIT code re-used by other elements of the runtime system (eager, mobile, etc.)