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

Compiling with return signature raises an exception. #750

Closed
erick-xanadu opened this issue May 16, 2024 · 0 comments · Fixed by #751
Closed

Compiling with return signature raises an exception. #750

erick-xanadu opened this issue May 16, 2024 · 0 comments · Fixed by #751
Labels
bug Something isn't working

Comments

@erick-xanadu
Copy link
Contributor

The following fails

import pennylane as qml

def identity(x: float) -> float:
    return x

@qml.qjit
def wrapper(x: float) -> float:
    return identity(x)

print(wrapper.mlir)

The following succeeds:

import pennylane as qml

def identity(x: float) -> float:
    return x

@qml.qjit
def wrapper(x: float): # -> float: # <--- line changed.
    return identity(x)

print(wrapper.mlir)
@erick-xanadu erick-xanadu added the bug Something isn't working label May 16, 2024
erick-xanadu added a commit that referenced this issue May 21, 2024
**Context:** Methods with return type signatures are not compiled.

**Description of the Change:** At the moment, ignore the return type
signature as it is computed by JAX.

**Benefits:** More valid python code is able to be compiled.

**Possible Drawbacks:** It would be nice to incorporate return type
signature to the warning message if the detected return type is not the
same as the one specified by the user. But we can leave this to the next
PR.

**Related GitHub Issues:** Fixes #750
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant