Deprecations¶
Pending deprecations¶
The RandomLayers.compute_decomposition keyword argument ratio_imprivitive will be changed to ratio_imprim to match the call signature of the operation.
Deprecated in v0.32
Removed in v0.33
qml.enable_return
andqml.disable_return
are deprecated. Please avoid callingdisable_return
, as the old return system is deprecated along with these switch functions.Deprecated in v0.32
Will be removed in v0.33
The
mode
keyword argument inQNode
is deprecated, as it was only used in the old return system (which is also deprecated). Please usegrad_on_execution
instead.Deprecated in v0.32
Will be removed in v0.33
The
observables
argument inQubitDevice.statistics
is deprecated. Please usecircuit
instead. Using a list of observables inQubitDevice.statistics
is deprecated. Please use aQuantumTape
instead.Still accessible in v0.28, v0.29, v0.30
Will be removed in v0.31
qml.ExpvalCost
has been deprecated, and usage will now raise a warning.Deprecated in v0.24
Will be removed in v0.32
Instead, it is recommended to simply pass Hamiltonians to the
qml.expval
function inside QNodes:@qml.qnode(dev) def ansatz(params): some_qfunc(params) return qml.expval(Hamiltonian)
The behaviour of
Operator.__eq__
andOperator.__hash__
will be updated soon. Their documentation has been updated to reflect the incoming changes.The upcoming changes to operator equality will allow users to use operator equality the same way as with
qml.equal
. With the changes to hashing, unique operators that are equal will have the same hash. These changes will allow behaviour such as the following:>>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) True >>> {qml.PauliZ(0), qml.PauliZ(0)} {PauliZ(wires=[0])}
Meanwhile, the current behaviour is shown below:
>>> qml.RX(0.1, wires=0) == qml.RX(0.1, wires=0) False >>> {qml.PauliZ(0), qml.PauliZ(0)} {PauliZ(wires=[0]), PauliZ(wires=[0])}
Added in v0.32
Behaviour will change in v0.33
The public methods of
DefaultQubit
are pending changes to follow the new device API, as used inDefaultQubit2
.We will be switching to the new device interface in a coming release. In this new interface, simulation implementation details will be abstracted away from the device class itself and provided by composition, rather than inheritance. Therefore, some public and private methods from
DefaultQubit
will no longer exist, though its behaviour in a workflow will remain the same.If you directly interact with device methods, please consult
pennylane.devices.experimental.Device
andpennylane.devices.experimental.DefaultQubit2
for more information on what the new interface will look like and be prepared to make updates in a coming release. If you have any feedback on these changes, please create an issue or post in our discussion forum.Deprecated in v0.31
qml.qchem.jordan_wigner
is deprecated, and usage will now raise a warning. Useqml.jordan_wigner
instead. List input to define the fermionic operator is also deprecated; the fermionic operatorsqml.FermiA
,qml.FermiC
,qml.FermiWord
andqml.FermiSentence
should be used instead. See thepennylane.fermi
module documentation and the Fermionic Operator tutorial for more details.The CV observables
qml.X
andqml.P
have been deprecated, and usage will now raise a warning. Please useqml.QuadX
andqml.QuadP
instead.Deprecated in v0.32
Will be removed in v0.33
The method
tape.unwrap()
and correspondingUnwrapTape
andUnwrap
classes are deprecated, and usage will now raise a warning.Instead of
tape.unwrap()
, useconvert_to_numpy_parameters()
:from pennylane.transforms import convert_to_numpy_parameters qscript = qml.tape.QuantumTape([qml.RX(torch.tensor(0.1234), 0)], [qml.expval(qml.Hermitian(torch.eye(2), 0))] ) unwrapped_qscript = convert_to_numpy_parameters(qscript) torch_params = qscript.get_parameters() numpy_params = unwrapped_qscript.get_parameters()
The
QuantumScript.set_parameters
method and theQuantumScript.data
setter has been deprecated. Please useQuantumScript.bind_new_parameters
instead.Deprecated in v0.32
Will be removed in v0.33
The
tuple
input type inqubit_observable
has been deprecated. Please use a fermionic operator object. Thetuple
return type infermionic_hamiltonian
andfermionic_observable
has been deprecated and these functions will return a fermionic operator by default.Deprecated in v0.32
Will be removed in v0.33
The
sampler_seed
argument ofqml.gradients.spsa_grad
has been deprecated, along with a bug fix of the seed-setting behaviour. Instead, thesampler_rng
argument should be set, either to an integer value, which will be used to create a PRNG internally, or to a NumPy pseudo-random number generator (PRNG) created vianp.random.default_rng(seed)
. The advantage of passing a PRNG is that one can reuse that PRNG when callingspsa_grad
multiple times, for instance during an optimization procedure.Deprecated in v0.32
Will be removed in v0.33
Completed deprecation cycles¶
qml.math.purity
,qml.math.vn_entropy
,qml.math.mutual_info
,qml.math.fidelity
,qml.math.relative_entropy
, andqml.math.max_entropy
no longer support state vectors as input. Please callqml.math.dm_from_state_vector
on the input before passing to any of these functions.Still accepted in v0.31
Removed in v0.32
The
do_queue
keyword argument inqml.operation.Operator
has been removed. This affects all child classes, such asOperation
,Observable
,SymbolicOp
and more. Instead of settingdo_queue=False
, use theqml.QueuingManager.stop_recording()
context.Deprecated in v0.31
Removed in v0.32
The
qml.specs
dictionary longer supports direct key access to certain keys. Instead these quantities can be accessed as fields of the newResources
object saved underspecs_dict["resources"]
:num_operations
is no longer supported, usespecs_dict["resources"].num_gates
num_used_wires
is no longer supported, usespecs_dict["resources"].num_wires
gate_types
is no longer supported, usespecs_dict["resources"].gate_types
gate_sizes
is no longer supported, usespecs_dict["resources"].gate_sizes
depth
is no longer supported, usespecs_dict["resources"].depth
These keys were still accessible in v0.31 and removed in v0.32.
qml.math.reduced_dm
has been removed. Please useqml.math.reduce_dm
orqml.math.reduce_statevector
instead.Still accessible in v0.31
Removed in v0.32
QuantumScript
’sname
keyword argument and property are removed. This also affectsQuantumTape
andOperationRecorder
.Deprecated in v0.31
Removed in v0.32
The
Operation.base_name
property is removed. Please useOperator.name
ortype(obj).__name__
instead.Still accessible in v0.31
Removed in v0.32
LieAlgebraOptimizer
has been renamed. Please useRiemannianGradientOptimizer
instead.Deprecated in v0.31
Removed in v0.32
The
grouping_type
andgrouping_method
arguments ofqchem.molecular_hamiltonian()
are removed.Deprecated in v0.31
Removed in v0.32
Instead, simply construct a new instance of
Hamiltonian
with the grouping specified:H, qubits = molecular_hamiltonian(symbols, coordinates) grouped_h = qml.Hamiltonian( H.coeffs, H.ops, grouping_type=grouping_type, groupingmethod=grouping_method, )
zyz_decomposition
andxyx_decomposition
are removed, useone_qubit_decomposition
with a rotations keyword instead.Deprecated in v0.31
Removed in v0.32
The
qml.utils.sparse_hamiltonian
function has been removed.~.Hamiltonian.sparse_matrix
should be used instead.Deprecated in v0.29
Removed in v0.31
The
collections
module has been removed.Deprecated in v0.29
Removed in v0.31
qml.op_sum
has been removed. Users should useqml.sum
instead.Deprecated in v0.29.
Removed in v0.31.
The argument
argnum
for gradient transforms using the Jax interface is replaced byargnums
.argnum
is automatically changed toargnums
for gradient transforms using JAX and a warning is raised in v0.30argnums
is the only option for gradient transforms using JAX in v0.31
Evolution
now adds a-1
to the input parameter. Beforehand, the minus sign was not included.Transition warning added in v0.29.
Updated to current behaviour in v0.30.
The
seed_recipes
argument inqml.classical_shadow
andqml.shadow_expval
has been removed. An argumentseed
which defaults toNone
can contain an integer with the wanted seed.Still accessible in v0.28, v0.29
Removed in v0.30
The
get_operation
tape method is updated to return the operation index as well, changing its signature.The new signature is available by changing the arg
return_op_index
toTrue
in v0.29The old signature is replaced with the new one in v0.30
The
grouping
module has been removed. The functionality has been moved and reorganized in the newpauli
module underpauli/utils.py
orpauli/grouping/
.Still accessible in v0.27, v0.28, v0.29, v0.30
Removed in v0.31
The functions from
grouping/pauli.py
,grouping/transformations.py
andgrouping/utils.py
have been moved topauli/utils.py
. The remaining functions have been consolidated in thepauli/grouping/
directory.qml.VQECost
is removed.Deprecated in 0.13
Removed in 0.29
In-place inversion —
op.inv()
andop.inverse=value
— is deprecated. Please useqml.adjoint
orqml.pow
instead.Still accessible in v0.27 and v0.28
Removed in v0.29
Don’t use:
>>> v1 = qml.PauliX(0).inv() >>> v2 = qml.PauliX(0) >>> v2.inverse = True
Instead, use:
>>> qml.adjoint(qml.PauliX(0)) Adjoint(PauliX(wires=[0])) >>> qml.pow(qml.PauliX(0), -1) PauliX(wires=[0])**-1 >>> qml.pow(qml.PauliX(0), -1, lazy=False) PauliX(wires=[0]) >>> qml.PauliX(0) ** -1 PauliX(wires=[0])**-1
The
qml.utils.decompose_hamiltonian()
method is removed. Please useqml.pauli_decompose()
.Still accessible in v0.27
Removed in v0.28
qml.tape.get_active_tape
is deprecated. Please useqml.QueuingManager.active_context()
instead.Deprecated in v0.27
Removed in v0.28
qml.transforms.qcut.remap_tape_wires
is deprecated. Please useqml.map_wires
instead.Deprecated in v0.27
Removed in v0.28
QuantumTape.inv()
is deprecated. Please useQuantumTape.adjoint()
instead. This method returns a new tape instead of modifying itself in-place.Deprecated in v0.27
Removed in v0.28
qml.tape.stop_recording
andQuantumTape.stop_recording
are moved toqml.QueuingManager.stop_recording
Deprecated in v0.27
Removed in v0.28
QueuingContext
is renamedQueuingManager
.Deprecated name
QueuingContext
in v0.27Removed in v0.28
QueuingManager.safe_update_info
andAnnotateQueue.safe_update_info
are removed.Deprecated in v0.27
Removed in v0.28
ObservableReturnTypes
Sample
,Variance
,Expectation
,Probability
,State
, andMidMeasure
are moved tomeasurements
fromoperation
.Deprecated in v0.23
Removed in v0.27
The
qml.utils.expand
function is deprecated.qml.math.expand_matrix
should be used instead.Deprecated in v0.24
Removed in v0.27
The
qml.Operation.get_parameter_shift
method is removed. Use the methods of thegradients
module for general parameter-shift rules instead.Deprecated in v0.22
Removed in v0.28
qml.transforms.measurement_grouping
has been removed. Please useqml.transforms.hamiltonian_expand
instead.Deprecated in v0.28
Removed in v0.29
qml.transforms.make_tape
was previously deprecated, but there is no longer a plan to remove it. It no longer raises a warning, and the functionality is unchanged.Deprecated in v0.28
Un-deprecated in v0.29