qml.workflow.get_best_diff_method¶
- get_best_diff_method(qnode)[source]¶
Returns a function that computes the ‘best’ differentiation method for a particular QNode.
This method prioritizes differentiation methods in the following order (SPSA-based and Hadamard-based gradients are not included here):
"device"
"backprop"
"parameter-shift"
Note
The first differentiation method that is supported (from top to bottom) will be returned. The order is designed to maximize efficiency, generality, and stability.
See also
For a detailed comparison of the backpropagation and parameter-shift methods, refer to the quantum gradients with backpropagation example.
- Parameters
qnode (QNode) – the qnode to get the ‘best’ differentiation method for.
- Returns
the gradient transform.
- Return type
str
code/api/pennylane.workflow.get_best_diff_method
Download Python script
Download Notebook
View on GitHub