code: def get_kth_value(tensor, k=None):
      if k is None:
          k = max(int(tensor.size / 50000.0), 1)
      return max(np.partition(tensor.flatten(), -int(k))[-int(k)], 0.0)
  
imports: from collections import OrderedDict
  import numpy
  from lightseq.training.ops.pytorch.util import get_pos_embedding
  from lightseq.training import LSTransformerEncoderLayer, LSTransformerDecoderLayer
  from lightseq.training.ops.pytorch.export import apply_rule
label_desc: Use image node_id 2 for calling a global function with example usage: get_kth_value(tensor, k) and returns: max