code: def test_different_batchdim_error():
      """Test that an error is raised when different batch
      dimensions are given to the decorated QNode"""
      dev = qml.device("default.qubit", wires=2)
  
      # To test this error message, we need to use operations that do
      # not report problematic broadcasting dimensions (in place of problematic
      # batch dimensions) at tape creation. For this, we "delete" `ndim_params`.
  
      class RX_no_ndim(qml.RX):
          ndim_params = property(lambda self: self._ndim_params)
  
      class RY_no_ndim(qml.RY):
          ndim_params = property(lambda self: self._ndim_params)
  
      @qml.qnode(dev)
      def circuit(x, y, z):
          RX_no_ndim(x, wires=0)
          RY_no_ndim(y[..., 0], wires=0)
          RY_no_ndim(y[..., 1], wires=1)
          RX_no_ndim(z, wires=1)
          return qml.expval(qml.PauliZ(wires=0) @ qml.PauliZ(wires=1))
  
      batch_size1, batch_size2 = 5, 4
  
      # the second partial argument
      y = np.random.uniform(size=2)
  
      # the batched arguments to the new partial circuit
      x = np.random.uniform(size=batch_size1)
      z = np.random.uniform(size=batch_size2)
  
      batched_partial_circuit = qml.batch_partial(circuit, y=y)
  
      msg = "has incorrect batch dimension. Expecting first dimension of length 5."
      msg = re.escape(msg)
      with pytest.raises(ValueError, match=msg):
          batched_partial_circuit(x=x, z=z)
  
imports: import re
  import pytest
  import pennylane
  from pennylane import numpy
label_desc: Use image node_id 20 for calling a global function with example usage: test_different_batchdim_error() and returns: qml