class_docstr: Test the gradient of qml.math.fidelity
docstr: Test gradients are correct for tf
code: def test_grad_tf(self, x, cost_fn, expected_res, expected_grad, tol):
      """Test gradients are correct for tf"""
      x = tf.Variable(x, trainable=True)
  
      with tf.GradientTape() as tape:
          res = cost_fn(x)
  
      grad = tape.gradient(res, x)
  
      assert qml.math.allclose(res, expected_res(x), tol)
      assert qml.math.allclose(grad, expected_grad(x), tol)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 5 for calling the TestGradient obj's underlying member method code with example usage: obj.test_grad_tf(x, cost_fn, expected_res, expected_grad, tol) without return types