RandomLayerAllTypes#
- class torchquantum.layer.RandomLayerAllTypes(wires, n_ops=None, n_params=None, op_ratios=None, op_types=(<class 'torchquantum.operator.standard_gates.hadamard.Hadamard'>, <class 'torchquantum.operator.standard_gates.hadamard.SHadamard'>, <class 'torchquantum.operator.standard_gates.paulix.PauliX'>, <class 'torchquantum.operator.standard_gates.pauliy.PauliY'>, <class 'torchquantum.operator.standard_gates.pauliz.PauliZ'>, <class 'torchquantum.operator.standard_gates.s.S'>, <class 'torchquantum.operator.standard_gates.t.T'>, <class 'torchquantum.operator.standard_gates.sx.SX'>, <class 'torchquantum.operator.standard_gates.paulix.CNOT'>, <class 'torchquantum.operator.standard_gates.pauliz.CZ'>, <class 'torchquantum.operator.standard_gates.pauliy.CY'>, <class 'torchquantum.operator.standard_gates.rx.RX'>, <class 'torchquantum.operator.standard_gates.ry.RY'>, <class 'torchquantum.operator.standard_gates.rz.RZ'>, <class 'torchquantum.operator.standard_gates.rz.RZZ'>, <class 'torchquantum.operator.standard_gates.swap.SWAP'>, <class 'torchquantum.operator.standard_gates.swap.CSWAP'>, <class 'torchquantum.operator.standard_gates.toffoli.Toffoli'>, <class 'torchquantum.operator.standard_gates.phase_shift.PhaseShift'>, <class 'torchquantum.operator.standard_gates.rot.Rot'>, <class 'torchquantum.operator.standard_gates.rz.MultiRZ'>, <class 'torchquantum.operator.standard_gates.rx.CRX'>, <class 'torchquantum.operator.standard_gates.ry.CRY'>, <class 'torchquantum.operator.standard_gates.rz.CRZ'>, <class 'torchquantum.operator.standard_gates.rot.CRot'>, <class 'torchquantum.operator.standard_gates.u1.U1'>, <class 'torchquantum.operator.standard_gates.u2.U2'>, <class 'torchquantum.operator.standard_gates.u3.U3'>, <class 'torchquantum.operator.standard_gates.paulix.MultiCNOT'>, <class 'torchquantum.operator.standard_gates.paulix.MultiXCNOT'>), seed=None, qiskit_compatible=False)[source]#
Bases:
RandomLayer
Random layer with a wide range of quantum gate types.
This class extends the RandomLayer class to include a variety of quantum gate types as options for the random layer.
- Parameters:
wires (int or list) – Indices of the wires the operations are applied to.
n_ops (int) – Number of operations in the layer.
n_params (int) – Number of parameters for each operation.
op_ratios (list) – Ratios for selecting different types of operations.
op_types (tuple) – Types of operations to include in the layer.
seed (int) – Seed for the random number generator.
qiskit_compatible (bool) – Flag indicating whether the layer should be Qiskit-compatible.
- __init__(wires, n_ops=None, n_params=None, op_ratios=None, op_types=(<class 'torchquantum.operator.standard_gates.hadamard.Hadamard'>, <class 'torchquantum.operator.standard_gates.hadamard.SHadamard'>, <class 'torchquantum.operator.standard_gates.paulix.PauliX'>, <class 'torchquantum.operator.standard_gates.pauliy.PauliY'>, <class 'torchquantum.operator.standard_gates.pauliz.PauliZ'>, <class 'torchquantum.operator.standard_gates.s.S'>, <class 'torchquantum.operator.standard_gates.t.T'>, <class 'torchquantum.operator.standard_gates.sx.SX'>, <class 'torchquantum.operator.standard_gates.paulix.CNOT'>, <class 'torchquantum.operator.standard_gates.pauliz.CZ'>, <class 'torchquantum.operator.standard_gates.pauliy.CY'>, <class 'torchquantum.operator.standard_gates.rx.RX'>, <class 'torchquantum.operator.standard_gates.ry.RY'>, <class 'torchquantum.operator.standard_gates.rz.RZ'>, <class 'torchquantum.operator.standard_gates.rz.RZZ'>, <class 'torchquantum.operator.standard_gates.swap.SWAP'>, <class 'torchquantum.operator.standard_gates.swap.CSWAP'>, <class 'torchquantum.operator.standard_gates.toffoli.Toffoli'>, <class 'torchquantum.operator.standard_gates.phase_shift.PhaseShift'>, <class 'torchquantum.operator.standard_gates.rot.Rot'>, <class 'torchquantum.operator.standard_gates.rz.MultiRZ'>, <class 'torchquantum.operator.standard_gates.rx.CRX'>, <class 'torchquantum.operator.standard_gates.ry.CRY'>, <class 'torchquantum.operator.standard_gates.rz.CRZ'>, <class 'torchquantum.operator.standard_gates.rot.CRot'>, <class 'torchquantum.operator.standard_gates.u1.U1'>, <class 'torchquantum.operator.standard_gates.u2.U2'>, <class 'torchquantum.operator.standard_gates.u3.U3'>, <class 'torchquantum.operator.standard_gates.paulix.MultiCNOT'>, <class 'torchquantum.operator.standard_gates.paulix.MultiXCNOT'>), seed=None, qiskit_compatible=False)[source]#
Initialize the QuantumModule.
- Returns:
None.
Examples
>>> qmodule = QuantumModule()
Attributes