Skip to content

Fix stale output shape metadata in WebGPU external-data E2E model#28805

Draft
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-web-ci-job-failing
Draft

Fix stale output shape metadata in WebGPU external-data E2E model#28805
Copilot wants to merge 2 commits into
mainfrom
copilot/fix-web-ci-job-failing

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 5, 2026

Description

Web CI WebGPU external-data E2E was emitting an ORT output-shape warning because model_with_orig_ext_data.onnx declared Y as {1,4} while execution produces {2,3}.
This change aligns model metadata with actual output and keeps the duplicated web/core test artifacts consistent.

  • Canonical generator update

    • Updated /onnxruntime/test/testdata/model_with_external_initializers.py to support explicit output shape and generate model_with_orig_ext_data.onnx with Y: [2, 3].
  • Generated artifact sync

    • Updated both checked-in copies of model_with_orig_ext_data.onnx:
      • /onnxruntime/test/testdata/model_with_orig_ext_data.onnx
      • /js/web/test/e2e/model_with_orig_ext_data.onnx
  • External-data companion

    • model_with_orig_ext_data.bin remains valid and unchanged (metadata-only correction).
# before
GenerateModel("model_with_orig_ext_data.onnx", "model_with_orig_ext_data")

# after
GenerateModel("model_with_orig_ext_data.onnx", "model_with_orig_ext_data", output_shape=(2, 3))

Motivation and Context

The failing Web CI signal came from inconsistent model metadata, not runtime computation: declared output shape {1,4} disagreed with actual output {2,3} for Y.
Aligning metadata to [2,3] removes the warning in the WebGPU external-data E2E path without changing test expectations or runtime behavior.

Original prompt

Fix the failing Web CI job in microsoft/onnxruntime caused by the external-data WebGPU E2E model metadata being inconsistent with actual runtime output.

Context:

Observed failure signature from the job logs:

  • ORT warning during the WebGPU external-data E2E test:
    • Expected shape from model of {1,4} does not match actual shape of {2,3} for output Y
  • The test itself expects the output tensor Y to have shape [2, 3] and values matching a 2x3 tensor.

Relevant code:

  • js/web/test/e2e/browser-test-webgpu-external-data.js creates a session from ./model_with_orig_ext_data.onnx and asserts:
    • Y.dims.length === 2 && Y.dims[0] === 2 && Y.dims[1] === 3

Task:

  1. Locate the source of model_with_orig_ext_data.onnx and any generator or checked-in artifact used by this test.
  2. Update the model so the declared output metadata for Y matches the actual runtime output shape [2, 3].
  3. If the model is generated, update the generation source and regenerate the artifact(s) needed by the test.
  4. Verify whether any related external-data binary (model_with_orig_ext_data.bin) or companion files also need regeneration.
  5. Ensure the WebGPU external-data E2E test remains correct and passes without the output shape verification warning.
  6. Open a pull request with the fix.

Implementation guidance:

  • Prefer fixing the model metadata/artifact instead of changing the JS test, because the test expectation and runtime output already agree on [2, 3].
  • If there are multiple copies of the model (eg checked-in testdata/build artifacts), update the canonical source and any committed generated files required by CI.
  • Include a concise PR description explaining that the model output shape metadata was stale/incorrect ({1,4}) while actual output is {2,3}.

Success criteria:

  • The external-data WebGPU E2E test no longer emits the Expected shape from model of {1,4} does not match actual shape of {2,3} for output Y warning.
  • The pull request contains the minimal correct fix and any required regenerated test artifacts.

The following is the prior conversation context from the user's chat exploration (may be truncated):

User: Please find a solution for this failing job. Use the logs, job definition, and any referenced files where the failure occurred. Keep your response focused on the solution and include code suggestions when appropriate.

Assistant: The fix is to correct the model’s declared output shape so it matches what the test actually produces.

Root cause

The failing job is not failing because of WebGPU execution itself. The log shows the E2E test passes, but ORT emits a shape verification warning during model execution:

  • Expected shape from model of {1,4} does not match actual shape of {2,3} for output Y

This happens in the WebGPU external-data E2E test here:

The test explicitly asserts that output Y is shape [2, 3]:

assert(Y.dims.length === 2 && Y.dims[0] === 2 && Y.dims[1] === 3);

So the ONNX model metadata says Y is {1,4}, while actual runtime output is {2,3}. That mismatch is the real issue.

What to change

Update the ONNX model model_with_orig_ext_data.onnx so the output Y shape in the graph definition is [2, 3] instead of [1, 4].

If the model is generated from source code or a script, fix the generator there. If the model is checked in as a binary artifact, regenerate it with the correct output shape and replace the checked-in file.

Suggested correction

Conceptually, the model output should be defined like this:

Y = helper.make_tensor_value_info('Y', TensorProto.FLOAT, [2, 3])

instead of:

Y = helper.make_tensor_value_info('Y', TensorProto.FLOAT, [1, 4])

Why this is the right fix

  • The test already expects [2, 3].
  • Runtime produces [2, 3].
  • The warning comes from stale/incorrect model metadata, not from the JS test logic.
  • Fixing the model removes the warning and aligns the artifact with the test’s expected behavior.

Notes on other log noise

The repeated Unsupported ONNX opset: 1/6 and EP assignment warnings appear to be non-fatal warnings from broader test coverage and are not the failure signature tied to the external-data test. The actionable issue shown by the referenced test is the output shape mismatch in the external-data model.

Files involved

This pull request was created from Copilot chat.

Copilot AI changed the title [WIP] Fix failing Web CI job due to inconsistent model metadata Fix stale output shape metadata in WebGPU external-data E2E model Jun 5, 2026
Copilot AI requested a review from tianleiwu June 5, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants