(self, out)
return x
Args:
            out: unnormalized word distribution [batch_size, vocab_size]
        Return:
            x: word_index [batch_size]
Args:
            out: unnormalized word distribution [batch_size, vocab_size]
        Return:
            x: word_index [batch_size]
Args : out : unnormalized word distribution [ batch_size vocab_size ] Return : x : word_index [ batch_size ]
def decode(self, out):
        """
        Args:
            out: unnormalized word distribution [batch_size, vocab_size]
        Return:
            x: word_index [batch_size]
        """

        # Sample next word from multinomial word distribution
        if self.sample:
            # x: [batch_size] - word index (next input)
            x = torch.multinomial(self.softmax(out / self.temperature), 1).view(-1)

        # Greedy sampling
        else:
            # x: [batch_size] - word index (next input)
            _, x = out.max(dim=1)
        return x
def decode ( self , out ) : # Sample next word from multinomial word distribution if self . sample : # x: [batch_size] - word index (next input) x = torch . multinomial ( self . softmax ( out / self . temperature ) , 1 ) . view ( - 1 ) # Greedy sampling else : # x: [batch_size] - word index (next input) _ , x = out . max ( dim = 1 ) return x