@pytest.mark.parametrize('x, y', gradient_test_data)
def test_division_qnodes_gradient(self, qnodes, x, y, tol):
    'Test the gradient of division of two QNode circuits'
    (f, g) = qnodes

    def div(a, b):
        return (a / b)
    xt = Variable(x)
    yt = Variable(y)
    with tf.GradientTape() as tape:
        tape.watch([xt, yt])
        a = f(xt)
        b = g(yt)
        y = div(a, b)
        grad = tape.gradient(y, [a, b])
    assert (grad[0].numpy() == (1 / b.numpy()))
    assert np.allclose(grad[1].numpy(), ((- a.numpy()) / (b.numpy() ** 2)), atol=tol, rtol=0)
Test the gradient of division of two QNode circuits
@pytest.mark.parametrize('x, y', gradient_test_data)
def test_division_qnodes_gradient(self, qnodes, x, y, tol):
    
    (f, g) = qnodes

    def div(a, b):
        return (a / b)
    xt = Variable(x)
    yt = Variable(y)
    with tf.GradientTape() as tape:
        tape.watch([xt, yt])
        a = f(xt)
        b = g(yt)
        y = div(a, b)
        grad = tape.gradient(y, [a, b])
    assert (grad[0].numpy() == (1 / b.numpy()))
    assert np.allclose(grad[1].numpy(), ((- a.numpy()) / (b.numpy() ** 2)), atol=tol, rtol=0)