class_docstr: Test that the top-level compile function works across all interfaces.
class_docstr_tok: ["Test","that","the","top-level","compile","function","works","across","all","interfaces","."]
docstr: Test QNode and gradient in JAX interface.
docstr_tok: ["Test","QNode","and","gradient","in","JAX","interface","."]
code: def test_compile_jax(self, diff_method):
      """Test QNode and gradient in JAX interface."""
      import jax
      from jax import numpy as jnp
  
      original_qnode = qml.QNode(
          qfunc_emb, dev_3wires, diff_method=diff_method
      )
      transformed_qnode = qml.QNode(
          transformed_qfunc_emb, dev_3wires, diff_method=diff_method
      )
  
      x = jnp.array([0.1, 0.2, 0.3], dtype=jnp.float64)
      params = jnp.ones((2, 3), dtype=jnp.float64)
  
      # Check that the numerical output is the same
      assert qml.math.allclose(
          original_qnode(x, params), transformed_qnode(x, params)
      )
  
      # Check that the gradient is the same
      assert qml.math.allclose(
          jax.grad(original_qnode, argnums=(1))(x, params),
          jax.grad(transformed_qnode, argnums=(1))(x, params),
          atol=1e-7,
      )
  
      # Check operation list
      ops = transformed_qnode.qtape.operations
      compare_operation_lists(
          ops, expected_op_list, expected_wires_list
      )
  
imports: from functools import partial
  import pytest
  from test_optimization.utils import compare_operation_lists
  import pennylane
  from pennylane import numpy
  from pennylane.wires import Wires
  from pennylane.transforms.compile import compile
  from pennylane.transforms import unitary_to_rot
  from pennylane.transforms.optimization import cancel_inverses, commute_controlled, merge_rotations, single_qubit_fusion
  from pennylane.transforms.optimization.optimization_utils import _fuse_global_phases
label_desc: Use image node_id 4 for calling the TestCompileInterfaces obj's underlying member method code with example usage: obj.test_compile_jax(diff_method) without return types