code: def _delta_masking(
      masks,
      x,
      curr_delta_inds,
      varying_rows_out,
      masked_inputs_tmp,
      last_mask,
      data,
      variants,
      masked_inputs_out,
      noop_code,
  ):
      """Implements the special (high speed) delta masking API that only flips the positions we need to.
  
      Note that we attempt to avoid doing any allocation inside this function for speed reasons.
      """
  
      dpos = 0
      i = -1
      masks_pos = 0
      output_pos = 0
      N = masked_inputs_tmp.shape[0]
      while masks_pos < len(masks):
          i += 1
  
          # update the tmp masked inputs array
          dpos = 0
          curr_delta_inds[0] = masks[masks_pos]
          while (
              curr_delta_inds[dpos] < 0
          ):  # negative values mean keep going
              curr_delta_inds[dpos] = (
                  -curr_delta_inds[dpos] - 1
              )  # -value + 1 is the original index that needs flipped
              _single_delta_mask(
                  curr_delta_inds[dpos],
                  masked_inputs_tmp,
                  last_mask,
                  data,
                  x,
                  noop_code,
              )
              dpos += 1
              curr_delta_inds[dpos] = masks[masks_pos + dpos]
          _single_delta_mask(
              curr_delta_inds[dpos],
              masked_inputs_tmp,
              last_mask,
              data,
              x,
              noop_code,
          )
  
          # copy the tmp masked inputs array to the output
          masked_inputs_out[
              output_pos : output_pos + N
          ] = masked_inputs_tmp
          masks_pos += dpos + 1
  
          # mark which rows have been updated, so we can only evaluate the model on the rows we need to
          if i == 0:
              varying_rows_out[i, :] = True
  
          else:
              # only one column was changed
              if dpos == 0:
                  varying_rows_out[i, :] = variants[
                      :, curr_delta_inds[dpos]
                  ]
  
              # more than one column was changed
              else:
                  varying_rows_out[i, :] = (
                      np.sum(
                          variants[:, curr_delta_inds[: dpos + 1]],
                          axis=1,
                      )
                      > 0
                  )
  
          output_pos += N
  
imports: import logging
  import numpy
  import pandas
  from numba import njit
  from ..None import utils
  from .._serializable import Deserializer, Serializer
  from ..utils import MaskedModel
  from ..utils._exceptions import DimensionError, InvalidClusteringError
  from ._masker import Masker
label_desc: Use image node_id 2 for calling a global function with example usage: _delta_masking(masks, x, curr_delta_inds, varying_rows_out, masked_inputs_tmp, last_mask, data, variants, masked_inputs_out, noop_code) without return types