class_docstr: Test that using the QNode with JAX integrates with the PennyLane
  stack
class_docstr_tok: ["Test","that","using","the","QNode","with","JAX","integrates","with","the","PennyLane","stack"]
docstr: Test changing the trainability of parameters changes the
  number of differentiation requests made
docstr_tok: ["Test","changing","the","trainability","of","parameters","changes","the","number","of","differentiation","requests","made"]
code: def test_changing_trainability(
      self,
      dev,
      diff_method,
      grad_on_execution,
      device_vjp,
      interface,
      tol,
  ):  # pylint:disable=unused-argument
      """Test changing the trainability of parameters changes the
      number of differentiation requests made"""
      if diff_method != "parameter-shift":
          pytest.skip("Test only supports parameter-shift")
  
      a = jax.numpy.array(0.1)
      b = jax.numpy.array(0.2)
  
      @qnode(dev, interface=interface, diff_method="parameter-shift")
      def circuit(a, b):
          qml.RY(a, wires=0)
          qml.RX(b, wires=1)
          qml.CNOT(wires=[0, 1])
          return qml.expval(
              qml.Hamiltonian([1, 1], [qml.PauliZ(0), qml.PauliY(1)])
          )
  
      grad_fn = jax.grad(circuit, argnums=[0, 1])
      res = grad_fn(a, b)
  
      # the tape has reported both arguments as trainable
      assert circuit.qtape.trainable_params == [0, 1]
  
      expected = [
          -np.sin(a) + np.sin(a) * np.sin(b),
          -np.cos(a) * np.cos(b),
      ]
      assert np.allclose(res, expected, atol=tol, rtol=0)
  
      # make the second QNode argument a constant
      grad_fn = jax.grad(circuit, argnums=0)
      res = grad_fn(a, b)
  
      # the tape has reported only the first argument as trainable
      assert circuit.qtape.trainable_params == [0]
  
      expected = [-np.sin(a) + np.sin(a) * np.sin(b)]
      assert np.allclose(res, expected, atol=tol, rtol=0)
  
imports: from itertools import product
  import numpy
  import pytest
  import pennylane
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 2 for calling the TestQNode obj's underlying member method code with example usage: obj.test_changing_trainability(dev, diff_method, grad_on_execution, device_vjp, interface, tol) and returns: qml