pytorch/torch/csrc/jit
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
..
backends
docs Some fixes for jit overview doc (#28112) 2019-10-29 12:08:42 -07:00
fuser Consistently use TORCH_CUDA_API for all files that live in cuda targets. (#29158) 2019-11-06 15:02:07 -08:00
mobile Mobile module forward() pass input by value. (#30060) 2019-11-18 22:33:38 -08:00
passes Add logging to inliner. (#27922) 2019-11-19 17:58:51 -08:00
script Fix type sharing on loaded ScriptModules (#29826) 2019-11-20 01:13:09 -08:00
testing Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
alias_info.h
argument_spec.cpp autodiff changes to enable profiling 2019-09-25 10:11:44 -07:00
argument_spec.h
attributes.cpp
attributes.h Allow types as node attributes (#26268) 2019-10-01 16:46:55 -07:00
autodiff.cpp Switching tests to ProfilingExecutor (rebased) 2019-10-29 11:41:42 -07:00
autodiff.h
catch_utils.hpp
code_template.h Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
constants.cpp Remove TensorImpl::is_variable, deprecate Tensor::is_variable (#29653) 2019-11-14 11:41:02 -08:00
constants.h
custom_operator.h Remove confusing torch::jit::RegisterOperators for custom ops (#28229) 2019-10-18 10:46:31 -07:00
exception_message.h
export.cpp Add support for quantized operator conversion from PT to C2 via ONNX (#29694) 2019-11-18 12:12:40 -08:00
export.h clean up exported source format (#28129) 2019-10-16 22:47:24 -07:00
function.cpp Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
function.h Fix race condition in Function::optimized_graph(). (#27012) 2019-09-27 21:54:28 -07:00
graph_executor_impl.h
graph_executor.cpp Move most methods off Variable into torch::autograd::impl functions. (#29665) 2019-11-18 08:12:12 -08:00
graph_executor.h Switching tests to ProfilingExecutor (rebased) 2019-10-29 11:41:42 -07:00
graph_node_list.h
hooks_for_testing.cpp
hooks_for_testing.h
import_export_helpers.cpp Fix circular deps in loading (#26758) 2019-09-26 11:39:16 -07:00
import_export_helpers.h Fix circular deps in loading (#26758) 2019-09-26 11:39:16 -07:00
import_legacy.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
import_legacy.h
import_source.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
import_source.h clean up exported source format (#28129) 2019-10-16 22:47:24 -07:00
import.cpp String opts related to deserialization. (#28263) 2019-10-18 07:36:17 -07:00
import.h
init.cpp Add support for quantized operator conversion from PT to C2 via ONNX (#29694) 2019-11-18 12:12:40 -08:00
init.h
instruction.cpp Add missing operators for pytext, v2 (#29970) 2019-11-16 23:59:12 -08:00
instruction.h Add OPN instruction and vararg operator table (#27104) 2019-10-04 09:35:53 -07:00
interned_strings_class.h
interpreter.cpp Show full call stack in TorchScript exception even when calls were inlined. 2019-11-19 17:58:55 -08:00
interpreter.h Add OPN instruction and vararg operator table (#27104) 2019-10-04 09:35:53 -07:00
ir_views.h
ir.cpp Add InlinedCallStack class. (#27921) 2019-11-19 17:58:46 -08:00
ir.h Add InlinedCallStack class. (#27921) 2019-11-19 17:58:46 -08:00
irparser.cpp Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
irparser.h
jit_log.cpp clean up exported source format (#28129) 2019-10-16 22:47:24 -07:00
jit_log.h Add traces to specialize_autograd and lower_grad_of (2nd try) 2019-09-24 09:58:43 -07:00
named_value.h improve error messages when a method or attribute is missing (#27110) 2019-10-03 21:25:01 -07:00
netdef_converter.cpp
netdef_converter.h
node_hashing.cpp Better hashing for constant pool (#27733) 2019-10-11 14:30:13 -07:00
node_hashing.h
operator_options.cpp
operator_options.h
operator.cpp Switching tests to ProfilingExecutor (rebased) 2019-10-29 11:41:42 -07:00
operator.h Remove unnecessary Node* closures in operator registration 2019-10-15 16:00:38 -07:00
pass_manager.cpp
pass_manager.h
pickle.cpp Use c10::to_string in more places (#28605) 2019-10-24 15:52:05 -07:00
pickle.h Buffer to speed Unpickler (#27727) 2019-10-15 11:32:53 -07:00
pickler.cpp Pickler: convert std::stringstream cases. (#29351) 2019-11-08 14:26:40 -08:00
pickler.h Fix UNICODE conflict on Windows (#28782) 2019-10-30 14:09:31 -07:00
print_handler.cpp
print_handler.h
profiling_graph_executor_impl.cpp Disable ProfilingGraphExecutorImpl for mobile (#30067) 2019-11-19 18:04:57 -08:00
profiling_graph_executor_impl.h fix missing lock in profiling graph compilation (#29886) 2019-11-15 17:51:46 -08:00
profiling_record.cpp more profiler changes in C++ before enabling checkScript changes 2019-10-03 10:39:54 -07:00
profiling_record.h more profiler changes in C++ before enabling checkScript changes 2019-10-03 10:39:54 -07:00
pybind_utils.h Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
pybind.h Allow 'Any' to appear as a type argument. (#26572) 2019-10-16 11:07:08 -07:00
python_arg_flatten.cpp Add Support to Dicts and Strings in ONNX for Inputs and Outputs (#25889) 2019-09-26 22:31:09 -07:00
python_arg_flatten.h Rename getNonVariableDeprecatedTypeProperties to getDeprecatedTypeProperties (#29203) 2019-11-13 07:43:32 -08:00
python_interpreter.cpp
python_ir.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
python_ir.h
python_tracer.cpp Fix tracing of autograd functions 2019-11-14 11:18:07 -08:00
python_tracer.h Abstract tracer::enter and tracer::exit into a function 2019-10-26 18:41:14 -07:00
register_c10_ops.cpp Delete all trivial uses of make_variable. (#29213) 2019-11-13 07:43:41 -08:00
register_prim_ops.cpp Add overload name to JIT prim operators, version 2 (#29960) 2019-11-16 23:59:07 -08:00
register_special_ops.cpp OPN ops TupleConstruct/Unpack and format. (#29635) 2019-11-15 16:22:42 -08:00
register_string_ops.cpp msvc error C4805 fix (#28156) 2019-10-25 09:24:25 -07:00
resource_guard.h
scope.cpp Add InlinedCallStack class. (#27921) 2019-11-19 17:58:46 -08:00
scope.h Add InlinedCallStack class. (#27921) 2019-11-19 17:58:46 -08:00
source_range_serialization_impl.h
source_range_serialization.cpp
source_range_serialization.h
source_range.cpp Show full call stack in TorchScript exception even when calls were inlined. 2019-11-19 17:58:55 -08:00
source_range.h Show full call stack in TorchScript exception even when calls were inlined. 2019-11-19 17:58:55 -08:00
subgraph_matcher.cpp
subgraph_matcher.h
symbolic_script.cpp explicitly provide memory format when calling to *_like operators 2019-11-19 16:19:24 -08:00
symbolic_script.h
tracer.cpp Factor Module into Object and Module 2019-11-17 22:58:50 -08:00
tracer.h Print which output didn't have dependence. (#29047) 2019-11-04 14:59:53 -08:00
unpickler.cpp String opts related to deserialization. (#28263) 2019-10-18 07:36:17 -07:00
unpickler.h Remove attempToRecoverType (#26767) 2019-10-16 11:07:13 -07:00
update_graph_executor_opt.cpp Bytecode export flow (#25187) 2019-09-25 16:35:45 -07:00
update_graph_executor_opt.h Bytecode export flow (#25187) 2019-09-25 16:35:45 -07:00
vararg_functions.cpp OPN ops TupleConstruct/Unpack and format. (#29635) 2019-11-15 16:22:42 -08:00
vararg_functions.h OPN ops TupleConstruct/Unpack and format. (#29635) 2019-11-15 16:22:42 -08:00
variable_tensor_list.h