[FX] Fix corner case in name sanitization (#46958)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/46958
Test Plan: Imported from OSS
Reviewed By: dzhulgakov
Differential Revision: D24580474
Pulled By: jamesr66a
fbshipit-source-id: 2f8d252998c72e1e79d6a5f7766c2d51a271cc83