class_docstr: Test the gradient of qml.math.fidelity
docstr: Test gradients are correct for a broadcasted input for jax
code: def test_broadcast_jax(
      self, cost_fn, expected_res, expected_grad, tol
  ):
      """Test gradients are correct for a broadcasted input for jax"""
      x = jnp.array([0.0, 1e-7, 0.456, np.pi / 2 - 1e-7, np.pi / 2])
      res = cost_fn(x)
      grad = qml.math.diag(jax.jacobian(cost_fn)(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 7 for calling the TestGradient obj's underlying member method code with example usage: obj.test_broadcast_jax(cost_fn, expected_res, expected_grad, tol) without return types