correctly share types between traced modules (#29583)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/29583
The normal flow for type sharing assumes that we will construct the
`ConcreteModuleType`, then use `operator==` to decide whether or not to
reuse an existing JIT type. In this case, `jitType_` is not populated,
so it doesn't make sense to compare it.
However, there is one exception to this flow: for traced modules, we
pre-compute the JIT type and poke it into the `ConcreteModuleType`
manually. To handle this case, we should compare the `jitType_`s in
`operator==` like everything else.
Test Plan: Imported from OSS
Differential Revision: D18435949
Pulled By: suo
fbshipit-source-id: 44b7672a686015aaf02f6664c6aff00e165fde65