code: def _filter_top_k(x, k):
      """Filters top-k values in the last dim of x and set the rest to NEG_INF.
  
      Used for computing top-k prediction values in dense labels (which has the
      same shape as predictions) for recall and precision top-k metrics.
  
      Args:
        x: tensor with any dimensions.
        k: the number of values to keep.
  
      Returns:
        tensor with same shape and dtype as x.
      """
      _, top_k_idx = ops.top_k(x, k)
      top_k_mask = ops.sum(
          ops.one_hot(top_k_idx, ops.shape(x)[-1], axis=-1), axis=-2
      )
      return x * top_k_mask + NEG_INF * (1 - top_k_mask)
  
imports: from enum import Enum
  import numpy
  from keras import backend
  from keras import ops
  from keras.losses.loss import squeeze_to_same_rank
  from keras.utils.python_utils import to_list
label_desc: Use image node_id 6 for calling a global function with example usage: _filter_top_k(x, k) and returns: unknown