Skip to content

Skip constant folding for non-deterministic Bernoulli - #3072

Open
Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/fold-skip-bernoulli
Open

Mohammed Alkindi (MohammedAlkindi) wants to merge 1 commit into
microsoft:mainfrom
MohammedAlkindi:fix/fold-skip-bernoulli

Conversation

@MohammedAlkindi

Copy link
Copy Markdown
Contributor

Bernoulli was missing from _NON_DETERMINISTIC_OPS, so constant folding evaluated it once during optimization and replaced it with a fixed tensor. A Bernoulli on a constant probability input, such as a dropout-style mask, then returns the same sample on every run. It now stays in the graph, like the RandomUniform, RandomNormal and Multinomial ops already in the set.

test_bernoulli_is_not_folded fails before ([] != ['Bernoulli']) and passes after. onnxscript/optimizer: 75 passed. ruff check and ruff format --check are clean.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

1 participant