assert no duplicate yaml keys in codegen (#66238)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/66238
The codegen should error if it sees two yaml entries with the same key. The default behavior of python's yaml loader is to overwrite duplicate keys with the new value.
This would have caught a nasty bug that showed up in https://github.com/pytorch/pytorch/pull/66225/files#r723796194.
I tested it on that linked PR, to confirm that it errors correctly (and gives the line number containing the duplicate).
Test Plan: Imported from OSS
Reviewed By: dagitses, albanD, sean-ngo
Differential Revision: D31464585
Pulled By: bdhirsh
fbshipit-source-id: 5b35157ffa9a933bf4b344c4b9fe2878698370a3