class_docstr: Test the SPSA optimizer.
docstr: Test that the correct cost is returned via the step_and_cost method
  with a multidimensional input.
docstr_tok: ["Test","that","the","correct","cost","is","returned","via","the","step_and_cost","method","with","a","multidimensional","input","."]
code: def test_step_and_cost_spsa_single_multid_input(self):
      """Test that the correct cost is returned via the step_and_cost method
      with a multidimensional input."""
      spsa_opt = qml.SPSAOptimizer(maxiter=10)
      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 = spsa_opt.step_and_cost(quant_fun_mdarr, multid_array)
      expected = quant_fun_mdarr(multid_array)
  
      assert np.all(res == expected)
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 7 for calling the TestSPSAOptimizer obj's underlying member method code with example usage: obj.test_step_and_cost_spsa_single_multid_input() and returns: qml