Skip to content

Conversation

zpye
Copy link
Contributor

@zpye zpye commented Sep 29, 2025

Description

When there is an optional input (empty input type) in the OrtShapeInferContext construction, use undefined data type and empty shape as a placeholder.

Motivation and Context

VitisAI EP may add nodes with optional inputs during graph optimization to meet the requirements of AMD AI compilers.

This fix may help other execution providers to improve the graph optimization process.

### Description
When there is an optional input (empty input type) in the OrtShapeInferContext construction, use undefined data type and empty shape as a placeholder.

### Motivation and Context
VitisAI EP may add nodes with optional inputs during graph optimization to meet the requirements of AMD AI compilers.

This fix may help other execution providers to improve the graph optimization process.
@zpye zpye marked this pull request as ready for review September 29, 2025 12:15
snnn
snnn previously approved these changes Sep 29, 2025
@snnn snnn requested a review from Copilot September 29, 2025 23:05
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the OrtShapeInferContext constructor to properly handle optional inputs by adding a null check for input types. When an input type is null (indicating an optional input), it now creates a placeholder with undefined data type and empty shape instead of attempting to process a null pointer.

  • Added null check for input_type before processing tensor type information
  • Added fallback logic to create placeholder type and shape info for optional inputs

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@zpye
Copy link
Contributor Author

zpye commented Sep 30, 2025

@zpye please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree company="AMD"

@zpye zpye requested a review from snnn September 30, 2025 13:05
@yuslepukhin
Copy link
Member

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI,Windows ARM64 QNN CI Pipeline,Windows GPU Doc Gen CI Pipeline,Windows x64 QNN CI Pipeline

Copy link

Azure Pipelines successfully started running 4 pipeline(s).

Copy link
Member

@yuslepukhin yuslepukhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@yuslepukhin yuslepukhin merged commit 0453cbf into microsoft:main Oct 9, 2025
90 checks passed
@zpye zpye deleted the fix/custom_ops_optional_inputs branch October 10, 2025 06:35
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.

4 participants