code: def execute(cls, ctx, op):
      inputs, device_id, xp = as_same_device(
          [ctx[c.key] for c in op.inputs],
          device=op.device,
          ret_extra=True,
      )
      out = op.outputs[0]
      n_samples1, n_samples2 = out.shape
      n_neighbors = op.n_neighbors
      n_nonzero = n_samples1 * n_neighbors
  
      with device(device_id):
          A_ind = inputs[-1]
          A_indptr = xp.arange(0, n_nonzero + 1, n_neighbors)
  
          if op.a_data is None:
              # mode == 'connectivity
              A_data = xp.ones(n_samples1 * n_neighbors)
          else:
              # mode == 'distance'
              A_data = xp.ravel(inputs[0])
  
          xps = get_sparse_module(A_ind)
          graph = xps.csr_matrix(
              (A_data, A_ind.ravel(), A_indptr),
              shape=(n_samples1, n_samples2),
          )
          ctx[out.key] = SparseNDArray(graph)
  
imports: import numpy
  from ...None import opcodes
  from ...core import recursive_tile
  from ...lib.sparse.array import get_sparse_module, SparseNDArray
  from ...serialization.serializables import KeyField, Int64Field
  from ...tensor.array_utils import as_same_device, device
  from ...tensor.core import TensorOrder
  from ...tensor.utils import decide_unify_split
  from ...utils import has_unknown_shape
  from ..operands import LearnOperand, LearnOperandMixin, OutputType
label_desc: Use image node_id 8 for calling the KNeighborsGraph obj's underlying member method code with example usage: obj.execute(cls, ctx, op) without return types