class_docstr: Unit tests for the gradient function
docstr: Test gradient computation with a non-scalar cost function raises an error
docstr_tok: ["Test","gradient","computation","with","a","non-scalar","cost","function","raises","an","error"]
code: def test_non_scalar_cost_gradient(self):
      """Test gradient computation with a non-scalar cost function raises an error"""
  
      def cost(x):
          return np.sin(x)
  
      grad_fn = qml.grad(cost, argnum=[0])
      arr1 = np.array([0.0, 1.0, 2.0], requires_grad=True)
  
      with pytest.raises(
          TypeError,
          match="only applies to real scalar-output functions",
      ):
          grad_fn(arr1)
  
imports: import autograd
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 1 for calling the TestGrad obj's underlying member method code with example usage: obj.test_non_scalar_cost_gradient() and returns: np