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

Fix cache for callbacks #907

Merged
merged 4 commits into from
Jul 5, 2024
Merged

Conversation

erick-xanadu
Copy link
Contributor

@erick-xanadu erick-xanadu commented Jul 5, 2024

Context: callback cache should take into account input types as well as output types. The following simple example illustrates when a callback would have different mismatching inputs yet always returns the same type.

@pure_callback
def always_return_float(x) -> float:
    if x == 0.0:
        return x
    else:
        return x + 0.0

Description of the Change: Adds input types as part of the cache key

Benefits: No error.

Possible Drawbacks:

Related GitHub Issues: Fixes #851

@erick-xanadu erick-xanadu marked this pull request as ready for review July 5, 2024 18:25
@erick-xanadu erick-xanadu requested a review from dime10 July 5, 2024 18:25
@erick-xanadu erick-xanadu changed the title Fix cache Fix cache for callbacks Jul 5, 2024
Copy link
Contributor

@rauletorresc rauletorresc left a comment

Choose a reason for hiding this comment

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

LGTM

@erick-xanadu erick-xanadu merged commit 5d910b6 into v0.7.0-rc Jul 5, 2024
42 checks passed
@erick-xanadu erick-xanadu deleted the eochoa/2024-07-05/cache-fix-2 branch July 5, 2024 18:46
rauletorresc added a commit that referenced this pull request Jul 6, 2024
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