make NamedType an interface (#23696)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/23696
As title. I want to let children be able to define how to get their own
name
Test Plan: Imported from OSS
Differential Revision: D16611885
Pulled By: suo
fbshipit-source-id: 620b22c314eddf95159546810e1a00b1646663b8