docstr: Test operator arithmetic circuit with non-integer wires works with torch.
docstr_tok: ["Test","operator","arithmetic","circuit","with","non-integer","wires","works","with","torch","."]
code: def test_torch_op_arithmetic(self):
      """Test operator arithmetic circuit with non-integer wires works with torch."""
      import torch
  
      phi = torch.tensor(-0.7290, requires_grad=True)
  
      def f(x):
          ops = [
              qml.PauliX("a"),
              qml.PauliX("b"),
              qml.ctrl(
                  qml.RX(x, "target"),
                  ("a", "b", -3),
                  control_values=[1, 1, 0],
              ),
          ]
  
          qs = qml.tape.QuantumScript(
              ops,
              [
                  qml.expval(
                      qml.sum(qml.PauliY("target"), qml.PauliZ("b"))
                  ),
                  qml.expval(qml.s_prod(3, qml.PauliZ("target"))),
              ],
          )
  
          return simulate(qs)
  
      results = f(phi)
      assert qml.math.allclose(results[0], -torch.sin(phi) - 1)
      assert qml.math.allclose(results[1], 3 * torch.cos(phi))
  
      g = torch.autograd.functional.jacobian(f, phi)
      assert qml.math.allclose(g[0], -torch.cos(phi))
      assert qml.math.allclose(g[1], -3 * torch.sin(phi))
  
imports: import pytest
  import numpy
  import pennylane
  from pennylane.devices.qubit import simulate, get_final_state, measure_final_state
label_desc: Use image node_id 4 for calling the TestOperatorArithmetic obj's underlying member method code with example usage: obj.test_torch_op_arithmetic() and returns: simulate