Fix jit.trace mis-handling of InterfaceType (#53052)
Summary:
`jit.trace` recursively gathers all named attributes in module at beginning of
tracing. This is fine in a pure-tracing environment, but breaks when a
scripted module that contains an InterfaceType'd submodule is involved.
Because InterfaceType, by design, is not allowed to have any attribute,
thus some of the gathered attributes will turn into fatal errors in
following some graph rewrite passes.
This PR fixes this bug by distinguishing InterfaceType'd submodules from
normal ClassType'd submodules.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53052
Reviewed By: wanchaol
Differential Revision: D26735566
Pulled By: gmagogsfm
fbshipit-source-id: a14aee6f1fe8000f80c2dc60bdf19acee6225090