class_docstr: Test the shadow_expval measurement process backward pass
class_docstr_tok: ["Test","the","shadow_expval","measurement","process","backward","pass"]
docstr: Test that the gradient of the expval estimation is correct for
  the autograd interface
docstr_tok: ["Test","that","the","gradient","of","the","expval","estimation","is","correct","for","the","autograd","interface"]
code: def test_backward_autograd(self, obs=obs_strongly_entangled):
      """Test that the gradient of the expval estimation is correct for
      the autograd interface"""
      shadow_circuit = strongly_entangling_circuit(
          3, shots=20000, interface="autograd"
      )
      exact_circuit = strongly_entangling_circuit_exact(3, "autograd")
  
      def cost_exact(x, obs):
          return autograd.numpy.hstack(exact_circuit(x, obs))
  
      # make rotations close to pi / 2 to ensure gradients are not too small
      x = np.random.uniform(
          0.8,
          2,
          size=qml.StronglyEntanglingLayers.shape(
              n_layers=2, n_wires=3
          ),
      )
      actual = qml.jacobian(shadow_circuit)(x, obs, k=1)
      expected = qml.jacobian(cost_exact, argnum=0)(x, obs)
  
      assert qml.math.allclose(actual, expected, atol=1e-1)
  
imports: import copy
  import autograd.numpy
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.measurements import ClassicalShadowMP, Shots
  from pennylane.measurements.classical_shadow import ShadowExpvalMP
label_desc: Use image node_id 1 for calling the TestExpvalBackward obj's underlying member method code with example usage: obj.test_backward_autograd(obs) and returns: autograd