[ONNX] Make graph name spec-compliant (#71961)
[According to the ONNX spec](https://github.com/onnx/onnx/blob/main/docs/IR.md#names-within-a-graph),
all names must adhere to C90 identifier syntax rules, which means no
dashes.
Fixes: #30952
Pull Request resolved: https://github.com/pytorch/pytorch/pull/73099