How to use PennyLane - 10 common examples

To help you get started, we’ve selected a few PennyLane examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github XanaduAI / pennylane / tests / qnode_new / test_qnode_base.py View on Github external
def circuit(x):
        qml.RX(x, wires=[0])
        qml.CNOT(wires=[0, 1])
        qml.RY(0.4, wires=[0])
        qml.RZ(-0.2, wires=[1])
        return qml.expval(qml.PauliX(0)), qml.expval(qml.PauliZ(1))
github XanaduAI / pennylane / tests / qnodes / test_qnode_qubit.py View on Github external
def circuit(x):
            qml.RX(x, wires=[1])
            return qml.expval(qml.PauliZ(0))
github XanaduAI / pennylane / tests / interfaces / test_interfaces_autograd.py View on Github external
def classifier_circuit(in_data, x):
            qml.RX(in_data, wires=[0])
            qml.CNOT(wires=[0, 1])
            qml.RY(-1.6, wires=[0])
            qml.RY(in_data, wires=[1])
            qml.CNOT(wires=[1, 0])
            qml.RX(x, wires=[0])
            qml.CNOT(wires=[0, 1])
            return qml.expval(qml.PauliZ(0))
github XanaduAI / pennylane / tests / qnodes / test_qnode_base.py View on Github external
def circuit(x):
            qml.RX(0.5, wires=[0])
            return qml.expval(qml.PauliZ(0))
github XanaduAI / pennylane / tests / test_templates.py View on Github external
def circuit(*inp):
            template(*inp, **hyperp)
            return qml.expval(qml.Identity(0))
github XanaduAI / pennylane / tests / qnodes / test_qnode_base.py View on Github external
def circuit(x):
            qml.RX(x, wires=[0])
            ex = qml.expval(qml.PauliZ(wires=1))
            qml.RY(0.5, wires=[0])
            return qml.expval(qml.PauliZ(wires=0))
github XanaduAI / pennylane / tests / test_tf.py View on Github external
def circuit(w, x=None):
            qml.RX(x[0], wires=[0])
            qml.RX(x[1], wires=[1])
            return qml.expval(qml.PauliZ(0)), qml.expval(qml.PauliZ(1))
github XanaduAI / pennylane / tests / test_qnode.py View on Github external
def circuit(a):
            qml.RX(a, wires=0)
            return qml.var(qml.PauliZ(0))
github XanaduAI / pennylane / tests / qnodes / test_qnode_jacobian.py View on Github external
def circuit(x):
            qml.Rot(0.3, x, -0.2, wires=[0])
            return qml.expval(qml.PauliZ(0))
github XanaduAI / pennylane / tests / test_torch.py View on Github external
def circuit(w, x=None):
            qml.RX(x, wires=[0])
            return qml.expval(qml.PauliZ(0))

PennyLane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.

Apache-2.0
Latest version published 17 days ago

Package Health Score

87 / 100
Full package analysis