Skip to content

Only set has_branches=True for cond/switch without resource hint - #3195

Open
dwierichs wants to merge 4 commits into
mainfrom
has_branches-hinted
Open

Only set has_branches=True for cond/switch without resource hint#3195
dwierichs wants to merge 4 commits into
mainfrom
has_branches-hinted

Conversation

@dwierichs

Copy link
Copy Markdown
Contributor

Context:
We introduced resource hints in #3059 and #3060, which allow to estimate the probability with which the predicate of a cond fires.
In general, if there is a cond, the metadata has_branches of the resources objects is set to true, to enable PennyLane to raise a warning about the default union/max behaviour across branches.
If we are using the resource hint, we don't want that warning, so we should not set has_branches to true

Description of the Change:
Fix the above by stopping to set has_branches to true if resource hints are present.

Benefits:
Only warn if adequate.

Possible Drawbacks:
one could consider a renaming of the attribute, to something like has_unestimated_branches or so, but that would temporarily break PL CI, which we don't want for this tiny change.

Related GitHub Issues:

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.

1 participant