In the interface documentation it states:
If not specified, the default differentiation method is
diff_method="best". PennyLane will attempt to determine the best differentiation method given the device and interface. Typically, PennyLane will prioritize device-provided gradients, backpropagation, parameter-shift rule, and finally finite differences, in that order.
diff_method="best" is there a way to print out/inform the user which
diff_method was ultimately selected and used in the computation? For some reason I can’t find how to do this in the documentation.
Also given that PennyLane 0.30 is a fairly recent release (and some of us are still using 0.29), would such method to print out the
diff_method be different between v0.30 and v0.29?
Hey @QML! Great question. To see what
diff_method was assigned, you can use the
diff_method attribute for QNodes:
dev = qml.device("default.qubit", wires=1)
In this case,
"best" . The hierarchy of differentiation methods is listed here in the docs:
Hope this helps!
Hey @isaacdevlugt! Thanks for the quick response. I ran your code and I can confirm that
"best" ( ) but unfortunately for PennyLane to return
"best" doesn’t really help - what I’m looking for is to have
print(circuit.diff_method) return either
- some other type of diff_method (as
"device" aren’t mathematical differentiation methods)
Is there a way to do this?
Sure! You can do this
That’s exactly it! Thank you!
Awesome! Glad I could help.