Deprecations¶
All PennyLane deprecations will raise a qml.exceptions.PennyLaneDeprecationWarning. Pending and completed
deprecations are listed below.
Pending deprecations¶
Setting shots on a device through the
shotskeyword argument is deprecated. Instead, please specify shots using theshotskeyword argument ofQNode, or use thepennylane.set_shots()transform on theQNode.dev = qml.device("default.qubit", wires=2) @qml.qnode(dev, shots=1000) def circuit(x): qml.RX(x, wires=0) return qml.expval(qml.Z(0)) circuit_analytic = qml.set_shots(circuit, None)
Deprecated in v0.43
Will be removed in a future version
Maintenance support for the
tensorflowinterface has been deprecated and will be dropped in PennyLane v0.44. Future versions of PennyLane are not guaranteed to work with TensorFlow. Instead, we recommend using the jax or torch interface for machine learning applications to benefit from enhanced support and features.Deprecated in v0.43
Will be removed in v0.44
pennylane.devices.DefaultExecutionConfigis deprecated and will be removed in v0.44. Instead, useqml.devices.ExecutionConfig()to create a default execution configuration.Deprecated in v0.43
Will be removed in v0.44
Specifying the
work_wire_typeargument inqml.ctrland other controlled operators as"clean"or"dirty"is deprecated. Use"zeroed"to indicate that the work wires are initially in the \(|0\rangle\) state, and"borrowed"to indicate that the work wires can be in any arbitrary state. In both cases, the work wires are restored to their original state upon completing the decomposition.Deprecated in v0.43
Will be removed in v0.44
Providing
num_stepstopennylane.evolve(),pennylane.exp(),pennylane.ops.Evolution, andpennylane.ops.Expis deprecated and will be removed in a future release. Instead, useTrotterProductfor approximate methods, providing thenparameter to perform the Suzuki-Trotter product approximation of a Hamiltonian with the specified number of Trotter steps.As a concrete example, consider the following case:
coeffs = [0.5, -0.6] ops = [qml.X(0), qml.X(0) @ qml.Y(1)] H_flat = qml.dot(coeffs, ops)
Instead of computing the Suzuki-Trotter product approximation as:
>>> qml.evolve(H_flat, num_steps=2).decomposition() [RX(0.5, wires=[0]), PauliRot(-0.6, XY, wires=[0, 1]), RX(0.5, wires=[0]), PauliRot(-0.6, XY, wires=[0, 1])]
The same result can be obtained using
TrotterProductas follows:>>> decomp_ops = qml.adjoint(qml.TrotterProduct(H_flat, time=1.0, n=2)).decomposition() >>> [simp_op for op in decomp_ops for simp_op in map(qml.simplify, op.decomposition())] [RX(0.5, wires=[0]), PauliRot(-0.6, XY, wires=[0, 1]), RX(0.5, wires=[0]), PauliRot(-0.6, XY, wires=[0, 1])]
Deprecated in v0.43
Will be removed in a future version
MeasurementProcess.expandis deprecated. The relevant method can be replaced withqml.tape.QuantumScript(mp.obs.diagonalizing_gates(), [type(mp)(eigvals=mp.obs.eigvals(), wires=mp.obs.wires)]).Deprecated in v0.43
Will be removed in v0.44
Specifying
shotsas a keyword argument when executing aQNodeis deprecated and will be removed in v0.44. Instead, please set shots onQNodeinitialization, or use theset_shots()transform to set the number of shots.Deprecated in v0.43
Will be removed in v0.44
The
QuantumScript.shapeandQuantumScript.numeric_typeproperties are deprecated and will be removed in version v0.44. Instead, the corresponding.shapeor.numeric_typeof theMeasurementProcessclass should be used.Deprecated in v0.43
Will be removed in v0.44
Some unnecessary methods of the
qml.CircuitGraphclass are deprecated and will be removed in version v0.44:print_contentsin favor ofprint(obj)observables_in_orderin favor ofobservablesoperations_in_orderin favor ofoperationsancestors_in_order(obj)in favor ofancestors(obj, sort=True)descendants_in_order(obj)in favor ofdescendants(obj, sort=True)
Deprecated in v0.43
Will be removed in v0.44
The
QuantumScript.to_openqasmmethod is deprecated and will be removed in version v0.44. Instead, theqml.to_openqasmfunction should be used.Deprecated in v0.43
Will be removed in v0.44
qml.qnn.cost.SquaredErrorLossis deprecated and will be removed in version v0.44. Instead, this hybrid workflow can be accomplished with a function likeloss = lambda *args: (circuit(*args) - target)**2.Deprecated in v0.43
Will be removed in v0.44
Access to
add_noise,insertand noise mitigation transforms from thepennylane.transformsmodule is deprecated. Instead, these functions should be imported from thepennylane.noisemodule.Deprecated in v0.43
Will be removed in v0.44
Passing the value
Noneto thelevelargument in thepennylane.workflow.get_transform_program(),pennylane.workflow.construct_batch(),pennylane.draw(),pennylane.draw_mpl(), andpennylane.specs()transforms is deprecated and will be removed in v0.44. Please uselevel='device'instead to apply the transform at the device level.Deprecated in v0.43
Will be removed in v0.44
The
qml.QNode.add_transformmethod is deprecated and will be removed in v0.44. Instead, please useQNode.transform_program.push_back(transform_container=transform_container).Deprecated in v0.43
Will be removed in v0.44
Completed removal of legacy operator arithmetic¶
In PennyLane v0.40, the legacy operator arithmetic system has been removed, and is fully replaced by the new operator arithmetic functionality that was introduced in v0.36. Check out the Updated operators page for details on how to port your legacy code to the new system. The following functionality has been removed:
In PennyLane v0.40, legacy operator arithmetic has been removed. This includes
pennylane.operation.enable_new_opmath(),pennylane.operation.disable_new_opmath(),pennylane.ops.Hamiltonian, andpennylane.operation.Tensor. Note thatqml.Hamiltonianwill continue to dispatch topennylane.ops.LinearCombination.Deprecated in v0.39
Removed in v0.40
pennylane.pauli.PauliSentence.hamiltonian()andpennylane.pauli.PauliWord.hamiltonian()have been removed. Instead, please usepennylane.pauli.PauliSentence.operation()andpennylane.pauli.PauliWord.operation()respectively.Deprecated in v0.39
Removed in v0.40
pennylane.pauli.simplify()has been removed. Instead, please usepennylane.simplify()orpennylane.operation.Operator.simplify().Deprecated in v0.39
Removed in v0.40
Completed deprecation cycles¶
The boolean functions provided by
pennylane.operationhave been removed. See below for an example of alternative code to use. These includenot_tape,has_gen,has_grad_method,has_multipar,has_nopar,has_unitary_gen,is_measurement,defines_diagonalizing_gates, andgen_is_multi_term_hamiltonian.Deprecated in v0.42
Removed in v0.43
from pennylane.operation import TermsUndefinedError, Operator
def not_tape(obj):
return not isinstance(obj, qml.tape.QuantumScript)
def has_gen(obj):
return obj.has_generator
def has_grad_method(obj):
return obj.grad_method is not None
def has_multipar(obj):
return obj.num_params > 1
def has_nopar(obj):
return obj.num_params == 0
def has_unitary_gen(obj):
return obj in qml.ops.qubit.attributes.has_unitary_generator
def is_measurement(obj):
return isinstance(obj, qml.measurements.MeasurementProcess)
def defines_diagonalizing_gates(obj):
return obj.has_diagonalizing_gates
def gen_is_multi_term_hamiltonian(obj):
if not isinstance(obj, Operator) or not obj.has_generator:
return False
try:
generator = obj.generator()
_, ops = generator.terms()
return len(ops) > 1
except TermsUndefinedError:
return False
lie_closure,structure_constants, andcentercan no longer be accessed viaqml.pauli. Top level import and usage is advised. They now live in theliealgmodule.import pennylane.liealg from pennylane.liealg import lie_closure, structure_constants, center
Deprecated in v0.40
Removed in v0.43
qml.operation.Observablehas been removed. To indicate that an operator is an observable, operator developers should manually setis_hermitian = Trueand update thequeuefunction to stop it from being processed into the circuit.class MyObs(Operator): is_hermitian = True def queue(self, context=qml.QueuingManager): return self
To check if an operator is likely to be hermitian, the
op.is_hermitianproperty can be checked.Instead of
Observable.compare,qml.equalandop1 == op2should be used to compare instances.Deprecated in v0.42
Removed in v0.43
qml.operation.WiresEnum,qml.operation.AllWires, andqml.operation.AnyWireshave been removed. If an operation can act on any number of wires,Operator.num_wires = Noneshould be used instead. This is the default, and does not need to be overridden unless the operator developer wants to validate that the correct number of wires is passed.Deprecated in v0.42
Removed in v0.43
The
qml.QNode.get_gradient_fnmethod has been removed. Instead, useget_best_diff_method()to obtain the differentiation method.Deprecated in v0.42
Removed in v0.43
Top-level access to
DeviceError,PennyLaneDeprecationWarning,QuantumFunctionErrorandExperimentalWarningis now removed in v0.43. Please import these objects from the newpennylane.exceptionsmodule.Deprecated in v0.42
Removed in v0.43
Specifying gradient keyword arguments as any additional keyword argument to the qnode is now removed in v0.42. The gradient keyword arguments should be passed to the new keyword argument
gradient_kwargsvia an explicit dictionary, likegradient_kwargs={"h": 1e-4}.Deprecated in v0.41
Removed in v0.42
The
return_typeproperty ofMeasurementProcesshas been removed. If observable type checking is needed, please useisinstanceinstead.Deprecated in v0.41
Removed in v0.42
The
KerasLayerclass inqml.qnn.kerashas been removed because Keras 2 is no longer actively maintained. Please consider using a different machine learning framework, like PyTorch or JAX.Deprecated in v0.41
Removed in v0.42
The
qml.gradients.hamiltonian_gradfunction has been removed because this gradient recipe is no longer required with the new operator arithmetic system.Deprecated in v0.41
Removed in v0.42
Accessing terms of a tensor product (e.g.,
op = X(0) @ X(1)) viaop.obshas been removed. A user should useop.operandsinstead.Deprecated in v0.36
Removed in v0.42
The
mcm_configkeyword argument toqml.executehas been removed. Instead, use themcm_methodandpostselect_modearguments.Deprecated in v0.41
Removed in v0.42
The
inner_transformandconfigkeyword arguments inqml.executehave been removed. If more detailed control over the execution is required, useqml.workflow.runwith these arguments instead.Deprecated in v0.41
Removed in v0.42
op.opsandop.coeffsforSumandProdhave been removed. Instead, please useterms().Deprecated in v0.35
Removed in v0.42
Specifying
pipeline=Nonewithqml.compilehas been removed. A sequence of transforms should now always be specified.Deprecated in v0.41
Removed in v0.42
The
control_wiresargument in theqml.ControlledQubitUnitaryclass has been removed. Instead, please use thewiresargument.Deprecated in v0.41
Removed in v0.42
The
ControlledQubitUnitaryno longer accepts QubitUnitary objects as arguments as itsbase. Instead, useqml.ctrlto construct a controlled QubitUnitary.Deprecated in v0.41
Removed in v0.42
MultiControlledXno longer accepts strings as control values.Deprecated in v0.36
Removed in v0.41
The input argument
control_wiresofMultiControlledXhas been removed.Deprecated in v0.22
Removed in v0.41
The
decomp_depthargument inset_decomposition()has been removed.Deprecated in v0.40
Removed in v0.41
The
max_expansionargument indecompose()has been removed.Deprecated in v0.40
Removed in v0.41
The
tapeandqtapeproperties ofQNodehave been removed. Instead, use theqml.workflow.construct_tapefunction.Deprecated in v0.40
Removed in v0.41
The
gradient_fnkeyword argument toqml.executehas been removed. Instead, it has been replaced withdiff_method.Deprecated in v0.40
Removed in v0.41
The
QNode.get_best_methodandQNode.best_method_strmethods have been removed. Instead, use theqml.workflow.get_best_diff_methodfunction.Deprecated in v0.40
Removed in v0.41
The
output_dimproperty ofqml.tape.QuantumScripthas been removed. Instead, use methodshapeofQuantumScriptorMeasurementProcessto get the same information.Deprecated in v0.40
Removed in v0.41
The
qml.qsvt_legacyfunction has been removed. Instead, useqml.qsvt. The new functionality takes an input polynomial instead of angles.Deprecated in v0.40
Removed in v0.41
The
qml.qinfomodule has been removed. Please see the respective functions in theqml.mathandqml.measurementsmodules instead.Deprecated in v0.39
Removed in v0.40
Top level access to
Device,QubitDevice, andQutritDevicehave been removed. Instead, they are available asqml.devices.LegacyDevice,qml.devices.QubitDevice, andqml.devices.QutritDevicerespectively.Deprecated in v0.39
Removed in v0.40
The
BasisStatePreparationtemplate has been removed. Instead, useBasisState.Deprecated in v0.39
Removed in v0.40
The
qml.QubitStateVectortemplate has been removed. Instead, useStatePrep.Deprecated in v0.39
Removed in v0.40
qml.broadcasthas been removed. Users should useforloops instead.Deprecated in v0.39
Removed in v0.40
The
max_expansionargument forclifford_t_decomposition()has been removed.Deprecated in v0.39
Removed in v0.40
The
'ancilla'argument foriterative_qpe()has been removed. Instead, use the'aux_wire'argument.Deprecated in v0.39
Removed in v0.40
The
expand_depthargument forcompile()has been removed.Deprecated in v0.39
Removed in v0.40
The
qml.workflow.set_shotshelper function has been removed. We no longer interact with the legacy device interface in our code. Instead, shots should be specified on the tape, and the device should use these shots.Deprecated in v0.38
Removed in v0.40
QNode.gradient_fnis removed. Please useQNode.diff_methodinstead.QNode.get_gradient_fncan also be used to process the diff method.Deprecated in v0.39
Removed in v0.40
The
qml.shadows.shadow_expvaltransform has been removed. Instead, please use theqml.shadow_expvalmeasurement process.Deprecated in v0.39
Removed in v0.40
PennyLane Lightning and Catalyst will no longer support
manylinux2014(GLIBC 2.17) compatibile Linux operating systems, and will be migrated tomanylinux_2_28(GLIBC 2.28). See pypa/manylinux for additional details.Last supported version of
manylinux2014with v0.36Fully migrated to
manylinux_2_28with v0.37
The
simplifyargument inqml.Hamiltonianandqml.ops.LinearCombinationhas been removed. Instead,qml.simplify()can be called on the constructed operator.Deprecated in v0.37
Removed in v0.39
The
decomp_depthargument inqml.deviceis removed.Deprecated in v0.38
Removed in v0.39
The functions
qml.qinfo.classical_fisherandqml.qinfo.quantum_fisherhave been removed and migrated to theqml.gradientsmodule. Therefore,qml.gradients.classical_fisherandqml.gradients.quantum_fishershould be used instead.Deprecated in v0.38
Removed in v0.39
All of the legacy devices (any with the name
default.qubit.{autograd,torch,tf,jax,legacy}) are removed. Usedefault.qubitinstead, as it supports backpropagation for the many backends the legacy devices support.Deprecated in v0.38
Removed in v0.39
The logic for internally switching a device for a different backpropagation compatible device is removed, as it was in place for removed
default.qubit.legacy.Deprecated in v0.38
Removed in v0.39
Operator.expand is now removed. Use qml.tape.QuantumScript(op.decomposition()) instead.
Deprecated in v0.38
Removed in v0.39
The
expansion_strategyattribute ofqml.QNodeis removed. Users should make use ofqml.workflow.construct_batch, should they require fine control over the output tape(s).Deprecated in v0.38
Removed in v0.39
The
expansion_strategyargument inqml.specs,qml.draw, andqml.draw_mplis removed. Instead, use thelevelargument which provides a superset of options.Deprecated in v0.38
Removed in v0.39
The
max_expansionargument inqml.QNodeis removed.Deprecated in v0.38
Removed in v0.39
The
expand_fnargument inqml.executeis removed. Instead, please create aqml.transforms.core.TransformProgramwith the desired preprocessing and pass it to thetransform_programargument ofqml.execute.Deprecated in v0.38
Removed in v0.39
The
max_expansionargument inqml.executeis removed. Instead, please useqml.devices.preprocess.decomposewith the desired expansion level, add it to aTransformProgram, and pass it to thetransform_programargument ofqml.execute.Deprecated in v0.38
Removed in v0.39
The
override_shotsargument inqml.executeis removed. Instead, please add the shots to theQuantumTapes to be executed.Deprecated in v0.38
Removed in v0.39
The
device_batch_transformargument inqml.executeis removed. Instead, please create aqml.transforms.core.TransformProgramwith the desired preprocessing and pass it to thetransform_programargument ofqml.execute.Deprecated in v0.38
Removed in v0.39
The functions
qml.transforms.sum_expandandqml.transforms.hamiltonian_expandare removed. Instead,qml.transforms.split_non_commutingcan be used for equivalent behaviour.Deprecated in v0.38
Removed in v0.39
queue_idxattribute has been removed from theOperator,CompositeOp, andSymboliOpclasses. Instead, the index is now stored as the label of theCircuitGraph.graphnodes.Deprecated in v0.38
Removed in v0.38
qml.from_qasmno longer removes measurements from the QASM code. Usemeasurements=[]to remove measurements from the original circuit.Deprecated in v0.37
Default behaviour changed in v0.38
qml.transforms.map_batch_transformhas been removed, since transforms can be applied directly to a batch of tapes. Seetransform()for more information.Deprecated in v0.37
Removed in v0.38
qml.from_qasm_filehas been removed. Instead, the user can open the file and then load its content usingqml.from_qasm.>>> with open("test.qasm", "r") as f: ... circuit = qml.from_qasm(f.read())
Deprecated in v0.36
Removed in v0.37
The
qml.loadfunction is a general-purpose way to convert circuits into PennyLane from other libraries. It has been removed in favour of the more specific functionsfrom_qiskit,from_qasm, etc.Deprecated in v0.36
Removed in v0.37
single_tape_transform,batch_transform,qfunc_transform,op_transform,gradient_transformandhessian_transformare deprecated. Instead switch to using the newqml.transformfunction. Please refer to the transform docs to see how this can be done.Deprecated in v0.34
Removed in v0.36
PauliWordandPauliSentenceno longer use*for matrix and tensor products, but instead use@to conform with the PennyLane convention.Deprecated in v0.35
Removed in v0.36
The private functions
_pauli_mult,_binary_matrixand_get_pauli_mapfrom thepaulimodule have been removed, as they are no longer used anywhere and the same functionality can be achieved using newer features in thepaulimodule.Deprecated in v0.35
Removed in v0.36
Calling
qml.matrixwithout providing awire_orderon objects where the wire order could be ambiguous now raises an error. This includes tapes with multiple wires, QNodes with a device that does not provide wires, or quantum functions.Deprecated in v0.35
Raises an error in v0.36
qml.pauli.pauli_multandqml.pauli.pauli_mult_with_phaseare now removed. Instead, you should useqml.simplify(qml.prod(pauli_1, pauli_2))to get the reduced operator.>>> op = qml.simplify(qml.prod(qml.PauliX(0), qml.PauliZ(0))) >>> op -1j*(PauliY(wires=[0])) >>> [phase], [base] = op.terms() >>> phase, base (-1j, PauliY(wires=[0]))
Deprecated in v0.35
Removed in v0.36
MeasurementProcess.nameandMeasurementProcess.datahave been removed, as they contain dummy values that are no longer needed.Deprecated in v0.35
Removed in v0.36
The contents of
qml.interfacesis moved insideqml.workflow.Contents moved in v0.35
Old import path removed in v0.36
The method
Operator.validate_subspace(subspace), only employed under a specific set of qutrit operators, has been relocated to theqml.ops.qutrit.parametric_opsmodule and has been removed from theOperatorclass.Deprecated in v0.35
Removed in v0.36
qml.transforms.one_qubit_decompositionandqml.transforms.two_qubit_decompositionare removed. Instead, you should useqml.ops.one_qubit_decompositionandqml.ops.two_qubit_decomposition.Deprecated in v0.34
Removed in v0.35
Passing additional arguments to a transform that decorates a QNode should now be done through use of
functools.partial. For example, themetric_tensor()transform has an optionalapproxargument which should now be set using:from functools import partial @partial(qml.metric_tensor, approx="block-diag") @qml.qnode(dev) def circuit(weights): ...
The previously-recommended approach is now removed:
@qml.metric_tensor(approx="block-diag") @qml.qnode(dev) def circuit(weights): ...
Alternatively, consider calling the transform directly:
@qml.qnode(dev) def circuit(weights): ... transformed_circuit = qml.metric_tensor(circuit, approx="block-diag")
Deprecated in v0.33
Removed in v0.35
Observable.return_typehas been removed. Instead, you should inspect the type of the surrounding measurement process.Deprecated in v0.34
Removed in v0.35
ClassicalShadow.entropy()no longer needs anatolkeyword as a better method to estimate entropies from approximate density matrix reconstructions (with potentially negative eigenvalues) has been implemented.Deprecated in v0.34
Removed in v0.35
QuantumScript.is_sampledandQuantumScript.all_sampledhave been removed. Users should now validate these properties manually.from pennylane.measurements import * sample_types = (SampleMP, CountsMP, ClassicalShadowMP, ShadowExpvalMP) is_sample_type = [isinstance(m, sample_types) for m in tape.measurements] is_sampled = any(is_sample_type) all_sampled = all(is_sample_type)
Deprecated in v0.34
Removed in v0.35
qml.ExpvalCosthas been removed. Users should useqml.expval()instead.@qml.qnode(dev) def cost_function(params): some_qfunc(params) return qml.expval(Hamiltonian)
Deprecated in v0.24
Removed in v0.35
Specifying
control_valuespassed toqml.ctrlas a string is no longer supported.Deprecated in v0.25
Removed in v0.34
qml.gradients.pulse_generatorhas becomeqml.gradients.pulse_odegento adhere to paper naming conventions.Deprecated in v0.33
Removed in v0.34
The
prepkeyword argument inQuantumScripthas been removed.StatePrepBaseoperations should be placed at the beginning of theopslist instead.Deprecated in v0.33
Removed in v0.34
The public methods of
DefaultQubitare pending changes to follow the new device API.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
DefaultQubitwill no longer exist, though its behaviour in a workflow will remain the same.If you directly interact with device methods, please consult
pennylane.devices.Deviceandpennylane.devices.DefaultQubitfor 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
Changed in v0.33
The behaviour of
Operator.__eq__andOperator.__hash__has been updated. Their documentation has been updated to reflect the incoming changes.The changes to operator equality allow users to use operator equality the same way as with
qml.equal. With the changes to hashing, unique operators that are equal now have the same hash. These changes now 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 previous 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 changed in v0.33
qml.qchem.jordan_wignerhad been removed. Useqml.jordan_wignerinstead. List input to define the fermionic operator is no longer accepted; the fermionic operatorsqml.FermiA,qml.FermiC,qml.FermiWordandqml.FermiSentenceshould be used instead. See thepennylane.fermimodule documentation and the Fermionic Operator tutorial for more details.Deprecated in v0.32
Removed in v0.33
The
tupleinput type inqubit_observablehas been removed. Please use a fermionic operator object. Thetuplereturn type infermionic_hamiltonianandfermionic_observablehas been removed and these functions will return a fermionic operator by default.Deprecated in v0.32
Removed in v0.33
The
sampler_seedargument ofqml.gradients.spsa_gradhas been removed. Instead, thesampler_rngargument 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_gradmultiple times, for instance during an optimization procedure.Deprecated in v0.32
Removed in v0.33
The
RandomLayers.compute_decompositionkeyword argumentratio_imprivitivehas been changed toratio_imprimto match the call signature of the operation.Deprecated in v0.32
Removed in v0.33
The
QuantumScript.set_parametersmethod and theQuantumScript.datasetter have been removed. Please useQuantumScript.bind_new_parametersinstead.Deprecated in v0.32
Removed in v0.33
The
observablesargument inQubitDevice.statisticsis removed. Please usecircuitinstead. Using a list of observables inQubitDevice.statisticsis removed. Please use aQuantumTapeinstead.Still accessible in v0.28-v0.31
Removed in v0.32
The CV observables
qml.Xandqml.Phave been removed. Useqml.QuadXandqml.QuadPinstead.Deprecated in v0.32
Removed in v0.33
The method
tape.unwrap()and correspondingUnwrapTapeandUnwrapclasses are removed.Deprecated in v0.32
Removed in v0.33
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()
qml.enable_returnandqml.disable_returnhave been removed. The old return types are no longer available.Deprecated in v0.32
Removed in v0.33
The
modekeyword argument inQNodehas been removed, as it was only used in the old return system (which has also been removed). Please usegrad_on_executioninstead.Deprecated in v0.32
Removed in v0.33
qml.math.purity,qml.math.vn_entropy,qml.math.mutual_info,qml.math.fidelity,qml.math.relative_entropy, andqml.math.max_entropyno longer support state vectors as input. Please callqml.math.dm_from_state_vectoron the input before passing to any of these functions.Still accepted in v0.31
Removed in v0.32
The
do_queuekeyword argument inqml.operation.Operatorhas been removed. This affects all child classes, such asOperation,Observable,SymbolicOpand more. Instead of settingdo_queue=False, use theqml.QueuingManager.stop_recording()context.Deprecated in v0.31
Removed in v0.32
The
qml.specsdictionary longer supports direct key access to certain keys. Instead these quantities can be accessed as fields of the newResourcesobject saved underspecs_dict["resources"]:num_operationsis no longer supported, usespecs_dict["resources"].num_gatesnum_used_wiresis no longer supported, usespecs_dict["resources"].num_wiresgate_typesis no longer supported, usespecs_dict["resources"].gate_typesgate_sizesis no longer supported, usespecs_dict["resources"].gate_sizesdepthis no longer supported, usespecs_dict["resources"].depth
These keys were still accessible in v0.31 and removed in v0.32.
qml.math.reduced_dmhas been removed. Please useqml.math.reduce_dmorqml.math.reduce_statevectorinstead.Still accessible in v0.31
Removed in v0.32
QuantumScript’snamekeyword argument and property are removed. This also affectsQuantumTapeandOperationRecorder.Deprecated in v0.31
Removed in v0.32
The
Operation.base_nameproperty is removed. Please useOperator.nameortype(obj).__name__instead.Still accessible in v0.31
Removed in v0.32
LieAlgebraOptimizerhas been renamed. Please useRiemannianGradientOptimizerinstead.Deprecated in v0.31
Removed in v0.32
The
grouping_typeandgrouping_methodarguments ofqchem.molecular_hamiltonian()are removed.Deprecated in v0.31
Removed in v0.32
Instead, simply construct a new instance of
Hamiltonianwith 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_decompositionandxyx_decompositionare removed, useone_qubit_decompositionwith a rotations keyword instead.Deprecated in v0.31
Removed in v0.32
The
qml.utils.sparse_hamiltonianfunction has been removed.~.Hamiltonian.sparse_matrixshould be used instead.Deprecated in v0.29
Removed in v0.31
The
collectionsmodule has been removed.Deprecated in v0.29
Removed in v0.31
qml.op_sumhas been removed. Users should useqml.suminstead.Deprecated in v0.29.
Removed in v0.31.
The argument
argnumfor gradient transforms using the Jax interface is replaced byargnums.argnumis automatically changed toargnumsfor gradient transforms using JAX and a warning is raised in v0.30argnumsis the only option for gradient transforms using JAX in v0.31
Evolutionnow adds a-1to 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_recipesargument inqml.classical_shadowandqml.shadow_expvalhas been removed. An argumentseedwhich defaults toNonecan contain an integer with the wanted seed.Still accessible in v0.28, v0.29
Removed in v0.30
The
get_operationtape method is updated to return the operation index as well, changing its signature.The new signature is available by changing the arg
return_op_indextoTruein v0.29The old signature is replaced with the new one in v0.30
The
groupingmodule has been removed. The functionality has been moved and reorganized in the newpaulimodule underpauli/utils.pyorpauli/grouping/.Still accessible in v0.27, v0.28, v0.29, v0.30
Removed in v0.31
The functions from
grouping/pauli.py,grouping/transformations.pyandgrouping/utils.pyhave been moved topauli/utils.py. The remaining functions have been consolidated in thepauli/grouping/directory.qml.VQECostis removed.Deprecated in 0.13
Removed in 0.29
In-place inversion —
op.inv()andop.inverse=value— is deprecated. Please useqml.adjointorqml.powinstead.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_tapeis deprecated. Please useqml.QueuingManager.active_context()instead.Deprecated in v0.27
Removed in v0.28
qml.transforms.qcut.remap_tape_wiresis deprecated. Please useqml.map_wiresinstead.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_recordingandQuantumTape.stop_recordingare moved toqml.QueuingManager.stop_recordingDeprecated in v0.27
Removed in v0.28
QueuingContextis renamedQueuingManager.Deprecated name
QueuingContextin v0.27Removed in v0.28
QueuingManager.safe_update_infoandAnnotateQueue.safe_update_infoare removed.Deprecated in v0.27
Removed in v0.28
ObservableReturnTypesSample,Variance,Expectation,Probability,State, andMidMeasureare moved tomeasurementsfromoperation.Deprecated in v0.23
Removed in v0.27
The
qml.utils.expandfunction is deprecated.qml.math.expand_matrixshould be used instead.Deprecated in v0.24
Removed in v0.27
The
qml.Operation.get_parameter_shiftmethod is removed. Use the methods of thegradientsmodule for general parameter-shift rules instead.Deprecated in v0.22
Removed in v0.28
qml.transforms.measurement_groupinghas been removed. Please useqml.transforms.hamiltonian_expandinstead.Deprecated in v0.28
Removed in v0.29
qml.transforms.make_tapewas 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