Properly serialize types that only appear at function input (#47775)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/47775
When serializing graphs, we check every node for named types referenced,
so that we can register them as dependencies. We were skipping this
check for the graph inputs themselves. Since types used at input are
almost always used somewhere in the graph, we never noticed this gap
until a user reported an issue with NamedTuples.
Test Plan: Imported from OSS
Reviewed By: jamesr66a
Differential Revision: D24896289
Pulled By: suo
fbshipit-source-id: 4ce76816cb7997a7b65e7cea152ea52ed8f27276