class_docstr: Autodiff tests for all frameworks
class_docstr_tok: ["Autodiff","tests","for","all","frameworks"]
docstr: Test that results after splitting are still differentiable with torch
docstr_tok: ["Test","that","results","after","splitting","are","still","differentiable","with","torch"]
code: def test_split_with_torch(self):
      """Test that results after splitting are still differentiable with torch"""
  
      import torch
      from torch.autograd.functional import jacobian
  
      dev = qml.device("default.qubit.torch", wires=3)
  
      @qml.qnode(dev)
      def circuit(params):
          qml.RX(params[0], wires=0)
          qml.RY(params[1], wires=1)
          return (
              qml.expval(qml.PauliZ(0) @ qml.PauliZ(1)),
              qml.expval(qml.PauliY(0)),
              qml.expval(qml.PauliZ(0)),
          )
  
      def cost(params):
          res = split_non_commuting(circuit)(params)
          return qml.math.stack(res)
  
      params = torch.tensor([0.5, 0.5], requires_grad=True)
      res = cost(params)
      grad = jacobian(cost, (params))
      assert all(np.isclose(res.detach().numpy(), exp_res))
      assert all(
          np.isclose(
              grad.detach().numpy(), exp_grad, atol=1e-5
          ).flatten()
      )
  
imports: import itertools
  import pytest
  import numpy
  import pennylane
  import pennylane.numpy
  from pennylane.transforms import split_non_commuting
label_desc: Use image node_id 9 for calling the TestAutodiffSplitNonCommuting obj's underlying member method code with example usage: obj.test_split_with_torch() and returns: qml,  qml,  qml, qml