def test_qnode_evaluation_agrees(self, qubit_device_2_wires, tol):
    'Tests that simple example is consistent.'

    @qml.qnode(qubit_device_2_wires, interface='autograd')
    def circuit(phi, theta):
        qml.RX(phi[0], wires=0)
        qml.RY(phi[1], wires=1)
        qml.CNOT(wires=[0, 1])
        qml.PhaseShift(theta[0], wires=0)
        return qml.expval(qml.PauliZ(0))

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def circuit_tf(phi, theta):
        qml.RX(phi[0], wires=0)
        qml.RY(phi[1], wires=1)
        qml.CNOT(wires=[0, 1])
        qml.PhaseShift(theta[0], wires=0)
        return qml.expval(qml.PauliZ(0))
    phi = [0.5, 0.1]
    theta = [0.2]
    phi_t = Variable(phi)
    theta_t = Variable(theta)
    autograd_eval = circuit(phi, theta)
    tf_eval = circuit_tf(phi_t, theta_t)
    assert np.allclose(autograd_eval, tf_eval.numpy(), atol=tol, rtol=0)
Tests that simple example is consistent.
def test_qnode_evaluation_agrees(self, qubit_device_2_wires, tol):
    

    @qml.qnode(qubit_device_2_wires, interface='autograd')
    def circuit(phi, theta):
        qml.RX(phi[0], wires=0)
        qml.RY(phi[1], wires=1)
        qml.CNOT(wires=[0, 1])
        qml.PhaseShift(theta[0], wires=0)
        return qml.expval(qml.PauliZ(0))

    @qml.qnode(qubit_device_2_wires, interface='tf')
    def circuit_tf(phi, theta):
        qml.RX(phi[0], wires=0)
        qml.RY(phi[1], wires=1)
        qml.CNOT(wires=[0, 1])
        qml.PhaseShift(theta[0], wires=0)
        return qml.expval(qml.PauliZ(0))
    phi = [0.5, 0.1]
    theta = [0.2]
    phi_t = Variable(phi)
    theta_t = Variable(theta)
    autograd_eval = circuit(phi, theta)
    tf_eval = circuit_tf(phi_t, theta_t)
    assert np.allclose(autograd_eval, tf_eval.numpy(), atol=tol, rtol=0)