Propagate outer scope type info to subgraphs during verification (#27707)
## Summary
- Fix ORT raising "does not have type information set by parent node"
when a subgraph references an initializer declared in the outer (parent)
graph without explicit `value_info` in the subgraph
- Propagate type info from implicit input defs to subgraph NodeArgs
before subgraph verification in `VerifyNodeAndOpMatch`
- Add regression test with an `If` node whose subgraph references an
outer scope initializer without `value_info`
## Motivation
Fixes #24880
When a node's op schema type inference function does not invoke subgraph
inferencing (e.g., contrib ops like `BeamSearch`, `GreedySearch`,
`WhisperBeamSearch`, `Sampling`), `InferAndVerifySubgraphTypes` is never
called. This means type info from outer scope values — such as
initializers declared in the parent graph — is never propagated to the
subgraph's NodeArgs. When the subgraph is later verified in the second
pass of `VerifyNodeAndOpMatch`, nodes referencing these outer scope
values fail with a null type error.
The existing workaround in `convert_generation.py` (manually adding
`value_info` entries for moved initializers) confirms this gap in the
type propagation path.
## Changes
**`onnxruntime/core/graph/graph.cc`**: In `VerifyNodeAndOpMatch`'s
subgraph verification loop, propagate type info from the containing
node's `implicit_input_defs` to the subgraph's NodeArgs before calling
`VerifyNodeAndOpMatch` on the subgraph. The propagation is guarded by
`subgraph_nodearg->Type() == nullptr`, making it a safe no-op for
standard ONNX ops (If/Loop/Scan) where `InferAndVerifySubgraphTypes`
already set the types. For nested subgraphs, the recursive call to
`VerifyNodeAndOpMatch` handles propagation at each level.
**`onnxruntime/test/ir/graph_test.cc`**: Add
`OuterScopeInitializerTypeInfoPropagatedToSubgraph` test that constructs
a model proto with an `If` node whose subgraphs reference an outer graph
initializer without `value_info`, and verifies `Model::Load` (which
calls `Graph::Resolve`) succeeds.
## Test Plan
- [ ] New C++ unit test
`OuterScopeInitializerTypeInfoPropagatedToSubgraph` verifies model
resolution succeeds
- [ ] Existing `graph_test.cc` tests continue to pass (no regression in
type inference for standard ONNX ops)
- [ ] Existing control flow tests (If/Loop/Scan) continue to pass
- [ ] CI lint checks pass (verified locally with `lintrunner`)