class_docstr: Test the torch interface execute function
  integrates well for both forward and backward execution
class_docstr_tok: ["Test","the","torch","interface","execute","function","integrates","well","for","both","forward","and","backward","execution"]
docstr: Test differentiating a tape with sampling results in an error
code: def test_sampling_gradient_error(self, torch_device, execute_kwargs):
      """Test differentiating a tape with sampling results in an error"""
      # pylint: disable=unused-argument
      if (
          execute_kwargs["gradient_fn"] == "device"
          and execute_kwargs["grad_on_execution"] is True
      ):
          pytest.skip(
              "Adjoint differentiation does not support samples"
          )
  
      dev = qml.device("default.qubit.legacy", wires=1, shots=10)
  
      x = torch.tensor(0.65, requires_grad=True)
  
      with qml.queuing.AnnotatedQueue() as q:
          qml.RX(x, wires=[0])
          qml.sample(qml.PauliZ(0))
  
      tape = qml.tape.QuantumScript.from_queue(q)
  
      res = execute([tape], dev, **execute_kwargs)[0]
  
      with pytest.raises(
          RuntimeError,
          match="element 0 of tensors does not require grad and does not have a grad_fn",
      ):
          res.backward()
  
imports: import numpy
  import pytest
  import pennylane
  from pennylane.gradients import finite_diff, param_shift
  from pennylane import execute
label_desc: Use image node_id 14 for calling the TestTorchExecuteIntegration obj's underlying member method code with example usage: obj.test_sampling_gradient_error(torch_device, execute_kwargs) without return types