class_docstr: Test that GroverOperator is applied correctly.
class_docstr_tok: ["Test","that","GroverOperator","is","applied","correctly","."]
docstr: Additional kernel to apply GroverOperator to some of all state wires.
docstr_tok: ["Additional","kernel","to","apply","GroverOperator","to","some","of","all","state","wires","."]
code: def grover_kernel_partial_wires(self, state, op_wires, batched):
      """Additional kernel to apply GroverOperator to some of all state wires."""
      num_wires = len(op_wires)
      sum_axes = [w + batched for w in op_wires]
      collapsed = np.sum(state, tuple(sum_axes))
      prefactor = 2 ** (1 - num_wires)
      bcast_shape = [2] * num_wires + list(state.shape[:-num_wires])
      expanded = np.broadcast_to(prefactor * collapsed, bcast_shape)
      source = list(range(num_wires))
      expanded = np.moveaxis(expanded, source, sum_axes)
      return expanded - state
  
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 2 for calling the TestApplyGroverOperator obj's underlying member method code with example usage: obj.grover_kernel_partial_wires(state, op_wires, batched) and returns: unknown