class_docstr: Tests for the state function
class_docstr_tok: ["Tests","for","the","state","function"]
docstr: Test that the gradient of the state is accessible when using default.qubit.autograd
  with the backprop diff_method.
docstr_tok: ["Test","that","the","gradient","of","the","state","is","accessible","when","using","default.qubit.autograd","with","the","backprop","diff_method","."]
code: def test_gradient_with_passthru_autograd(self):
      """Test that the gradient of the state is accessible when using default.qubit.autograd
      with the backprop diff_method."""
  
      dev = qml.device("default.qubit.autograd", wires=1)
  
      @qml.qnode(dev, interface="autograd", diff_method="backprop")
      def func(x):
          qml.RY(x, wires=0)
          return state()
  
      x = pnp.array(0.1, requires_grad=True)
  
      def loss_fn(x):
          res = func(x)
          return pnp.real(
              res
          )  # This errors without the real. Likely an issue with complex
          # numbers in autograd
  
      d_loss_fn = qml.jacobian(loss_fn)
  
      grad = d_loss_fn(x)
      expected = np.array([-0.5 * np.sin(x / 2), 0.5 * np.cos(x / 2)])
      assert np.allclose(grad, expected)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.devices import DefaultQubitLegacy
  from pennylane.measurements import State, Shots, density_matrix, expval, state
label_desc: Use image node_id 15 for calling the TestState obj's underlying member method code with example usage: obj.test_gradient_with_passthru_autograd() and returns: state, pnp