class_docstr: Tests for the finite difference gradient transform
class_docstr_tok: ["Tests","for","the","finite","difference","gradient","transform"]
docstr: Test the case where expectation values are independent of some parameters. For those
  parameters, the gradient should be evaluated to zero without executing the device.
code: def test_independent_parameters(self):
      """Test the case where expectation values are independent of some parameters. For those
      parameters, the gradient should be evaluated to zero without executing the device.
      """
      dev = qml.device("default.qubit")
  
      with qml.queuing.AnnotatedQueue() as q1:
          qml.RX(1.0, wires=[0])
          qml.RX(1.0, wires=[1])
          qml.expval(qml.PauliZ(0))
  
      tape1 = qml.tape.QuantumScript.from_queue(q1)
      with qml.queuing.AnnotatedQueue() as q2:
          qml.RX(1.0, wires=[0])
          qml.RX(1.0, wires=[1])
          qml.expval(qml.PauliZ(1))
  
      tape2 = qml.tape.QuantumScript.from_queue(q2)
      tapes, fn = finite_diff(tape1, approx_order=1)
      with qml.Tracker(dev) as tracker:
          j1 = fn(dev.execute(tapes))
  
      # We should only be executing the device to differentiate 1 parameter (2 executions)
      assert tracker.totals["executions"] == 2
  
      tapes, fn = finite_diff(tape2, approx_order=1)
      j2 = fn(dev.execute(tapes))
  
      exp = -np.sin(1)
  
      assert np.allclose(j1, [exp, 0])
      assert np.allclose(j2, [0, exp])
  
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 14 for calling the TestFiniteDiff obj's underlying member method code with example usage: obj.test_independent_parameters() without return types