def get_loss(self, input, rewards):
        """
        Calculate generator loss
        @param input: samples with start token, batch size * seq_len
        @param rewards: rewards form mediator, (batch size * seq_len) * vocab_size
        @return:
        """
        log_pred = self.forward(input, self.init_hidden(input.size(0)))  # (batch_size * seq_len) * vocab_size
        g_pred = torch.exp(log_pred)
        loss = -torch.sum(g_pred * (rewards - log_pred)) / rewards.size(0)
        return loss

        Calculate generator loss
        @param input: samples with start token, batch size * seq_len
        @param rewards: rewards form mediator, (batch size * seq_len) * vocab_size
        @return:
        
models/CoT_G.py