class_docstr: Test the specialized kernel for MultiControlledX and its dispatching.
class_docstr_tok: ["Test","the","specialized","kernel","for","MultiControlledX","and","its","dispatching","."]
docstr: Test that the custom kernel works with Autograd.
docstr_tok: ["Test","that","the","custom","kernel","works","with","Autograd","."]
code: def test_with_autograd(self, batch_dim):
      """Test that the custom kernel works with Autograd."""
      np.random.seed(2751)
      op = qml.MultiControlledX(wires=[0, 4, 3, 1])
      state_shape = ([batch_dim] if batch_dim is not None else []) + [
          2
      ] * 5
      state = np.random.random(state_shape).astype(complex)
      ag_state = qml.numpy.array(state)
      out = apply_operation(
          op,
          ag_state,
          is_state_batched=batch_dim is not None,
          debugger=None,
      )
      # Compute expected output
      exp_out = state.copy()
      exp_out[..., 1, :, :, 1, 1] = np.roll(
          exp_out[..., 1, :, :, 1, 1], 1, -2
      )
      assert qml.math.allclose(out, exp_out)
  
imports: from functools import reduce
  import pytest
  import numpy
  from scipy.stats import unitary_group
  import pennylane
  from pennylane.operation import _UNSET_BATCH_SIZE, Operation
  from pennylane.devices.qubit.apply_operation import apply_operation, apply_operation_einsum, apply_operation_tensordot
label_desc: Use image node_id 4 for calling the TestMultiControlledXKernel obj's underlying member method code with example usage: obj.test_with_autograd(batch_dim) without return types