class_docstr: Test the SPSA optimizer.
docstr: Test SPSAOptimizer implementation with default.mixed device.
docstr_tok: ["Test","SPSAOptimizer","implementation","with","default.mixed","device","."]
code: def test_default_mixed_device(self):
      """Test SPSAOptimizer implementation with default.mixed device."""
      n_qubits = 1
      max_iterations = 400
      dev = qml.device("default.mixed", wires=n_qubits)
  
      @qml.qnode(dev)
      def circuit(params):
          qml.RX(params[0], wires=0)
          qml.RY(params[1], wires=0)
          qml.AmplitudeDamping(0.5, wires=0)
          return qml.expval(qml.PauliZ(0))
  
      opt = qml.SPSAOptimizer(maxiter=max_iterations, c=0.3)
  
      init_params = np.random.normal(
          scale=0.1, size=(2,), requires_grad=True
      )
      params = init_params
      init_circuit_res = circuit(params)
  
      for _ in range(max_iterations):
          params, circuit_res = opt.step_and_cost(circuit, params)
  
      assert np.all(params != init_params)
      assert circuit_res < init_circuit_res
  
imports: import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 18 for calling the TestSPSAOptimizer obj's underlying member method code with example usage: obj.test_default_mixed_device() and returns: qml