class_docstr: Class to test the integration of argnums (Jax) and the finite-diff transform.
class_docstr_tok: ["Class","to","test","the","integration","of","argnums","(","Jax",")","and","the","finite-diff","transform","."]
docstr: Test for hessian.
code: def test_hessian(self, argnums, interface, approx_order, strategy):
      """Test for hessian."""
      import jax
  
      dev = qml.device("default.qubit", wires=2)
  
      @qml.qnode(dev, interface=interface)
      def circuit(x, y):
          qml.RX(x[0], wires=[0])
          qml.RY(x[1], wires=[1])
          qml.RY(y, wires=[1])
          qml.CNOT(wires=[0, 1])
          return qml.var(qml.PauliZ(0) @ qml.PauliX(1))
  
      x = jax.numpy.array([0.543, -0.654])
      y = jax.numpy.array(-0.123)
  
      res = jax.jacobian(
          qml.gradients.finite_diff(
              circuit,
              approx_order=approx_order,
              strategy=strategy,
              h=1e-5,
              argnums=argnums,
          ),
          argnums=argnums,
      )(x, y)
      res_expected = jax.hessian(circuit, argnums=argnums)(x, y)
  
      tol = 10e-6
  
      if argnums == [0]:
          assert np.allclose(res[0][0], res_expected[0][0][0], atol=tol)
          assert np.allclose(res[1][0], res_expected[0][0][1], atol=tol)
      else:
          if len(argnums) != 1:
              res = res[0]
  
          for r, r_e in zip(res, res_expected[0]):
              assert np.allclose(r, r_e, atol=tol)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.gradients import finite_diff, finite_diff_coeffs
  from pennylane.operation import AnyWires, Observable
label_desc: Use image node_id 3 for calling the TestJaxArgnums obj's underlying member method code with example usage: obj.test_hessian(argnums, interface, approx_order, strategy) and returns: qml