class_docstr: Testing differentiable ZNE
class_docstr_tok: ["Testing","differentiable","ZNE"]
docstr: Testing that the mitigated qnode can be differentiated and returns
  the correct gradient in jax for multiple measurements
docstr_tok: ["Testing","that","the","mitigated","qnode","can","be","differentiated","and","returns","the","correct","gradient","in","jax","for","multiple","measurements"]
code: def test_diffability_jax_multi(self, interface):
      """Testing that the mitigated qnode can be differentiated and returns
      the correct gradient in jax for multiple measurements"""
      import jax
      import jax.numpy as jnp
  
      qnode_noisy = qml.QNode(
          qfunc_multi, dev_noisy, interface=interface
      )
      qnode_ideal = qml.QNode(
          qfunc_multi, dev_ideal, interface=interface
      )
  
      scale_factors = [1.0, 2.0, 3.0]
  
      mitigated_qnode = mitigate_with_zne(
          qnode_noisy,
          scale_factors,
          fold_global,
          richardson_extrapolate,
      )
  
      theta = jnp.array(
          [np.pi / 4, np.pi / 6],
      )
  
      res = qml.math.stack(mitigated_qnode(theta))
      assert qml.math.allclose(res, out_ideal_multi, atol=1e-2)
  
      grad = jax.jacobian(lambda t: qml.math.stack(mitigated_qnode(t)))(
          theta
      )
      grad_ideal = jax.jacobian(
          lambda t: qml.math.stack(qnode_ideal(t))
      )(theta)
      assert qml.math.allclose(
          grad_ideal, grad_ideal_0_multi, atol=1e-6
      )
      assert qml.math.allclose(grad, grad_ideal, atol=1e-2)
  
imports: from functools import partial
  import pytest
  from packaging import version
  import pennylane
  from pennylane import numpy
  from pennylane.tape import QuantumScript
  from pennylane.transforms import mitigate_with_zne, richardson_extrapolate, fold_global
label_desc: Use image node_id 9 for calling the TestDifferentiableZNE obj's underlying member method code with example usage: obj.test_diffability_jax_multi(interface) without return types