[ONNX] Fix scalar_type_analysis metadata for copied constant (#86716)
Fix the source of metadata for copied constant. Since the constant is being implicitly casted,
it makes more sense to assign code location and etc with the user node.
This issue was discovered in https://github.com/pytorch/pytorch/issues/86627. This PR also adds unit test coverage for scope
information of nodes when they are altered by CSE and related passes.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/86716
Approved by: https://github.com/thiagocrepaldi, https://github.com/malfet