code: def reparameter_sampling(sample_size, probabilities):
      r"""
      Faster sampling algorithm, gumbel softmax trick.
      :param sample_size:
      :param probabilities:
      :return:  index of sampled items (unbiased)
      """
      random_values = np.random.uniform(size=probabilities.shape)
      random_values = np.log(
          -np.log(random_values)
      )  # gives gumbel random variable
      shifted_probabilities = random_values - np.log(probabilities)
      return np.argpartition(shifted_probabilities, sample_size)[
          :sample_size
      ]
  
file_path: recommenders/examples/07_tutorials/KDD2020-tutorial/utils/general.py
imports: import os
  import numpy
label_desc: Use image node_id 5 for calling a global function with example usage: reparameter_sampling(sample_size, probabilities) and returns: np