Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Extend Optional op #5043

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

gramalingam
Copy link
Contributor

Description

This PR extends the existing Optional by adding attributes (similar to the Constant op) to specify values via an attribute instead of an input.

Motivation and Context

This is intended to support authoring function-ops with optional attributes, particularly when the behavior of the function when the attribute value is not specified cannot be captured using a default-value for the attribute.

This should allow us to author functions as below, where alpha is an optional attribute. The first-line promotes the optional-attribute into a dynamic-optional-value. This allows us to process the dynamic-optional-value using a conditional (If) op.

my_function <alpha> (X) => (Y) {
   alpha_opt = Optional < value : int = @alpha, type = int64 >()
   cond = OptionalHasElement(alpha_opt)
   Y = If (cond) ...
}

Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
@gramalingam gramalingam requested review from a team as code owners March 25, 2023 00:47
@github-actions github-actions bot added the stale label Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant