pytorch/torch/csrc/jit/script
Michael Suo 93db2b86d1 Fix type sharing on loaded ScriptModules (#29826)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29826

After save/load, we lose concrete type information. So if you tried to
script something that contained a loaded ScriptModule as a submodule,
the following sequence happened:
1. During ConcreteType inference, the loaded submodule got a new
inferred type.
2. But it already has a type! So there was a type mismatch.

To fix this, we should generate a ConcreteType directly from the loaded
submodule type (similar to what we do for interfaces). This makes sense
too--the ConcreteModuleType should be empty, since all the "sugaredness"
was stripped out during the save/load process.

Test Plan: Imported from OSS

Differential Revision: D18575009

Pulled By: suo

fbshipit-source-id: 4d329b7e9b7e7624f459e50092e35ab0ab813791
2019-11-20 01:13:09 -08:00
..
builtin_functions.cpp Give functions qualified names 2019-07-11 14:55:34 -07:00
builtin_functions.h Make CompilationUnit own Functions (#22202) 2019-07-04 17:12:00 -07:00
canonicalize_modified_loop.cpp add support for breaks and continues (#21692) 2019-07-12 15:02:44 -07:00
canonicalize_modified_loop.h add support for breaks and continues (#21692) 2019-07-12 15:02:44 -07:00
class_type.cpp Decouple JIT and autograd codes (#28900) 2019-11-08 10:16:18 -08:00
compilation_unit.h introduce module interface declaration (#28408) 2019-11-02 16:39:00 -07:00
compiler.cpp Check for unrolled loop in break & continue (#29474) 2019-11-08 15:51:13 -08:00
compiler.h Trace module calls 2019-11-06 15:05:49 -08:00
concrete_module_type.cpp Fix type sharing on loaded ScriptModules (#29826) 2019-11-20 01:13:09 -08:00
concrete_module_type.h Fix type sharing on loaded ScriptModules (#29826) 2019-11-20 01:13:09 -08:00
convert_to_ssa.cpp Fix bugs in assignment to optionals (#25059) 2019-08-26 13:47:54 -07:00
convert_to_ssa.h Change compiler to use Load/Stores, then transform to SSA (#21101) 2019-06-10 10:26:43 -07:00
edit_distance.cpp Print out operator suggestions for unknown builtin op (#15183) 2019-01-04 13:04:44 -08:00
edit_distance.h Cleanup includes in torch/csrc/jit/script/* (#19921) 2019-05-06 13:24:22 -07:00
error_report.cpp Clear recursive error stack on each compilation (#23458) 2019-08-16 16:10:19 -07:00
error_report.h Clear recursive error stack on each compilation (#23458) 2019-08-16 16:10:19 -07:00
exit_transforms.cpp fix closures which always throw. (#25278) 2019-08-27 22:16:54 -07:00
exit_transforms.h add support for breaks and continues (#21692) 2019-07-12 15:02:44 -07:00
function_schema_parser.cpp Wrapping namespace Reduction in namespace at (#26606) (#27422) 2019-10-15 11:05:40 -07:00
function_schema_parser.h Allow registering ops without specifying the full schema (#19286) 2019-04-18 02:04:46 -07:00
init.cpp Fix type sharing on loaded ScriptModules (#29826) 2019-11-20 01:13:09 -08:00
init.h Canonicalize all includes in PyTorch. (#14849) 2018-12-08 19:38:30 -08:00
inline_loop_condition.cpp add support for breaks and continues (#21692) 2019-07-12 15:02:44 -07:00
inline_loop_condition.h add support for breaks and continues (#21692) 2019-07-12 15:02:44 -07:00
jit_exception.cpp C++ changes toward libtorch and libcaffe2 unification (#19554) 2019-04-26 01:38:10 -07:00
jit_exception.h C++ changes toward libtorch and libcaffe2 unification (#19554) 2019-04-26 01:38:10 -07:00
lexer.cpp Added invert bitwise operation to JIT (#22324) 2019-09-03 11:16:30 -07:00
lexer.h Added invert bitwise operation to JIT (#22324) 2019-09-03 11:16:30 -07:00
logging.cpp C++ changes toward libtorch and libcaffe2 unification (#19554) 2019-04-26 01:38:10 -07:00
logging.h Cleanup includes in torch/csrc/jit/script/* (#19921) 2019-05-06 13:24:22 -07:00
method.h Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
mini_environment.h add #pragma once to jit headers 2019-07-04 11:10:59 -07:00
module_python.h remove uses of std::shared_ptr<Module> (#21934) 2019-06-25 13:24:38 -07:00
module.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
module.h Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
object.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
object.h Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
parse_string_literal.h Fix the problem in parseOctal and throw exception if use \xhh to specify hex value (#23198) 2019-07-24 10:41:59 -07:00
parser.cpp Check for unrolled loop in break & continue (#29474) 2019-11-08 15:51:13 -08:00
parser.h kill TK_NAMED_TUPLE_DEF (#24350) 2019-08-15 10:15:52 -07:00
python_sugared_value.cpp Re-unify module and interface in ConcreteModuleType (#29825) 2019-11-20 01:13:06 -08:00
python_sugared_value.h Add Support For Module Containers as Iterables (#28255) 2019-11-04 09:19:40 -08:00
python_tree_views.cpp add support for multiple assignment statements (#24477) 2019-08-22 10:17:14 -07:00
python_tree_views.h add #pragma once to jit headers 2019-07-04 11:10:59 -07:00
resolver.h Fix circular deps in loading (#26758) 2019-09-26 11:39:16 -07:00
schema_matching.cpp clean up NamedTuple creation API (#28189) 2019-10-22 10:18:07 -07:00
schema_matching.h refactor tryMatchSchema (#26499) (#27773) 2019-10-14 20:45:25 -07:00
schema_type_parser.cpp Add unsupported types to schema type parser (#28181) 2019-10-23 01:33:31 -07:00
schema_type_parser.h add #pragma once to jit headers 2019-07-04 11:10:59 -07:00
script_type_parser.cpp Allow 'Any' to appear as a type argument. (#26572) 2019-10-16 11:07:08 -07:00
script_type_parser.h Refactor emitIsInstance (#26061) 2019-09-18 23:27:13 -07:00
strtod.cpp fix some compiler warnings 2019-08-05 17:52:56 -07:00
strtod.h Fixing function schema parser for Android (#19281) 2019-04-17 23:50:17 -07:00
sugared_value.cpp Add Support For Module Containers as Iterables (#28255) 2019-11-04 09:19:40 -08:00
sugared_value.h Add Support For Module Containers as Iterables (#28255) 2019-11-04 09:19:40 -08:00
tree_views.h Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
tree.h Record source/line info in SourceRange and report in highlight (#21157) 2019-05-30 15:45:30 -07:00