Cherry-pick PR #25626 to 1.23.0 release branch (#25640)
### Description
<!-- Describe your changes. -->
Move moving weights to memory to the end of Graph::Resolve().
Modify Inject so it copies data into TensorProto according to the C API
docs.
### Motivation and Context
<!-- - Why is this change required? What problem does it solve?
- If it fixes an open issue, please link to the issue here. -->
TypeAndShape inference runs as a part of `Resolve()` and it unable to
inspect and load the initializers that point to OrtValues at that time.
We choose to move TensorProto to OrtValue conversion at the end of
`Resolve()`.
References: https://github.com/microsoft/onnxruntime/pull/25579
Co-authored-by: Dmitri Smirnov <yuslepukhin@users.noreply.github.com>