class_docstr: Test that using the QNode with Torch integrates with the PennyLane stack
class_docstr_tok: ["Test","that","using","the","QNode","with","Torch","integrates","with","the","PennyLane","stack"]
docstr: Test that the Torch interface works correctly
  with a matrix parameter
docstr_tok: ["Test","that","the","Torch","interface","works","correctly","with","a","matrix","parameter"]
code: def test_matrix_parameter(
      self,
      interface,
      dev,
      diff_method,
      grad_on_execution,
      device_vjp,
      U,
      tol,
  ):
      """Test that the Torch interface works correctly
      with a matrix parameter"""
      a_val = 0.1
      a = torch.tensor(a_val, dtype=torch.float64, requires_grad=True)
  
      @qnode(
          dev,
          diff_method=diff_method,
          grad_on_execution=grad_on_execution,
          interface=interface,
          device_vjp=device_vjp,
      )
      def circuit(U, a):
          qml.QubitUnitary(U, wires=0)
          qml.RY(a, wires=0)
          return qml.expval(qml.PauliZ(0))
  
      res = circuit(U, a)
  
      if diff_method == "finite-diff":
          assert circuit.qtape.trainable_params == [1]
  
      assert np.allclose(res.detach(), -np.cos(a_val), atol=tol, rtol=0)
  
      res.backward()
      assert np.allclose(a.grad, np.sin(a_val), atol=tol, rtol=0)
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane import qnode
  from pennylane.devices import DefaultQubit
label_desc: Use image node_id 10 for calling the TestQNode obj's underlying member method code with example usage: obj.test_matrix_parameter(interface, dev, diff_method, grad_on_execution, device_vjp, U, tol) and returns: qml