class_docstr: Test that the transform is differentiable
class_docstr_tok: ["Test","that","the","transform","is","differentiable"]
docstr: Tests that the output of the hadamard gradient transform
  can be differentiated using TF, yielding second derivatives.
code: def test_tf(self, dev_name):
      """Tests that the output of the hadamard gradient transform
      can be differentiated using TF, yielding second derivatives."""
      import tensorflow as tf
  
      dev = qml.device(dev_name, wires=3)
      execute_fn = (
          dev.execute
          if dev_name == "default.qubit"
          else dev.batch_execute
      )
      params = tf.Variable([0.543, -0.654], dtype=tf.float64)
  
      with tf.GradientTape() as t_h:
          with qml.queuing.AnnotatedQueue() as q:
              qml.RX(params[0], wires=[0])
              qml.RY(params[1], wires=[1])
              qml.CNOT(wires=[0, 1])
              qml.expval(qml.PauliZ(0) @ qml.PauliX(1))
  
          tape = qml.tape.QuantumScript.from_queue(q)
          tape.trainable_params = {0, 1}
          tapes, fn = qml.gradients.hadamard_grad(tape)
          jac_h = fn(execute_fn(tapes))
          jac_h = qml.math.stack(jac_h)
  
      with tf.GradientTape() as t_p:
          with qml.queuing.AnnotatedQueue() as q:
              qml.RX(params[0], wires=[0])
              qml.RY(params[1], wires=[1])
              qml.CNOT(wires=[0, 1])
              qml.expval(qml.PauliZ(0) @ qml.PauliX(1))
  
          tape = qml.tape.QuantumScript.from_queue(q)
          tape.trainable_params = {0, 1}
          tapes, fn = qml.gradients.param_shift(tape)
          jac_p = fn(execute_fn(tapes))
          jac_p = qml.math.stack(jac_p)
  
      res_hadamard = t_h.jacobian(jac_h, params)
      res_param_shift = t_p.jacobian(jac_p, params)
  
      assert np.allclose(res_hadamard, res_param_shift)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 2 for calling the TestHadamardTestGradDiff obj's underlying member method code with example usage: obj.test_tf(dev_name) without return types