Unify namespace of script::Module (#18378)
authorZachary DeVito <zdevito@fb.com>
Wed, 3 Apr 2019 22:58:08 +0000 (15:58 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 3 Apr 2019 23:04:17 +0000 (16:04 -0700)
commit0512e4e32348f01dc2184031a7c4d4644a455ac3
treeb5906818d3856436bf0309407251fbdf5bdcb396
parent773ce4fbd05c4ebb16eb361cadde0dcf33f38085
Unify namespace of script::Module (#18378)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/18378
ghimport-source-id: 55c29bb436a2153d29ff2f4488d99d8863c187b1

Stack from [ghstack](https://github.com/ezyang/ghstack):
* #18379 Enforce single parent for script submodules
* **#18378 Unify namespace of script::Module**
* #18314 Add ability to specialize class types to ArgumentSpec
* #18226 Add Slot type to abstract the raw pointers being used for slots.

This removes individual OrderedDicts in favor of a single unified
namespace for all things in a script::Module. This removes a whole
class of bugs where both a method and an parameter could get the
same name, for instance.

Since we no longer have to expose OrderedDict::Item objects, a lot of
downstream code can be simplified.

We no longer now double-store names (both in the key of the dictionary,
and in the object itself).

Differential Revision: D14603723

fbshipit-source-id: b5f7551b3074679623edd6ea70269830353b4d4c
test/custom_operator/test_custom_ops.cpp
test/test_jit.py
torch/csrc/jit/export.cpp
torch/csrc/jit/passes/python_print.cpp
torch/csrc/jit/script/builtin_functions.cpp
torch/csrc/jit/script/class_type.cpp
torch/csrc/jit/script/init.cpp
torch/csrc/jit/script/module.cpp
torch/csrc/jit/script/module.h
torch/csrc/jit/symbolic_script.cpp