class_docstr: Test the Gradient Descent optimizer
class_docstr_tok: ["Test","the","Gradient","Descent","optimizer"]
docstr: Test that the correct cost is returned via the step_and_cost method for the
  gradient-descent optimizer
docstr_tok: ["Test","that","the","correct","cost","is","returned","via","the","step_and_cost","method","for","the","gradient-descent","optimizer"]
code: def test_step_and_cost_autograd_sgd_single_multid_input(self):
      """Test that the correct cost is returned via the step_and_cost method for the
      gradient-descent optimizer"""
      stepsize = 0.1
      sgd_opt = GradientDescentOptimizer(stepsize)
      multid_array = np.array([[0.1, 0.2], [-0.1, -0.4]])
  
      @qml.qnode(qml.device("default.qubit", wires=1))
      def quant_fun_mdarr(var):
          qml.RX(var[0, 1], wires=[0])
          qml.RY(var[1, 0], wires=[0])
          qml.RY(var[1, 1], wires=[0])
          return qml.expval(qml.PauliZ(0))
  
      _, res = sgd_opt.step_and_cost(quant_fun_mdarr, multid_array)
      expected = quant_fun_mdarr(multid_array)
  
      assert np.all(res == expected)
  
file_path: pennylane/tests/optimize/test_gradient_descent.py
imports: import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.optimize import GradientDescentOptimizer
label_desc: Use image node_id 4 for calling the TestGradientDescentOptimizer obj's underlying member method code with example usage: obj.test_step_and_cost_autograd_sgd_single_multid_input() and returns: qml