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 torch interface
docstr_tok: ["Test","the","gradient","of","the","state","for","the","torch","interface"]
code: def test_backward_torch(self):
      """Test the gradient of the state for the torch interface"""
      import torch
  
      shadow_circuit = basic_entangler_circuit(
          3, shots=20000, interface="torch"
      )
  
      sub_wires = [[0, 1], [1, 2]]
      shadow_circuit = qml.shadows.shadow_state(
          shadow_circuit, wires=sub_wires, diffable=True
      )
  
      x = torch.tensor(self.x, requires_grad=True)
  
      actual = torch.autograd.functional.jacobian(
          lambda x: 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, "torch"
          )
          expected = torch.autograd.functional.jacobian(
              exact_circuit, 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 4 for calling the TestStateBackward obj's underlying member method code with example usage: obj.test_backward_torch() without return types