class_docstr: Test that the gradient of the state reconstruction is correct
class_docstr_tok: ["Test","that","the","gradient","of","the","state","reconstruction","is","correct"]
docstr: Test the gradient of the state for the autograd interface
docstr_tok: ["Test","the","gradient","of","the","state","for","the","autograd","interface"]
code: def test_backward_autograd(self):
      """Test the gradient of the state for the autograd interface"""
      # pylint: disable=cell-var-from-loop
      shadow_circuit = basic_entangler_circuit(
          3, shots=20000, interface="autograd"
      )
  
      sub_wires = [[0, 1], [1, 2]]
      shadow_circuit = qml.shadows.shadow_state(
          shadow_circuit, wires=sub_wires, diffable=True
      )
  
      x = np.array(self.x, requires_grad=True)
  
      # for autograd in particular, take only the real part since it doesn't
      # support complex differentiation
      actual = qml.jacobian(
          lambda x: qml.math.real(qml.math.stack(shadow_circuit(x)))
      )(x)
  
      for act, w in zip(qml.math.unstack(actual), sub_wires):
          exact_circuit = basic_entangler_circuit_exact_state(
              3, w, "autograd"
          )
          expected = qml.jacobian(
              lambda x: qml.math.real(exact_circuit(x))
          )(x)
  
          assert qml.math.allclose(act, expected, atol=1e-1)
  
imports: from functools import partial
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.shadows.transforms import _replace_obs
label_desc: Use image node_id 1 for calling the TestStateBackward obj's underlying member method code with example usage: obj.test_backward_autograd() without return types