pytorch/torch/csrc/jit/frontend
David Berard 10bf019b71 [jit] Add shapes info to the output type of CallFunction nodes after tracing, if the output is a tensor (#95544)
**Summary**: jit.trace usually adds shape information to all the jit::Values in its graph. This is mostly a side effect of how jit tracing is performed, but many users use this behavior for debugging and for better understanding the graph. Previously, CallFunction nodes (inserted by calling jit.script-ed functions) did _not_ have this information attached. This PR attaches this information for the tensor output values.

**Details**:
* First the jit tracer sets a global TracerState object
* Then the jit tracer invokes the python callable that is to be traced
* When the python function gets to a jit.script-ed function, [invokeScriptFunctionFromPython](8693604bc6/torch/csrc/jit/python/pybind_utils.h (L1060)) is called. It inserts a FunctionCall.
* Then after the actual scripted function gets called and we have a concrete output, we attach the concrete output [IValue to the TracerState](8693604bc6/torch/csrc/jit/python/pybind_utils.h (L1001))
* ^^ the setValueTrace call (linked in previous list item) is where this PR makes changes; we revise the jit::Value output of the CallFunction node to use the type of the concrete tensor, which will have actual shapes associated.

**Test**: added a test verifying that shape info appears in the output type for a CallFunction node in a jit-traced graph.

Differential Revision: [D43592880](https://our.internmc.facebook.com/intern/diff/D43592880)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/95544
Approved by: https://github.com/qihqi
2023-02-27 22:50:29 +00:00
..
builtin_functions.cpp
builtin_functions.h
canonicalize_modified_loop.cpp
canonicalize_modified_loop.h
concrete_module_type.cpp
concrete_module_type.h
convert_to_ssa.cpp
convert_to_ssa.h
edit_distance.cpp
edit_distance.h
error_report.cpp
error_report.h
exit_transforms.cpp
exit_transforms.h
function_schema_parser.cpp
function_schema_parser.h
inline_loop_condition.cpp
inline_loop_condition.h
ir_emitter.cpp [jit][await] Apply review comments (#93284) 2023-02-01 07:22:06 +00:00
ir_emitter.h
lexer.cpp
lexer.h
mini_environment.h
name_mangler.cpp
name_mangler.h
parse_string_literal.h
parser_constants.h
parser.cpp
parser.h
resolver.h
schema_matching.cpp
schema_matching.h
schema_type_parser.cpp Add exception handlers for stoll in jit/frontend/schema_type_parser.cpp (#94295) 2023-02-10 04:37:23 +00:00
schema_type_parser.h
script_type_parser.cpp Fix segmentation fault in script_type_parser.cpp and unpickler.cpp (#94815) 2023-02-16 21:41:11 +00:00
script_type_parser.h
source_range.cpp
source_range.h
source_ref.h
strtod.cpp
strtod.h
sugared_value.cpp [jit] Support Awaitable type (#90863) 2023-01-30 17:38:59 +00:00
sugared_value.h More fixes and improved clang-tidy checkers (#93213) 2023-02-01 14:44:17 +00:00
tracer.cpp [jit] Add shapes info to the output type of CallFunction nodes after tracing, if the output is a tensor (#95544) 2023-02-27 22:50:29 +00:00
tracer.h More fixes and improved clang-tidy checkers (#93213) 2023-02-01 14:44:17 +00:00
tree_views.cpp
tree_views.h
tree.h
versioned_symbols.cpp
versioned_symbols.h