Assert valid inner type for OptionalType creation (#41509)
Summary:
Assert in OptionalType::create for valid TypePtr to catch all uses, as well as in python resolver to propagate slightly more helpful error message.
Closes https://github.com/pytorch/pytorch/issues/40713.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/41509
Reviewed By: suo
Differential Revision: D22563710
Pulled By: wconstab
fbshipit-source-id: ee6314b1694a55c1ba7c8251260ea120be148b17