class_docstr: KTUP is a knowledge-based recommendation model. It adopts the strategy of multi-task learning to jointly learn
  recommendation and KG-related tasks, with the goal of understanding the reasons that a user interacts with an item.
  This method utilizes an attention mechanism to combine all preferences into a single-vector representation.
docstr: Return the result of Straight-Through Gumbel-Softmax Estimation.
  It approximates the discrete sampling via Gumbel-Softmax trick
  and applies the biased ST estimator.
  In the forward propagation, it emits the discrete one-hot result,
  and in the backward propagation it approximates the categorical
  distribution via smooth Gumbel-Softmax distribution.
  
  Args:
      logits (Variable): A un-normalized probability values,
          which has the size (batch_size, num_classes)
      temperature (float): A temperature parameter. The higher
          the value is, the smoother the distribution is.
  
  Returns:
      torch.Tensor: The sampled output, which has the property explained above.
docstr_tok: ["Return","the","result","of","Straight-Through","Gumbel-Softmax","Estimation",".","It","approximates","the","discrete","sampling","via","Gumbel-Softmax","trick","and","applies","the","biased","ST","estimator",".","In","the","forward","propagation",",","it","emits","the","discrete","one-hot","result",",","and","in","the","backward","propagation","it","approximates","the","categorical","distribution","via","smooth","Gumbel-Softmax","distribution",".","Args",":","logits","(","Variable",")",":","A","un-normalized","probability","values",",","which","has","the","size","(","batch_size",",","num_classes",")","temperature","(","float",")",":","A","temperature","parameter",".","The","higher","the","value","is",",","the","smoother","the","distribution","is",".","Returns",":","torch.Tensor",":","The","sampled","output",",","which","has","the","property","explained","above","."]
code: def st_gumbel_softmax(self, logits, temperature=1.0):
      r"""Return the result of Straight-Through Gumbel-Softmax Estimation.
      It approximates the discrete sampling via Gumbel-Softmax trick
      and applies the biased ST estimator.
      In the forward propagation, it emits the discrete one-hot result,
      and in the backward propagation it approximates the categorical
      distribution via smooth Gumbel-Softmax distribution.
  
      Args:
          logits (Variable): A un-normalized probability values,
              which has the size (batch_size, num_classes)
          temperature (float): A temperature parameter. The higher
              the value is, the smoother the distribution is.
  
      Returns:
          torch.Tensor: The sampled output, which has the property explained above.
      """
  
      eps = 1e-20
      u = logits.data.new(*logits.size()).uniform_()
      gumbel_noise = Variable(-torch.log(-torch.log(u + eps) + eps))
      y = logits + gumbel_noise
      y = self._masked_softmax(logits=y / temperature)
      y_argmax = y.max(len(y.shape) - 1)[1]
      y_hard = self.convert_to_one_hot(
          indices=y_argmax, num_classes=y.size(len(y.shape) - 1)
      ).float()
      y = (y_hard - y).detach() + y
      return y
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from torch.autograd import Variable
  from recbole.model.abstract_recommender import KnowledgeRecommender
  from recbole.model.init import xavier_uniform_initialization
  from recbole.model.loss import BPRLoss, EmbMarginLoss
  from recbole.utils import InputType
label_desc: Use image node_id 4 for calling the KTUP obj's underlying member method code with example usage: obj.st_gumbel_softmax(logits, temperature) and returns: y