-
Notifications
You must be signed in to change notification settings - Fork 620
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
TypeError because self._gradient_transform becomes str when using replace on execution_config in device preprocess() #6887
Comments
Hi @cvjjm , Thinking of alternatives, you mentioned you're trying to understand how to make |
This is not blocking (see workaround above). I just don't understand he behavior and suspect that this is a symptom of some sort of bug that may cause unexpected behavior in other places as well and thus wanted to report it. |
Hi @cvjjm, execution_config = replace(execution_config, use_device_gradient=True) |
facepalm, yes that will do the trick. I was so baffled by the strange error message about Out of curiosity: Why is |
I might be missing a detail here, but I think it is because this attribute is passed down from the gradient method specified in a workflow. So in this case, |
Would ne nice to check the exception config for consistency and throw a more useful error message. Just a suggestion. Closing this issue. Sorry for the noise... |
Thanks for the feedback @cvjjm ! We are indeed considering adding some extra validation to ensure we raise a clear error in these situations. So there's no noise here, it's useful to see the checks that we can add to improve! |
Apologies for the cryptic title. I currently do not know how to describe the issue better.
I am trying to understand how to make
pennylane >= 0.38
use device gradients when I stumbled across this strange behavior.In the code below I declare that my custom device supports first order derivatives in
supports_derivatives()
and then want to make the necessary changes to theexecution_config
inpreprocess()
. If I manually copy theexecution_config
and setexecution_config.use_device_gradient = True
all wors as it should. But when I usereplace
(as is done indevice_api.py
) I get a very crypticTypeError: 'str' object is not callable
error deep inside the jacobian_products workflow:Output is:
This happens with both
v0.38.1
and with the current master.The text was updated successfully, but these errors were encountered: